public async Task <RecordingsViewModel> GetRecordingsByArtistId(string artistId, string artistName) { var url = _endpointService.GetEndpoint("Recordings.ByArtistId"); url = url.Replace("{artistId}", artistId); var response = await _httpClient.Get(url); var parsedResponse = JObject.Parse(response); var recordings = parsedResponse["recordings"].Children().ToList(); var recordingList = new List <RecordingViewModel>(); foreach (var recording in recordings) { var newRecording = recording.ToObject <RecordingViewModel>(); recordingList.Add(newRecording); } var recordingsViewModel = new RecordingsViewModel { ArtistId = artistId, ArtistName = artistName, Recordings = recordingList }; return(recordingsViewModel); }
private IActionResult Handler(Guid identification) { var endpoint = _endpointService.GetEndpoint(identification); if (endpoint == null) { return(NotFound()); } _endpointService.AddCall(identification, new Call(HttpContext)); return(Ok()); }
public async Task <IEnumerable <ArtistViewModel> > GetByName(string name) { var url = _endpointService.GetEndpoint("Artists.ByName"); url = url.Replace("{name}", name); var response = await _httpClient.Get(url); var parsedResponse = JObject.Parse(response); var artists = parsedResponse["artists"].Children().ToList(); var artistList = new List <ArtistViewModel>(); foreach (var artist in artists) { var newArtist = artist.ToObject <ArtistViewModel>(); artistList.Add(newArtist); } return(artistList); }
private async Task <SkillResponse> HandleIntentRequest(SkillRequest input) { IntentRequest request = input.Request as IntentRequest; var response = CreateBasicSkillResponse(); // get endpoint values IEndpointService endpointService = _ServiceProvider.GetService <IEndpointService>(); var endpoint = await endpointService.GetEndpoint(input.Context.System.User.UserId); if (endpoint == null) { response.Response.OutputSpeech = new PlainTextOutputSpeech("Endpoint is not setup"); return(response); } // get garage service var garageService = GetGarageService(endpoint); string result = null; switch (request.Intent.Name) { case "GetStatus": result = await GetStatus(garageService, request.Intent); break; case "Move": result = await MoveGarage(garageService, request.Intent); break; } if (result != null) { response.Response.OutputSpeech = new PlainTextOutputSpeech(result); } return(response); }