diff --git a/index_task.go b/index_task.go index a5f6c85..3627bce 100644 --- a/index_task.go +++ b/index_task.go @@ -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 diff --git a/index_task_test.go b/index_task_test.go index 0b5ed24..fad2ec5 100644 --- a/index_task_test.go +++ b/index_task_test.go @@ -153,6 +153,7 @@ func TestIndex_GetTasks(t *testing.T) { From: 0, Statuses: []TaskStatus{TaskStatusSucceeded}, Types: []TaskType{TaskTypeDocumentAdditionOrUpdate}, + Reverse: true, }, }, }, diff --git a/types.go b/types.go index fd52c4e..fa2000f 100644 --- a/types.go +++ b/types.go @@ -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 diff --git a/types_easyjson.go b/types_easyjson.go index f881d52..277264d 100644 --- a/types_easyjson.go +++ b/types_easyjson.go @@ -844,6 +844,8 @@ func easyjson6601e8cdDecodeGithubComMeilisearchMeilisearchGo6(in *jlexer.Lexer, if data := in.Raw(); in.Ok() { in.AddError((out.AfterFinishedAt).UnmarshalJSON(data)) } + case "Reverse": + out.Reverse = bool(in.Bool()) default: in.SkipRecursive() } @@ -978,6 +980,11 @@ func easyjson6601e8cdEncodeGithubComMeilisearchMeilisearchGo6(out *jwriter.Write out.RawString(prefix) out.Raw((in.AfterFinishedAt).MarshalJSON()) } + { + const prefix string = ",\"Reverse\":" + out.RawString(prefix) + out.Bool(bool(in.Reverse)) + } out.RawByte('}') }