Beispiel #1
0
        private void Initialize(string baseUrl, bool useSsl, string apiKey)
        {
            if (String.IsNullOrWhiteSpace(baseUrl))
            {
                throw new ArgumentException("baseUrl");
            }

            if (String.IsNullOrWhiteSpace(apiKey))
            {
                throw new ArgumentException("apiKey");
            }

            ApiKey = apiKey;

            // Cleanup the provided url so that we don't get any issues when we are configuring the client
            if (baseUrl.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase))
            {
                baseUrl = baseUrl.Substring("http://".Length);
            }
            else if (baseUrl.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase))
            {
                baseUrl = baseUrl.Substring("https://".Length);
            }

            string httpScheme = useSsl ? "https" : "http";

            _client = new TMDbRestClient(String.Format("{0}://{1}/{2}/", httpScheme, baseUrl, ApiVersion));
            _client.AddDefaultParameter("api_key", apiKey, ParameterType.QueryString);

            _client.ClearHandlers();
            _client.AddHandler("application/json", new JsonDeserializer());
        }
Beispiel #2
0
        private void Initialize(string baseUrl, bool useSsl, string apiKey)
        {
            ApiKey = apiKey;

            string httpScheme = useSsl ? "https" : "http";

            _client = new TMDbRestClient(String.Format("{0}://{1}/{2}/", httpScheme, baseUrl, ApiVersion));
            _client.AddDefaultParameter("api_key", apiKey);

            _client.ClearHandlers();
            _client.AddHandler("application/json", new JsonDeserializer());
        }
Beispiel #3
0
        private void Initialize(string baseUrl, bool useSsl, string apiKey)
        {
            if (String.IsNullOrWhiteSpace(baseUrl))
                throw new ArgumentException("baseUrl");

            if (String.IsNullOrWhiteSpace(apiKey))
                throw new ArgumentException("apiKey");

            ApiKey = apiKey;

            // Cleanup the provided url so that we don't get any issues when we are configuring the client
            if (baseUrl.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase))
                baseUrl = baseUrl.Substring("http://".Length);
            else if (baseUrl.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase))
                baseUrl = baseUrl.Substring("https://".Length);

            string httpScheme = useSsl ? "https" : "http";
            _client = new TMDbRestClient(String.Format("{0}://{1}/{2}/", httpScheme, baseUrl, ApiVersion));
            _client.AddDefaultParameter("api_key", apiKey, ParameterType.QueryString);

            _client.ClearHandlers();
            _client.AddHandler("application/json", new JsonDeserializer());
        }
Beispiel #4
0
        private void Initialize(string baseUrl, bool useSsl, string apiKey)
        {
            ApiKey = apiKey;

            string httpScheme = useSsl ? "https" : "http";
            _client = new TMDbRestClient(String.Format("{0}://{1}/{2}/", httpScheme, baseUrl, ApiVersion));
            _client.AddDefaultParameter("api_key", apiKey, ParameterType.QueryString);

            _client.ClearHandlers();
            _client.AddHandler("application/json", new JsonDeserializer());
        }