Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page metadata use is not appropriate #2478

Open
SammyOina opened this issue Oct 19, 2024 · 0 comments
Open

Page metadata use is not appropriate #2478

SammyOina opened this issue Oct 19, 2024 · 0 comments

Comments

@SammyOina
Copy link
Contributor

type PageMetadata struct {
Total uint64 `json:"total"`
Offset uint64 `json:"offset"`
Limit uint64 `json:"limit"`
Order string `json:"order,omitempty"`
Direction string `json:"direction,omitempty"`
Level uint64 `json:"level,omitempty"`
Identity string `json:"identity,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
Status string `json:"status,omitempty"`
Action string `json:"action,omitempty"`
Subject string `json:"subject,omitempty"`
Object string `json:"object,omitempty"`
Permission string `json:"permission,omitempty"`
Tag string `json:"tag,omitempty"`
Owner string `json:"owner,omitempty"`
SharedBy string `json:"shared_by,omitempty"`
Visibility string `json:"visibility,omitempty"`
OwnerID string `json:"owner_id,omitempty"`
Topic string `json:"topic,omitempty"`
Contact string `json:"contact,omitempty"`
State string `json:"state,omitempty"`
ListPermissions string `json:"list_perms,omitempty"`
InvitedBy string `json:"invited_by,omitempty"`
UserID string `json:"user_id,omitempty"`
DomainID string `json:"domain_id,omitempty"`
Relation string `json:"relation,omitempty"`
Operation string `json:"operation,omitempty"`
From int64 `json:"from,omitempty"`
To int64 `json:"to,omitempty"`
WithMetadata bool `json:"with_metadata,omitempty"`
WithAttributes bool `json:"with_attributes,omitempty"`
ID string `json:"id,omitempty"`
}

Page metadata is used by many methods on SDK interface, however, this can be confusing as struct members are selectively used by different methods. Struct members passed to a method should be options that will be used in that method.

A good example of how this should be done is:
https://github.com/moby/moby/blob/b0632b23457112c87b28be1850a17bfb7f9a9eac/client/image_create.go#L17
https://github.com/moby/moby/blob/b0632b23457112c87b28be1850a17bfb7f9a9eac/client/image_list.go#L19

Different methods have different options that apply to each method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant