github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/icon/icon_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package icon
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/go-openapi/runtime"
    12  
    13  	strfmt "github.com/go-openapi/strfmt"
    14  )
    15  
    16  //go:generate mockery -name API -inpkg
    17  
    18  // API is the interface of the icon client
    19  type API interface {
    20  	/*
    21  	   GetIcon gets artifact icon
    22  
    23  	   Get the artifact icon with the specified digest. As the original icon image is resized and encoded before returning, the parameter "digest" in the path doesn't match the hash of the returned content*/
    24  	GetIcon(ctx context.Context, params *GetIconParams) (*GetIconOK, error)
    25  }
    26  
    27  // New creates a new icon API client.
    28  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    29  	return &Client{
    30  		transport: transport,
    31  		formats:   formats,
    32  		authInfo:  authInfo,
    33  	}
    34  }
    35  
    36  /*
    37  Client for icon API
    38  */
    39  type Client struct {
    40  	transport runtime.ClientTransport
    41  	formats   strfmt.Registry
    42  	authInfo  runtime.ClientAuthInfoWriter
    43  }
    44  
    45  /*
    46  GetIcon gets artifact icon
    47  
    48  Get the artifact icon with the specified digest. As the original icon image is resized and encoded before returning, the parameter "digest" in the path doesn't match the hash of the returned content
    49  */
    50  func (a *Client) GetIcon(ctx context.Context, params *GetIconParams) (*GetIconOK, error) {
    51  
    52  	result, err := a.transport.Submit(&runtime.ClientOperation{
    53  		ID:                 "getIcon",
    54  		Method:             "GET",
    55  		PathPattern:        "/icons/{digest}",
    56  		ProducesMediaTypes: []string{"application/json"},
    57  		ConsumesMediaTypes: []string{"application/json"},
    58  		Schemes:            []string{"http", "https"},
    59  		Params:             params,
    60  		Reader:             &GetIconReader{formats: a.formats},
    61  		AuthInfo:           a.authInfo,
    62  		Context:            ctx,
    63  		Client:             params.HTTPClient,
    64  	})
    65  	if err != nil {
    66  		return nil, err
    67  	}
    68  	return result.(*GetIconOK), nil
    69  
    70  }