Esempio n. 1
0
 public static JObject JsonHttpGetRequest(string url, Dictionary <string, string> parameters, TvDbTokenProvider authToken, bool retry) =>
 JsonHttpGetRequest(url, parameters, authToken, string.Empty, retry);
Esempio n. 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));
        }
Esempio n. 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);