Skip to content

Commit

Permalink
Merge #603
Browse files Browse the repository at this point in the history
603: GetTasks: allow for reverse param r=curquiza a=cosmastech

# Pull Request

## Related issue
Fixes #596

## What does this PR do?
- Allow passing "reverse" to the get tasks endpoint.

## 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: Luke Kuzmish <[email protected]>
  • Loading branch information
meili-bors[bot] and cosmastech authored Feb 5, 2025
2 parents 55d3119 + 25cd056 commit 40ea18f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (i *index) GetTasksWithContext(ctx context.Context, param *TasksQuery) (*Ta
} else {
req.withQueryParams["indexUids"] = i.uid
}

if param.Reverse {
req.withQueryParams["reverse"] = "true"
}
}
if err := i.client.executeRequest(ctx, req); err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions index_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func TestIndex_GetTasks(t *testing.T) {
From: 1,
Statuses: []TaskStatus{TaskStatusSucceeded},
Types: []TaskType{TaskTypeDocumentAdditionOrUpdate},
Reverse: true,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ type TasksQuery struct {
AfterStartedAt time.Time
BeforeFinishedAt time.Time
AfterFinishedAt time.Time
Reverse bool
}

// CancelTasksQuery is a list of filter available to send as query parameters
Expand Down
7 changes: 7 additions & 0 deletions types_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 40ea18f

Please sign in to comment.