private Uri BuildApiUri(string method, string mode = "GET", Dictionary <string, string>?parameters = null) { if (parameters == null) { parameters = new Dictionary <string, string>(); } parameters.Add("format", "json"); parameters.Add("method", method); parameters.Add("nojsoncallback", "1"); if (!string.IsNullOrEmpty(_oauthConsumerKey)) { return(new Uri(OAuthClient.CreateOAuthUrl(_apiServiceUri, _oauthConsumerKey, _oauthConsumerKeySecret, _accessToken, _accessTokenSecret, mode: mode, parameters: parameters))); } else { parameters.Add("api_key", _apiKey ?? ""); List <string> keys = parameters.Select(p => $"{p.Key}={p.Value}").ToList(); return(new Uri($"{_apiServiceUri}?{string.Join("&", keys)}")); } }
private Uri BuildApiUri(string path, string mode = "GET", Dictionary <string, string> parameters = null) { return(new Uri(OAuthClient.CreateOAuthUrl(ApiServiceUri + path + ".json", ConsumerKey, ConsumerToken, AccessToken, AccessTokenSecret, mode: mode, parameters: parameters))); }