Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ public sealed class HelldiversSyncConfiguration
/// Get the maximum number of entries returned by ArrowHead from the newsfeed API.
/// </summary>
public uint NewsFeedMaxEntries { get; set; } = 1024;



/// <summary>
/// Get all News Feed Entries that where published after THIS timestamp
/// </summary>
public uint NewsFeedFromTimestamp { get; set; } = 1000;
}
6 changes: 4 additions & 2 deletions src/Helldivers-2-Sync/Services/ArrowHeadApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ public async Task<Memory<byte>> GetWarStatus(string season, string language, Can
public async Task<Memory<byte>> LoadFeed(string season, string language, CancellationToken cancellationToken)
{
// If the `NewsFeedMaxEntries` flag is not set to 0 we pass it in.

// fromTimestamp is in options.Value. This parameter is needed or else a 400 error will be reached.
var request = options.Value.NewsFeedMaxEntries is 0
? BuildRequest($"/api/NewsFeed/{season}", language)
: BuildRequest($"/api/NewsFeed/{season}?maxEntries=${options.Value.NewsFeedMaxEntries}", language);
? BuildRequest($"/api/NewsFeed/{season}?fromTimestamp=${options.Value.NewsFeedFromTimestamp}", language)
: BuildRequest($"/api/NewsFeed/{season}?maxEntries=${options.Value.NewsFeedMaxEntries}&fromTimestamp=${options.Value.NewsFeedFromTimestamp}", language);

using var response = await http.SendAsync(request, cancellationToken);

Expand Down
Loading