Skip to content

Commit

Permalink
Merge #328
Browse files Browse the repository at this point in the history
328: Add pagination settings r=alallema a=GoryMoon

# Pull Request

## What does this PR do?
Fixes #325
<!-- Please link the issue you're trying to fix with this PR, if none then please create an issue first. -->

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue?
- [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: GoryMoon <gurreja@gmail.com>
  • Loading branch information
bors[bot] and GoryMoon authored Jul 25, 2022
2 parents 6a849cb + 483a901 commit 9236b8f
Show file tree
Hide file tree
Showing 5 changed files with 507 additions and 103 deletions.
49 changes: 49 additions & 0 deletions index_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,52 @@ func (i Index) ResetTypoTolerance() (resp *TaskInfo, err error) {
}
return resp, nil
}

func (i Index) GetPagination() (resp *Pagination, err error) {
resp = &Pagination{}
req := internalRequest{
endpoint: "/indexes/" + i.UID + "/settings/pagination",
method: http.MethodGet,
withRequest: nil,
withResponse: resp,
acceptedStatusCodes: []int{http.StatusOK},
functionName: "GetPagination",
}
if err := i.client.executeRequest(req); err != nil {
return nil, err
}
return resp, nil
}

func (i Index) UpdatePagination(request *Pagination) (resp *TaskInfo, err error) {
resp = &TaskInfo{}
req := internalRequest{
endpoint: "/indexes/" + i.UID + "/settings/pagination",
method: http.MethodPatch,
contentType: contentTypeJSON,
withRequest: &request,
withResponse: resp,
acceptedStatusCodes: []int{http.StatusAccepted},
functionName: "UpdatePagination",
}
if err := i.client.executeRequest(req); err != nil {
return nil, err
}
return resp, nil
}

func (i Index) ResetPagination() (resp *TaskInfo, err error) {
resp = &TaskInfo{}
req := internalRequest{
endpoint: "/indexes/" + i.UID + "/settings/pagination",
method: http.MethodDelete,
withRequest: nil,
withResponse: resp,
acceptedStatusCodes: []int{http.StatusAccepted},
functionName: "ResetPagination",
}
if err := i.client.executeRequest(req); err != nil {
return nil, err
}
return resp, nil
}
Loading

0 comments on commit 9236b8f

Please sign in to comment.