Skip to content

Commit

Permalink
Merge #490
Browse files Browse the repository at this point in the history
490: Add Total tasks in task route r=brunoocasali a=kashifsoofi

# Pull Request

## Related issue
Fixes #462 

## What does this PR do?
- Added Total Tasks in task route

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: Kashif Soofi <[email protected]>
  • Loading branch information
meili-bors[bot] and kashifsoofi authored Dec 15, 2023
2 parents ffe0303 + 08c6d5f commit a5cbe1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit a5cbe1c

Please sign in to comment.