Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Total tasks in task route #490

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion src/Meilisearch/TasksResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ namespace Meilisearch
/// <typeparam name="T">Type of the Meilisearch server object. Ex: keys, indexes, ...</typeparam>
public class TasksResults<T> : Result<T>
{
public TasksResults(T results, int? limit, int? from, int? next)
public TasksResults(T results, int? limit, int? from, int? next, int? total)
: base(results, limit)
{
From = from;
Next = next;
Total = total;
}

/// <summary>
Expand All @@ -25,5 +26,10 @@ public TasksResults(T results, int? limit, int? from, int? next)
/// Gets next size.
/// </summary>
public int? Next { get; }

/// <summary>
/// Gets total number of tasks.
/// </summary>
public int? Total { get; }
}
}
1 change: 1 addition & 0 deletions tests/Meilisearch.Tests/TaskInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public async Task GetMultipleTaskInfoWithQueryParameters()
var taskResponse = await _index.GetTasksAsync(new TasksQuery { Limit = 1, IndexUids = new List<string> { _index.Uid } });

taskResponse.Results.Count().Should().BeGreaterOrEqualTo(1);
taskResponse.Total.Should().BeGreaterThan(0);
}

[Fact]
Expand Down