Skip to content

Commit

Permalink
opensearchapi: Update comments for point in time apis
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Hahn <jakob.hahn@hetzner.com>
  • Loading branch information
Jakob3xD committed Mar 24, 2023
1 parent a92d115 commit f334868
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions opensearchapi/api._.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ type Tasks struct {
List TasksList
}

// PointInTime contains the Point In Time APIs
type PointInTime struct {
Create PointInTimeCreate
Delete PointInTimeDelete
Expand Down
7 changes: 4 additions & 3 deletions opensearchapi/api.pointintime.create.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func newPointInTimeCreateFunc(t Transport) PointInTimeCreate {

// ----- API Definition -------------------------------------------------------

// Point In Time ets you run different queries against a dataset that is fixed in time.
// PointInTimeCreate let you create a pit for searching with pagination
type PointInTimeCreate func(o ...func(*PointInTimeCreateRequest)) (*Response, *PointInTimeCreateResp, error)

// PointInTimeRequest configures the Point In Time API request.
// PointInTimeCreateRequest configures the Point In Time Create API request.
type PointInTimeCreateRequest struct {
Index []string

Expand All @@ -69,6 +69,7 @@ type PointInTimeCreateRequest struct {
ctx context.Context
}

// PointInTimeCreateResp is a custom type to parse the Point In Time Create Reponse
type PointInTimeCreateResp struct {
PitID string `json:"pit_id"`
Shards struct {
Expand All @@ -80,7 +81,7 @@ type PointInTimeCreateResp struct {
CreationTime int `json:"creation_time"`
}

// Do executes the request and returns response or error.
// Do executes the request and returns response, PointInTimeCreateResp and error.
func (r PointInTimeCreateRequest) Do(ctx context.Context, transport Transport) (*Response, *PointInTimeCreateResp, error) {
var (
path strings.Builder
Expand Down
6 changes: 4 additions & 2 deletions opensearchapi/api.pointintime.delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ func newPointInTimeDeleteFunc(t Transport) PointInTimeDelete {

// ----- API Definition -------------------------------------------------------

// Point In Time ets you run different queries against a dataset that is fixed in time.
// PointInTimeDelete lets you delete pits used for searching with pagination
type PointInTimeDelete func(o ...func(*PointInTimeDeleteRequest)) (*Response, *PointInTimeDeleteResp, error)

// PointInTimeRequest configures the Point In Time API request.
// PointInTimeDeleteRequest configures the Point In Time Delete API request.
type PointInTimeDeleteRequest struct {
PitID []string

Expand All @@ -64,10 +64,12 @@ type PointInTimeDeleteRequest struct {
ctx context.Context
}

// PointInTimeDeleteRequestBody is used to from the delete request body
type PointInTimeDeleteRequestBody struct {
PitID []string `json:"pit_id"`
}

// PointInTimeDeleteResp is a custom type to parse the Point In Time Delete Reponse
type PointInTimeDeleteResp struct {
Pits []struct {
PitID string `json:"pit_id"`
Expand Down
5 changes: 3 additions & 2 deletions opensearchapi/api.pointintime.get.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func newPointInTimeGetFunc(t Transport) PointInTimeGet {

// ----- API Definition -------------------------------------------------------

// Point In Time ets you run different queries against a dataset that is fixed in time.
// PointInTimeGet lets you get all existing pits
type PointInTimeGet func(o ...func(*PointInTimeGetRequest)) (*Response, *PointInTimeGetResp, error)

// PointInTimeRequest configures the Point In Time API request.
// PointInTimeGetRequest configures the Point In Time Get API request.
type PointInTimeGetRequest struct {
Pretty bool
Human bool
Expand All @@ -61,6 +61,7 @@ type PointInTimeGetRequest struct {
ctx context.Context
}

// PointInTimeGetResp is a custom type to parse the Point In Time Get Reponse
type PointInTimeGetResp struct {
Pits []struct {
PitID string `json:"pit_id"`
Expand Down

0 comments on commit f334868

Please sign in to comment.