Skip to content

Commit

Permalink
GH-502 GH-501: Add parameter TraktExtendedInfo in `TraktEpisodesMod…
Browse files Browse the repository at this point in the history
…ule.GetEpisodeListsAsync()`
  • Loading branch information
henrikfroehling committed Jul 7, 2023
1 parent 904da08 commit 26979f7
Show file tree
Hide file tree
Showing 4 changed files with 522 additions and 68 deletions.
6 changes: 6 additions & 0 deletions Source/Lib/Trakt.NET/Modules/TraktEpisodesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ public Task<TraktPagedResponse<ITraktComment>> GetEpisodeCommentsAsync(string sh
/// <param name="episodeNumber">The number of the episode, for which the lists should be queried.</param>
/// <param name="listType">The type of lists, that should be queried. Defaults to personal lists.</param>
/// <param name="listSortOrder">The list sort order. See also <seealso cref="TraktListSortOrder" />. Defaults to sorted by popularity.</param>
/// <param name="extendedInfo">
/// The extended info, which determines how much data about the list items should be queried.
/// See also <seealso cref="TraktExtendedInfo" />.
/// </param>
/// <param name="pagedParameters">Specifies pagination parameters. <see cref="TraktPagedParameters" />.</param>
/// <param name="cancellationToken">
/// Propagates notification that the request should be canceled.<para/>
Expand All @@ -208,6 +212,7 @@ public Task<TraktPagedResponse<ITraktComment>> GetEpisodeCommentsAsync(string sh
/// <exception cref="TraktRequestValidationException">Thrown, if validation of request data fails.</exception>
public Task<TraktPagedResponse<ITraktList>> GetEpisodeListsAsync(string showIdOrSlug, uint seasonNumber, uint episodeNumber,
TraktListType listType = null, TraktListSortOrder listSortOrder = null,
TraktExtendedInfo extendedInfo = null,
TraktPagedParameters pagedParameters = null,
CancellationToken cancellationToken = default)
{
Expand All @@ -218,6 +223,7 @@ public Task<TraktPagedResponse<ITraktList>> GetEpisodeListsAsync(string showIdOr
EpisodeNumber = episodeNumber,
Type = listType,
SortOrder = listSortOrder,
ExtendedInfo = extendedInfo,
Page = pagedParameters?.Page,
Limit = pagedParameters?.Limit
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Enums;
using Interfaces;
using Objects.Get.Lists;
using Parameters;
using System.Collections.Generic;

internal sealed class EpisodeListsRequest : AEpisodeRequest<ITraktList>, ISupportsPagination
Expand All @@ -11,11 +12,13 @@ internal sealed class EpisodeListsRequest : AEpisodeRequest<ITraktList>, ISuppor

internal TraktListSortOrder SortOrder { get; set; }

internal TraktExtendedInfo ExtendedInfo { get; set; }

public uint? Page { get; set; }

public uint? Limit { get; set; }

public override string UriTemplate => "shows/{id}/seasons/{season}/episodes/{episode}/lists{/type}{/sort_order}{?page,limit}";
public override string UriTemplate => "shows/{id}/seasons/{season}/episodes/{episode}/lists{/type}{/sort_order}{?extended,page,limit}";

public override IDictionary<string, object> GetUriPathParameters()
{
Expand All @@ -29,6 +32,9 @@ public override IDictionary<string, object> GetUriPathParameters()
if (isTypeSetAndValid && SortOrder != null && SortOrder != TraktListSortOrder.Unspecified)
uriParams.Add("sort_order", SortOrder.UriName);

if (ExtendedInfo != null && ExtendedInfo.HasAnySet)
uriParams.Add("extended", ExtendedInfo.ToString());

if (Page.HasValue)
uriParams.Add("page", Page.Value.ToString());

Expand Down
Loading

0 comments on commit 26979f7

Please sign in to comment.