Skip to content

Commit

Permalink
Merge #588
Browse files Browse the repository at this point in the history
588: Accept :reverse param on client.tasks endpoint r=brunoocasali a=ellnix

# Pull Request

## Related issue
Fixes #581



Co-authored-by: ellnix <[email protected]>
  • Loading branch information
meili-bors[bot] and ellnix authored Jan 8, 2025
2 parents 54ae665 + df1141c commit ed33dfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/meilisearch/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Task < HTTPRequest
ALLOWED_PARAMS = [
:limit, :from, :index_uids, :types, :statuses, :uids, :canceled_by,
:before_enqueued_at, :after_enqueued_at, :before_started_at, :after_started_at,
:before_finished_at, :after_finished_at
:before_finished_at, :after_finished_at, :reverse
].freeze
ALLOWED_CANCELATION_PARAMS = (ALLOWED_PARAMS - [:limit, :from]).freeze

Expand Down
7 changes: 7 additions & 0 deletions spec/meilisearch/client/tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
expect(last_task.keys).to include(*succeeded_task_keys)
end

it 'allows for returning tasks in reverse' do
tasks = client.tasks
rev_tasks = client.tasks(reverse: true)

expect(tasks['results']).not_to eq(rev_tasks['results'])
end

it 'gets a task of the Meilisearch instance' do
task = client.task(0)

Expand Down

0 comments on commit ed33dfd

Please sign in to comment.