client: Move opts to separate files

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-02-14 14:45:08 +01:00
parent b9319f64ed
commit 903ba2f487
8 changed files with 143 additions and 119 deletions

View File

@@ -10,16 +10,6 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
// ImageHistoryOption is a type representing functional options for the image history operation.
type ImageHistoryOption interface {
Apply(*imageHistoryOpts) error
}
type imageHistoryOptionFunc func(opt *imageHistoryOpts) error
func (f imageHistoryOptionFunc) Apply(o *imageHistoryOpts) error {
return f(o)
}
// ImageHistoryWithPlatform sets the platform for the image history operation.
func ImageHistoryWithPlatform(platform ocispec.Platform) ImageHistoryOption {
return imageHistoryOptionFunc(func(opt *imageHistoryOpts) error {
@@ -31,10 +21,6 @@ func ImageHistoryWithPlatform(platform ocispec.Platform) ImageHistoryOption {
})
}
type imageHistoryOpts struct {
apiOptions image.HistoryOptions
}
// ImageHistory returns the changes in an image in history format.
func (cli *Client) ImageHistory(ctx context.Context, imageID string, historyOpts ...ImageHistoryOption) ([]image.HistoryResponseItem, error) {
query := url.Values{}