示例#1
0
        public TvMazeClient(HttpClient httpClient, IRateLimitingStrategy rateLimitingStrategy)
        {
            if (rateLimitingStrategy == null)
            {
                rateLimitingStrategy = new ThrowExceptionRateLimitingStrategy();
            }

            var flurlClient = new FlurlClient(httpClient);

            // Caller didn't provide the base address.
            if (flurlClient.BaseUrl == null)
            {
                flurlClient.BaseUrl = BaseApiUrl;
            }

            flurlClient.AllowAnyHttpStatus();

            var tvMazeHttpClient = new TvMazeHttpClient(flurlClient, rateLimitingStrategy);

            Search   = new SearchEndpoint(tvMazeHttpClient);
            Shows    = new ShowsEndpoint(tvMazeHttpClient);
            Episodes = new EpisodesEndpoint(tvMazeHttpClient);
            Updates  = new UpdatesEndpoint(tvMazeHttpClient);
            Lookup   = new LookupEndpoint(tvMazeHttpClient);
        }
示例#2
0
        public TvMazeClient()
        {
            var httpClient = new HttpClient
            {
                BaseAddress = new Uri(BaseApiUrl)
            };

            Search   = new SearchEndpoint(httpClient);
            Shows    = new ShowsEndpoint(httpClient);
            Episodes = new EpisodesEndpoint(httpClient);
            Updates  = new UpdatesEndpoint(httpClient);
        }