diff --git a/Sources/MeiliSearch/Model/TasksResults.swift b/Sources/MeiliSearch/Model/TasksResults.swift index aaca9ecc..a8e3f31a 100644 --- a/Sources/MeiliSearch/Model/TasksResults.swift +++ b/Sources/MeiliSearch/Model/TasksResults.swift @@ -13,4 +13,6 @@ public struct TasksResults: Codable, Equatable { public let from: Int? /// Max number of records to be returned in one request. public let limit: Int + /// The total number of tasks. + public let total: Int } diff --git a/Tests/MeiliSearchIntegrationTests/TaskTests.swift b/Tests/MeiliSearchIntegrationTests/TaskTests.swift index e108a145..70b7c9ba 100644 --- a/Tests/MeiliSearchIntegrationTests/TaskTests.swift +++ b/Tests/MeiliSearchIntegrationTests/TaskTests.swift @@ -75,6 +75,7 @@ class TasksTests: XCTestCase { case .success(let tasks): // Only one because index has been deleted and recreated XCTAssertEqual(tasks.results.count, 1) + XCTAssertEqual(tasks.total, 1) expectation.fulfill() case .failure(let error): dump(error) diff --git a/Tests/MeiliSearchUnitTests/IndexesTests.swift b/Tests/MeiliSearchUnitTests/IndexesTests.swift index c32c1f4b..07ea3877 100755 --- a/Tests/MeiliSearchUnitTests/IndexesTests.swift +++ b/Tests/MeiliSearchUnitTests/IndexesTests.swift @@ -240,7 +240,8 @@ class IndexesTests: XCTestCase { "results": [], "limit": 20, "from": 5, - "next": 98 + "next": 98, + "total": 4 } """ diff --git a/Tests/MeiliSearchUnitTests/TasksTests.swift b/Tests/MeiliSearchUnitTests/TasksTests.swift index d45df6f3..be36b7b4 100644 --- a/Tests/MeiliSearchUnitTests/TasksTests.swift +++ b/Tests/MeiliSearchUnitTests/TasksTests.swift @@ -20,7 +20,8 @@ class TasksTests: XCTestCase { "results": [], "limit": 20, "from": 5, - "next": 98 + "next": 98, + "total": 4 } """