AddQueryString() public méthode

Appends a key/value pair to the end of the existing QueryString in a URI.
public AddQueryString ( string key, object value ) : void
key string The string key to append to the QueryString.
value object The value to append to the QueryString (we will call .ToString() for you).
Résultat void
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public async Task<AdditionalImagesList> GetAdditionalImages(int setId)
 {
     var request = new RestRequest("getAdditionalImages", HttpMethod.Get)
     {
         ContentType = ContentTypes.Xml,
         IgnoreXmlAttributes = true
     };
     request.AddQueryString("apiKey", ApiId);
     request.AddQueryString("setID", setId);
     //RWM: Using this version handles null results and gives you access to possible exceptions.
     var results = await SendAsync<AdditionalImagesList>(request);
     return results.Content;
 }
        /// <summary>
        /// Gets a new <see cref="RestRequest"/> populated with the common values for every request.
        /// </summary>
        /// <param name="resourceUrl"></param>
        /// <returns>A new <see cref="RestRequest"/> populated with the common values for every request</returns>
        private RestRequest GetPopulatedRequest(string resourceUrl)
        {
            if (string.IsNullOrWhiteSpace(TokenResponse.AccessToken))
            {
                throw new Exception("The Xbox Music Client was unable to obtain an AccessToken from the authentication service.");
            }

            var request = new RestRequest(resourceUrl) { ContentType = ContentTypes.Json };

            request.AddUrlSegment("namespace", "music");

            if (!string.IsNullOrWhiteSpace(Language))
            {
                request.AddQueryString("language", Language);
            }
            if (!string.IsNullOrWhiteSpace(Country))
            {
                request.AddQueryString("country", Country);
            }
           
            return request;
        }
        private RestRequest GetPopulatedRequest(string resourceUrl)
        {
            if (string.IsNullOrWhiteSpace(Token.AccessToken))
            {
                throw new Exception("Unable to obtain an AccessToken.");
            }

            var request = new RestRequest(resourceUrl) {ContentType = ContentTypes.Json};

            request.AddUrlSegment("namespace", "music");

            if (!string.IsNullOrWhiteSpace(Language))
                request.AddQueryString("language", Language);

            if (!string.IsNullOrWhiteSpace(Country))
                request.AddQueryString("country", Country);

            return request;
        }
        /// <summary>
        /// Authenticate this client with the Zipato API REST service.
        /// </summary>
        /// <param name="userNameEmail">User name (typically the email address you use on my.zipato.com)</param>
        /// <param name="password">Password</param>
        public async Task LoginAsync(string userNameEmail, string password)
        {
            // First call user/init which returns us a nonce
            _httpClient = new RestClient();
            _httpClient.BaseUrl = ApiUrl;
            var jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
            _httpClient.JsonSerializerSettings = jsonSerializerSettings;

            var initRequest = new RestRequest("user/init", HttpMethod.Get);
            
            var initResult = await _httpClient.ExecuteWithPolicyAsync<InitResponse>(this, initRequest, byPassCheckInitialized:true);
            if (!initResult.Success)                
                throw new CannotInitializeSessionException();

            // Save the JSessionId, because we pass this as Cookie value to all future requests
            Jessionid = initResult.JSessionId;
            // SHA1-hash the password with the nonce (protects against cross-site forgery)
            string token = Utils.GetToken(password, initResult.Nonce);

            // Sign in with user name and token
            var loginRequest = new RestRequest("user/login", HttpMethod.Get);
            
            loginRequest.AddQueryString("username", userNameEmail);
            loginRequest.AddQueryString("token", token);
            var loginResult = await _httpClient.ExecuteWithPolicyAsync<UserSession>(this, loginRequest, byPassCheckInitialized: true);

            if (!loginResult.Success)
                throw new AuthenticationFailureException(loginResult.Error);

            if (_requireZipaboxOnline)
            {
                _initialized = await CheckConnection();
            }
            else
                _initialized = true;
        }