Skip to content

Commit

Permalink
Fix vod pagination #62
Browse files Browse the repository at this point in the history
  • Loading branch information
laurencee committed Jan 1, 2021
1 parent 26ea5dc commit 30b2f56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("2.13.1.0")]
[assembly: AssemblyFileVersion("2.13.1.0")]
[assembly: AssemblyVersion("2.13.2.0")]
[assembly: AssemblyFileVersion("2.13.2.0")]
3 changes: 2 additions & 1 deletion Livestream.Monitor/Model/ApiClients/TwitchApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ public async Task<List<VodDetails>> GetVods(VodQuery vodQuery)
{
StreamId = vodQuery.StreamId,
Skip = vodQuery.Skip + vodQuery.Take,
Take = vodQuery.Take
Take = vodQuery.Take,
VodTypes = vodQuery.VodTypes
};
vodsPaginationKeyMap[nextPageKeyLookup] = videosRoot.Pagination.Cursor;
var vods = videosRoot.Videos.Select(video =>
Expand Down
13 changes: 10 additions & 3 deletions Livestream.Monitor/Model/ApiClients/VodQuery.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ExternalAPIs;

namespace Livestream.Monitor.Model.ApiClients
Expand All @@ -26,13 +27,13 @@ public string StreamId
/// <summary>
/// Arbitrary filtering for vod types. The available types are defined in the <see cref="IApiClient.VodTypes"/> property
/// </summary>
public List<string> VodTypes { get; } = new List<string>();
public List<string> VodTypes { get; set; } = new List<string>();

public bool Equals(VodQuery other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return base.Equals(other) && streamId == other.streamId && Equals(VodTypes, other.VodTypes);
return base.Equals(other) && streamId == other.streamId && VodTypes.SequenceEqual(other.VodTypes);
}

public override bool Equals(object obj)
Expand All @@ -49,7 +50,13 @@ public override int GetHashCode()
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (streamId != null ? streamId.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (VodTypes != null ? VodTypes.GetHashCode() : 0);
if (VodTypes != null)
{
foreach (var vodType in VodTypes)
{
hashCode = (hashCode * 397) ^ (vodType != null ? vodType.GetHashCode() : 0);
}
}
return hashCode;
}
}
Expand Down

0 comments on commit 30b2f56

Please sign in to comment.