Example #1
0
        public static TvShowDto FromQueryResponse(this TvShowDto dto, GetTvShowsWatchedResponse.Item response)
        {
            if (response == null)
            {
                return(dto);
            }

            return(new TvShowDto
            {
                Id = response.show.ids.trakt,
                IdTmdb = response.show.ids.tmdb,
                Title = response.show.title,
                Year = response.show.year,
                Language = response.show.language,
                Seasons = response.seasons.Select(obj => new SeasonDto().FromQueryResponse(obj)).ToList(),
            });
        }
Example #2
0
 public async Task <PutWatchedResponse> PutTvShowWatchedAsync(TvShowDto tvShow)
 {
     return(await _httpService.PostAsync <PutWatchedResponse>($"sync/history", new PutWatchedBody
     {
         movies = new PutWatchedBody.Movie[0],
         episodes = new PutWatchedBody.Episode[0],
         shows = new PutWatchedBody.Show[1]
         {
             new PutWatchedBody.Show
             {
                 title = tvShow.Title,
                 year = tvShow.Year.Value,
                 ids = new PutWatchedBody.ShowIds
                 {
                     trakt = tvShow.Id,
                 }
             }
         }
     }));
 }
Example #3
0
        public async Task <List <TranslationDto> > GetTvShowTranslationsAsync(TvShowDto tvShow, string language = null)
        {
            var responseObject = await _httpService.GetAsync <GetTvShowTranslationsResponse.Item[]>($"shows/{tvShow.Id}/translations/{language ?? string.Empty}");

            return(responseObject.Select(obj => new TranslationDto().FromQueryResponse(obj)).OrderBy(obj => obj.Title).ToList());
        }