Skip to content

Commit

Permalink
Added is_featured to response model and as optional query param for G…
Browse files Browse the repository at this point in the history
…etClips (#375)
  • Loading branch information
Syzuna authored Oct 30, 2023
1 parent 23542e2 commit 13db111
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions TwitchLib.Api.Helix.Models/Clips/GetClips/Clip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,11 @@ public class Clip
/// </summary>
[JsonProperty(PropertyName = "vod_offset")]
public int VodOffset { get; protected set; }

/// <summary>
/// A Boolean value that indicates if the clip is featured or not.
/// </summary>
[JsonProperty(PropertyName = "is_featured")]
public bool IsFeatured { get; protected set; }
}
}
9 changes: 8 additions & 1 deletion TwitchLib.Api.Helix/Clips.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ public Clips(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler h
/// Ending date/time for returned clips, in RFC3339 format. (Note that the seconds value is ignored.)
/// <para>If this is specified, started_at also must be specified; otherwise, the time period is ignored.</para>
/// </param>
/// <param name="isFeatured">
/// A Boolean value that determines whether the response includes featured clips.
/// <para>If true, returns only clips that are featured. If false, returns only clips that aren’t featured. All clips are returned if this parameter is not present.</para>
/// </param>
/// <param name="first">Maximum number of objects to return. Maximum: 100. Default: 20.</param>
/// <param name="accessToken">optional access token to override the use of the stored one in the TwitchAPI instance</param>
/// <returns cref="GetClipsResponse"></returns>
/// <exception cref="BadParameterException"></exception>
public Task<GetClipsResponse> GetClipsAsync(List<string> clipIds = null, string gameId = null, string broadcasterId = null, string before = null, string after = null, DateTime? startedAt = null, DateTime? endedAt = null, int first = 20, string accessToken = null)
public Task<GetClipsResponse> GetClipsAsync(List<string> clipIds = null, string gameId = null, string broadcasterId = null, string before = null, string after = null, DateTime? startedAt = null, DateTime? endedAt = null, bool? isFeatured = null, int first = 20, string accessToken = null)
{
if (first < 0 || first > 100)
throw new BadParameterException("'first' must between 0 (inclusive) and 100 (inclusive).");
Expand Down Expand Up @@ -91,6 +95,9 @@ public Task<GetClipsResponse> GetClipsAsync(List<string> clipIds = null, string

if (!string.IsNullOrWhiteSpace(after))
getParams.Add(new KeyValuePair<string, string>("after", after));

if (isFeatured.HasValue)
getParams.Add(new KeyValuePair<string, string>("is_featured", isFeatured.Value.ToString()));

getParams.Add(new KeyValuePair<string, string>("first", first.ToString()));

Expand Down

0 comments on commit 13db111

Please sign in to comment.