|
12345678910111213141516171819202122232425262728293031323334 |
- @page "/"
- @using Grpc.Net.Client
- @using Grpc.Net.Client.Web
- @using SpotifyService.Protos
- @inject NavigationManager NavigationManager
- @inject Search.SearchClient SearchClient
- <PageTitle>Index</PageTitle>
-
- <h1>Pozdrav Diligent!</h1>
-
- Dobrodošli u našu NemAn aplikaciju.
-
- <button class="btn-outline-success" @onclick="Grpc">Spotify</button>
-
- @code {
- private async Task SpotifyRedirect()
- {
- NavigationManager.NavigateTo(
- "https://accounts.spotify.com/en/authorize?client_id=83e1d09876b049c4bb1953185a4b3bfb&redirect_uri=https%3A%2F%2Flocalhost%3A7229%2F&response_type=code&scope=user-read-currently-playing%20user-read-email%20user-library-modify%20user-top-read%0A%0A%0A&show_dialog=true");
- }
-
- private async Task Grpc()
- {
- var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler());
- var channel = GrpcChannel.ForAddress("https://localhost:7251/", new GrpcChannelOptions
- {
- HttpHandler = httpHandler
- });
-
- // var client = new Search.SearchClient(channel);
- var response = SearchClient.SearchForItem(new SearchForItemRequest { Query = "venom", Type = "track"/*, Limit = 5, Offset = 0, IncludeExternal = "audio"*/});
- Console.WriteLine(response);
- }
- }
|