Skip to content

[FEATURE] Make all response structs their own type #585

Description

@Jakob3xD

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions