public TmdbApiService(string apiKey, string accessToken, string sessionId = null) { _apiKey = apiKey; _accessToken = accessToken; _sessionId = sessionId; var headers = new Dictionary <string, string>(); headers.Add("Authorization", $"Bearer {_accessToken}"); _httpService = new HttpService("https://api.themoviedb.org/3/", ExchangeFormat.Json, headers); _httpService.AddCallbackForHttpStatusCode(HttpStatusCode.Unauthorized, AuthenticateAsync); }
public TraktApiService(string apiKey, string clientId, string clientSecret, string userName, string accessToken = null, string refreshToken = null) { _apiKey = apiKey; _clientId = clientId; _clientSecret = clientSecret; _userName = userName; _accessToken = accessToken; _refreshToken = refreshToken; var headers = new Dictionary <string, string>(); headers.Add("trakt-api-version", "2"); headers.Add("trakt-api-key", _apiKey); if (_accessToken != null) { headers.Add("Authorization", $"Bearer {_accessToken}"); } _httpService = new HttpService("https://api.trakt.tv/", ExchangeFormat.Json, headers); _httpService.AddCallbackForHttpStatusCode(HttpStatusCode.Unauthorized, AuthenticateAsync); _httpService.AddCallbackForHttpStatusCode(HttpStatusCode.InternalServerError, AuthenticateAsync); }
public PlexApiService(string url, string userName, string password, string accessToken = null) { _userName = userName; _password = password; _accessToken = accessToken; var headers = new Dictionary <string, string>(); if (_accessToken != null) { headers.Add("X-Plex-Token", $"Bearer {_accessToken}"); } _httpService = new HttpService(url, ExchangeFormat.Xml, headers); _httpService.AddCallbackForHttpStatusCode(HttpStatusCode.Unauthorized, AuthenticateAsync); }
public TransmissionApiService(string url) { _httpService = new HttpService(url, ExchangeFormat.Json); _httpService.AddCallbackForHttpStatusCode(HttpStatusCode.Conflict, AuthenticateAsync); }