/// <summary>
        /// Initializes instance according to parameter values.
        /// </summary>
        /// <param name="apiKey">Key to get access to TMDb service.</param>
        /// <param name="maxRetryCount">Maximum retry number to get response from TMDb.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="apiKey" /> is <c>null</c>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="apiKey" /> presents empty string or contains only whitespaces.
        /// </exception>
        public TmdbCrawlerAsync(string apiKey, int maxRetryCount)
        {
            apiKey.ThrowIfNullOrWhiteSpace(nameof(apiKey));

            _tmdbClient    = TmdbClientFactory.CreateClient(apiKey, maxRetryCount);
            _searchResults = new HashSet <BasicInfo>();
        }
示例#2
0
 public TmdbMovieSearchService(
     ITmdbClient client,
     GenreProvider genreProvider,
     KeywordProvider keywordProvider,
     MovieProvider movieProvider)
 {
     _Client          = client;
     _GenreProvider   = genreProvider;
     _KeywordProvider = keywordProvider;
     _MovieProvider   = movieProvider;
 }
        public GenresService(IMoviesRepository moviesRepository, ITmdbClient client, IGenresMapper mapper)
        {
            if (moviesRepository == null)
            {
                throw new ArgumentNullException(nameof(moviesRepository));
            }

            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }

            _moviesRepository = moviesRepository;
            _client           = client;
            _mapper           = mapper;
            _moviesRepository = moviesRepository;
        }
示例#4
0
        public MoviesService(IMoviesRepository moviesRepository,
                             IOmdbClient omdbClient,
                             ITmdbClient tmdbClient,
                             IMoviesMapper moviesMapper,
                             IMoviesRequestsCache requestsCache)
        {
            if (moviesRepository == null)
            {
                throw new ArgumentNullException(nameof(moviesRepository));
            }

            if (omdbClient == null)
            {
                throw new ArgumentNullException(nameof(omdbClient));
            }

            if (tmdbClient == null)
            {
                throw new ArgumentNullException(nameof(tmdbClient));
            }

            if (moviesMapper == null)
            {
                throw new ArgumentNullException(nameof(moviesMapper));
            }

            if (requestsCache == null)
            {
                throw new ArgumentNullException(nameof(requestsCache));
            }

            _moviesRepository = moviesRepository;
            _omdbClient       = omdbClient;
            _tmdbClient       = tmdbClient;
            _moviesMapper     = moviesMapper;
            _requestsCache    = requestsCache;
        }
示例#5
0
 public TmdbMoviesService(ITmdbClient tmdbClient)
 {
     _tmdbClient = tmdbClient;
 }
示例#6
0
 public TmdbService(ITmdbClient client, IMapper mapper, ImdbContext context)
 {
     this.client  = client ?? throw new ArgumentNullException(nameof(client));
     this.mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }
示例#7
0
 public MovieProvider(ITmdbClient client, SimpleCache <MovieSearchResultItem> cache)
 {
     _Client = client;
     _Cache  = cache;
 }
 public async Task <MovieDetailsResultItem> Execute(ITmdbClient client) =>
 await client.GetResult <MovieDetailsResultItem>(
     Url(client.Config),
     _Request);
示例#9
0
 public async Task <PagedResultList <KeywordResultItem> > Execute(ITmdbClient client) =>
 await client.GetResult <PagedResultList <KeywordResultItem> >(
     Url(client.Config),
     _Request);
示例#10
0
        /// <summary>
        /// Initializes instance according to parameter values.
        /// </summary>
        /// <param name="apiKey">Key to get access to TMDb service.</param>
        /// <param name="maxRetryCount">Maximum retry number to get response from TMDb.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="apiKey" /> is <c>null</c>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="apiKey" /> presents empty string or contains only whitespaces.
        /// </exception>
        public TmdbCrawler(string apiKey, int maxRetryCount)
        {
            apiKey.ThrowIfNullOrWhiteSpace(nameof(apiKey));

            _tmdbClient = TmdbClientFactory.CreateClient(apiKey, maxRetryCount);
        }
示例#11
0
 public KeywordProvider(ITmdbClient client, SimpleCache <KeywordResultItem> cache)
 {
     _Client = client;
     _Cache  = cache;
 }
示例#12
0
 public GenreProvider(ITmdbClient client, SimpleCache <GenreResultList.GenreEntry> cache)
 {
     _Client      = client;
     _Cache       = cache;
     _Initialized = false;
 }
示例#13
0
 public async Task <GenreResultList> Execute(ITmdbClient client) =>
 await client.GetResult <GenreResultList>(
     Url(client.Config),
     _Request);