示例#1
0
        private void RefreshToken()
        {
            logger.Info("Refreshing TheTVDB token... ");
            JObject jsonResponse = HTTPHelper.JsonHTTPGETRequest($"{TVDB_API_URL}/refresh_token", null, lastKnownToken);

            UpdateToken((string)jsonResponse["token"]);
            logger.Info("refreshed token at " + System.DateTime.UtcNow);
            logger.Info("New Token " + lastKnownToken);
        }
示例#2
0
        private void AcquireToken()
        {
            logger.Info("Acquire a TheTVDB token... ");
            JObject request      = new JObject(new JProperty("apikey", TVDB_API_KEY));
            JObject jsonResponse = HTTPHelper.JsonHTTPPOSTRequest($"{TVDB_API_URL}/login", request);

            UpdateToken((string)jsonResponse["token"]);
            logger.Info("Performed login at " + System.DateTime.UtcNow);
            logger.Info("New Token " + lastKnownToken);
        }
示例#3
0
        public static JObject JsonHTTPGETRequest(String url, Dictionary <string, string> parameters, String authToken)
        {
            String response = HTTPHelper.HTTPRequest("GET", url + getHTTPParameters(parameters), null, "application/json", authToken);

            return(JObject.Parse(response));
        }
示例#4
0
        public static JObject JsonHTTPPOSTRequest(String url, JObject request)
        {
            String response = HTTPHelper.HTTPRequest("POST", url, request.ToString(), "application/json");

            return(JObject.Parse(response));
        }