opensearch-go
opensearch-go copied to clipboard
[FEATURE] Make all response structs their own type
Is your feature request related to a problem?
For example the SnapshotGetResp struct has a field named Snapshots which is an array of struct. I want to write a functions that uses this struct, but it can't be used as it is not its own type. So it can't be referenced in the function arguments. https://github.com/opensearch-project/opensearch-go/blob/main/opensearchapi/api_snapshot-get.go#L43
What solution would you like?
All structs inside Resp types should become their own type.
What alternatives have you considered?
Otherwise I need to redefine the struct on my end instead of using the lib.
Do you have any additional context?
resp, _ := client.Snapshot.Get(ctx, opensearchapi.SnapshotGetReq{xyz})
for _, snapshot := range resp.Snapshots {
err := someFunction(snapshot)
if err != nil {
return err
}
}
func someFunction(???) error {
return nil
}