Blazor & WASM in combination to get statistics from Spotify API for performing the song analysis. With separate microservices for auth, Spotify, user data tracking, and application, connected through gRPC with Polly.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SearchService.cs 1001B

12345678910111213141516171819202122232425262728293031323334
  1. using SpotifyService.Protos;
  2. using Grpc.Core;
  3. using System.Text.Json;
  4. using SpotifyService.Contracts;
  5. namespace SpotifyService.Services
  6. {
  7. public class SearchService : Search.SearchBase
  8. {
  9. private readonly IHttpClientFactory _httpClientFactory;
  10. public SearchService(IHttpClientFactory httpClientFactory)
  11. {
  12. _httpClientFactory = httpClientFactory;
  13. }
  14. public override async Task<SearchForItemResponse> SearchForItem(SearchForItemRequest request, ServerCallContext context)
  15. {
  16. var httpClient = _httpClientFactory.CreateClient();
  17. var responseText = await httpClient.GetStringAsync($"https://api.spotify.com/v1/search?q={request.Query}&type={request.Type}");
  18. var tracks = JsonSerializer.Deserialize<SearchContracts>(responseText);
  19. return new SearchForItemResponse
  20. {
  21. Tracks = tracks!.Tracks.Items
  22. };
  23. //return null;
  24. }
  25. }
  26. }