Пример #1
0
        public static Task <AuthorizationCodeTokenResponse> RequestToken(
            TokenSwapTokenRequest request, IAPIConnector apiConnector
            )
        {
            Ensure.ArgumentNotNull(request, nameof(request));
            Ensure.ArgumentNotNull(apiConnector, nameof(apiConnector));

            var form = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("code", request.Code)
            };

#pragma warning disable CA2000
            return(apiConnector.Post <AuthorizationCodeTokenResponse>(
                       request.TokenUri, null, new FormUrlEncodedContent(form)
                       ));

#pragma warning restore CA2000
        }
Пример #2
0
 /// <summary>
 /// Swaps out a received code with a access token using a remote server
 /// </summary>
 /// <param name="request">The request-model which contains required and optional parameters.</param>
 /// <remarks>
 /// https://developer.spotify.com/documentation/ios/guides/token-swap-and-refresh/
 /// </remarks>
 /// <returns></returns>
 public Task <AuthorizationCodeTokenResponse> RequestToken(TokenSwapTokenRequest request)
 {
     return(RequestToken(request, API));
 }