github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/label/label_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package label 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 label client 19 type API interface { 20 /* 21 CreateLabel posts creates a label 22 23 This endpoint let user creates a label. 24 */ 25 CreateLabel(ctx context.Context, params *CreateLabelParams) (*CreateLabelCreated, error) 26 /* 27 DeleteLabel deletes the label specified by ID 28 29 Delete the label specified by ID. 30 */ 31 DeleteLabel(ctx context.Context, params *DeleteLabelParams) (*DeleteLabelOK, error) 32 /* 33 GetLabelByID gets the label specified by ID 34 35 This endpoint let user get the label by specific ID. 36 */ 37 GetLabelByID(ctx context.Context, params *GetLabelByIDParams) (*GetLabelByIDOK, error) 38 /* 39 ListLabels lists labels according to the query strings 40 41 This endpoint let user list labels by name, scope and project_id 42 */ 43 ListLabels(ctx context.Context, params *ListLabelsParams) (*ListLabelsOK, error) 44 /* 45 UpdateLabel updates the label properties 46 47 This endpoint let user update label properties. 48 */ 49 UpdateLabel(ctx context.Context, params *UpdateLabelParams) (*UpdateLabelOK, error) 50 } 51 52 // New creates a new label API client. 53 func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client { 54 return &Client{ 55 transport: transport, 56 formats: formats, 57 authInfo: authInfo, 58 } 59 } 60 61 /* 62 Client for label API 63 */ 64 type Client struct { 65 transport runtime.ClientTransport 66 formats strfmt.Registry 67 authInfo runtime.ClientAuthInfoWriter 68 } 69 70 /* 71 CreateLabel posts creates a label 72 73 This endpoint let user creates a label. 74 */ 75 func (a *Client) CreateLabel(ctx context.Context, params *CreateLabelParams) (*CreateLabelCreated, error) { 76 77 result, err := a.transport.Submit(&runtime.ClientOperation{ 78 ID: "CreateLabel", 79 Method: "POST", 80 PathPattern: "/labels", 81 ProducesMediaTypes: []string{"application/json"}, 82 ConsumesMediaTypes: []string{"application/json"}, 83 Schemes: []string{"http", "https"}, 84 Params: params, 85 Reader: &CreateLabelReader{formats: a.formats}, 86 AuthInfo: a.authInfo, 87 Context: ctx, 88 Client: params.HTTPClient, 89 }) 90 if err != nil { 91 return nil, err 92 } 93 return result.(*CreateLabelCreated), nil 94 95 } 96 97 /* 98 DeleteLabel deletes the label specified by ID 99 100 Delete the label specified by ID. 101 */ 102 func (a *Client) DeleteLabel(ctx context.Context, params *DeleteLabelParams) (*DeleteLabelOK, error) { 103 104 result, err := a.transport.Submit(&runtime.ClientOperation{ 105 ID: "DeleteLabel", 106 Method: "DELETE", 107 PathPattern: "/labels/{label_id}", 108 ProducesMediaTypes: []string{"application/json"}, 109 ConsumesMediaTypes: []string{"application/json"}, 110 Schemes: []string{"http", "https"}, 111 Params: params, 112 Reader: &DeleteLabelReader{formats: a.formats}, 113 AuthInfo: a.authInfo, 114 Context: ctx, 115 Client: params.HTTPClient, 116 }) 117 if err != nil { 118 return nil, err 119 } 120 return result.(*DeleteLabelOK), nil 121 122 } 123 124 /* 125 GetLabelByID gets the label specified by ID 126 127 This endpoint let user get the label by specific ID. 128 */ 129 func (a *Client) GetLabelByID(ctx context.Context, params *GetLabelByIDParams) (*GetLabelByIDOK, error) { 130 131 result, err := a.transport.Submit(&runtime.ClientOperation{ 132 ID: "GetLabelByID", 133 Method: "GET", 134 PathPattern: "/labels/{label_id}", 135 ProducesMediaTypes: []string{"application/json"}, 136 ConsumesMediaTypes: []string{"application/json"}, 137 Schemes: []string{"http", "https"}, 138 Params: params, 139 Reader: &GetLabelByIDReader{formats: a.formats}, 140 AuthInfo: a.authInfo, 141 Context: ctx, 142 Client: params.HTTPClient, 143 }) 144 if err != nil { 145 return nil, err 146 } 147 return result.(*GetLabelByIDOK), nil 148 149 } 150 151 /* 152 ListLabels lists labels according to the query strings 153 154 This endpoint let user list labels by name, scope and project_id 155 */ 156 func (a *Client) ListLabels(ctx context.Context, params *ListLabelsParams) (*ListLabelsOK, error) { 157 158 result, err := a.transport.Submit(&runtime.ClientOperation{ 159 ID: "ListLabels", 160 Method: "GET", 161 PathPattern: "/labels", 162 ProducesMediaTypes: []string{"application/json"}, 163 ConsumesMediaTypes: []string{"application/json"}, 164 Schemes: []string{"http", "https"}, 165 Params: params, 166 Reader: &ListLabelsReader{formats: a.formats}, 167 AuthInfo: a.authInfo, 168 Context: ctx, 169 Client: params.HTTPClient, 170 }) 171 if err != nil { 172 return nil, err 173 } 174 return result.(*ListLabelsOK), nil 175 176 } 177 178 /* 179 UpdateLabel updates the label properties 180 181 This endpoint let user update label properties. 182 */ 183 func (a *Client) UpdateLabel(ctx context.Context, params *UpdateLabelParams) (*UpdateLabelOK, error) { 184 185 result, err := a.transport.Submit(&runtime.ClientOperation{ 186 ID: "UpdateLabel", 187 Method: "PUT", 188 PathPattern: "/labels/{label_id}", 189 ProducesMediaTypes: []string{"application/json"}, 190 ConsumesMediaTypes: []string{"application/json"}, 191 Schemes: []string{"http", "https"}, 192 Params: params, 193 Reader: &UpdateLabelReader{formats: a.formats}, 194 AuthInfo: a.authInfo, 195 Context: ctx, 196 Client: params.HTTPClient, 197 }) 198 if err != nil { 199 return nil, err 200 } 201 return result.(*UpdateLabelOK), nil 202 203 }