示例#1
0
 public static JObject JsonHttpGetRequest(string url, Dictionary <string, string> parameters, TvDbTokenProvider authToken, bool retry) =>
 JsonHttpGetRequest(url, parameters, authToken, string.Empty, retry);
示例#2
0
        public static JObject JsonHttpGetRequest(string url, Dictionary <string, string> parameters, TvDbTokenProvider authToken, string lang, bool retry)
        {
            TimeSpan pauseBetweenFailures = TimeSpan.FromSeconds(2);
            string   fullUrl = url + GetHttpParameters(parameters);

            string response = null;

            if (retry)
            {
                RetryOnException(3, pauseBetweenFailures, fullUrl,
                                 () => { response = HttpRequest("GET", fullUrl, null, "application/json", authToken, lang); },
                                 authToken.AcquireToken);
            }
            else
            {
                response = HttpRequest("GET", fullUrl, null, "application/json", authToken, lang);
            }

            return(JObject.Parse(response));
        }
示例#3
0
 private static string HttpRequest([NotNull] string method, [NotNull] string url, string json, string contentType,
                                   [CanBeNull] TvDbTokenProvider authToken, string lang = "")
 => HttpRequest(method, url, json, contentType, authToken?.GetToken(), lang);