コード例 #1
0
        private async Task <string> GetUserId(string token)
        {
            var userResponse = await _spotService.Access("get", token, "me", null);

            //Get the actual user id
            return(JsonSerializer.Deserialize <Dictionary <string, object> >(userResponse)["id"].ToString());
        }
コード例 #2
0
        public async Task <IActionResult> GetTracks(string id)
        {
            //get auth cookie
            HttpContext.Request.Cookies.TryGetValue("spotauthtoke", out string auth);
            var trackList = new List <TrackResponse>();

            var jsonParams = JsonSerializer.Serialize(new Dictionary <string, string>()
            {
                { "id", id }
            });
            //make API call to get tracks for a specific playlist
            var res = await _sas.Access("post", auth, "/Tracks", jsonParams).ConfigureAwait(true);


            //get the response and be able to return a partial view
            trackList = JsonSerializer.Deserialize <List <TrackResponse> >(res, null);
            //returns okay response with a redirect to viewing the tracks?


            return(PartialView("ViewTracks", trackList));
        }