github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/webhook/webhook_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package webhook 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 webhook client 19 type API interface { 20 /* 21 CreateWebhookPolicyOfProject creates project webhook policy 22 23 This endpoint create a webhook policy if the project does not have one. 24 */ 25 CreateWebhookPolicyOfProject(ctx context.Context, params *CreateWebhookPolicyOfProjectParams) (*CreateWebhookPolicyOfProjectCreated, error) 26 /* 27 DeleteWebhookPolicyOfProject deletes webhook policy of a project 28 29 This endpoint is aimed to delete webhookpolicy of a project. 30 */ 31 DeleteWebhookPolicyOfProject(ctx context.Context, params *DeleteWebhookPolicyOfProjectParams) (*DeleteWebhookPolicyOfProjectOK, error) 32 /* 33 GetLogsOfWebhookTask gets logs for a specific webhook task 34 35 This endpoint returns the logs of a specific webhook task. 36 */ 37 GetLogsOfWebhookTask(ctx context.Context, params *GetLogsOfWebhookTaskParams) (*GetLogsOfWebhookTaskOK, error) 38 /* 39 GetSupportedEventTypes gets supported event types and notify types 40 41 Get supported event types and notify types.*/ 42 GetSupportedEventTypes(ctx context.Context, params *GetSupportedEventTypesParams) (*GetSupportedEventTypesOK, error) 43 /* 44 GetWebhookPolicyOfProject gets project webhook policy 45 46 This endpoint returns specified webhook policy of a project. 47 */ 48 GetWebhookPolicyOfProject(ctx context.Context, params *GetWebhookPolicyOfProjectParams) (*GetWebhookPolicyOfProjectOK, error) 49 /* 50 LastTrigger gets project webhook policy last trigger info 51 52 This endpoint returns last trigger information of project webhook policy. 53 */ 54 LastTrigger(ctx context.Context, params *LastTriggerParams) (*LastTriggerOK, error) 55 /* 56 ListExecutionsOfWebhookPolicy lists executions for a specific webhook policy 57 58 This endpoint returns the executions of a specific webhook policy. 59 */ 60 ListExecutionsOfWebhookPolicy(ctx context.Context, params *ListExecutionsOfWebhookPolicyParams) (*ListExecutionsOfWebhookPolicyOK, error) 61 /* 62 ListTasksOfWebhookExecution lists tasks for a specific webhook execution 63 64 This endpoint returns the tasks of a specific webhook execution. 65 */ 66 ListTasksOfWebhookExecution(ctx context.Context, params *ListTasksOfWebhookExecutionParams) (*ListTasksOfWebhookExecutionOK, error) 67 /* 68 ListWebhookPoliciesOfProject lists project webhook policies 69 70 This endpoint returns webhook policies of a project. 71 */ 72 ListWebhookPoliciesOfProject(ctx context.Context, params *ListWebhookPoliciesOfProjectParams) (*ListWebhookPoliciesOfProjectOK, error) 73 /* 74 UpdateWebhookPolicyOfProject updates webhook policy of a project 75 76 This endpoint is aimed to update the webhook policy of a project. 77 */ 78 UpdateWebhookPolicyOfProject(ctx context.Context, params *UpdateWebhookPolicyOfProjectParams) (*UpdateWebhookPolicyOfProjectOK, error) 79 } 80 81 // New creates a new webhook API client. 82 func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client { 83 return &Client{ 84 transport: transport, 85 formats: formats, 86 authInfo: authInfo, 87 } 88 } 89 90 /* 91 Client for webhook API 92 */ 93 type Client struct { 94 transport runtime.ClientTransport 95 formats strfmt.Registry 96 authInfo runtime.ClientAuthInfoWriter 97 } 98 99 /* 100 CreateWebhookPolicyOfProject creates project webhook policy 101 102 This endpoint create a webhook policy if the project does not have one. 103 */ 104 func (a *Client) CreateWebhookPolicyOfProject(ctx context.Context, params *CreateWebhookPolicyOfProjectParams) (*CreateWebhookPolicyOfProjectCreated, error) { 105 106 result, err := a.transport.Submit(&runtime.ClientOperation{ 107 ID: "CreateWebhookPolicyOfProject", 108 Method: "POST", 109 PathPattern: "/projects/{project_name_or_id}/webhook/policies", 110 ProducesMediaTypes: []string{"application/json"}, 111 ConsumesMediaTypes: []string{"application/json"}, 112 Schemes: []string{"http", "https"}, 113 Params: params, 114 Reader: &CreateWebhookPolicyOfProjectReader{formats: a.formats}, 115 AuthInfo: a.authInfo, 116 Context: ctx, 117 Client: params.HTTPClient, 118 }) 119 if err != nil { 120 return nil, err 121 } 122 return result.(*CreateWebhookPolicyOfProjectCreated), nil 123 124 } 125 126 /* 127 DeleteWebhookPolicyOfProject deletes webhook policy of a project 128 129 This endpoint is aimed to delete webhookpolicy of a project. 130 */ 131 func (a *Client) DeleteWebhookPolicyOfProject(ctx context.Context, params *DeleteWebhookPolicyOfProjectParams) (*DeleteWebhookPolicyOfProjectOK, error) { 132 133 result, err := a.transport.Submit(&runtime.ClientOperation{ 134 ID: "DeleteWebhookPolicyOfProject", 135 Method: "DELETE", 136 PathPattern: "/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}", 137 ProducesMediaTypes: []string{"application/json"}, 138 ConsumesMediaTypes: []string{"application/json"}, 139 Schemes: []string{"http", "https"}, 140 Params: params, 141 Reader: &DeleteWebhookPolicyOfProjectReader{formats: a.formats}, 142 AuthInfo: a.authInfo, 143 Context: ctx, 144 Client: params.HTTPClient, 145 }) 146 if err != nil { 147 return nil, err 148 } 149 return result.(*DeleteWebhookPolicyOfProjectOK), nil 150 151 } 152 153 /* 154 GetLogsOfWebhookTask gets logs for a specific webhook task 155 156 This endpoint returns the logs of a specific webhook task. 157 */ 158 func (a *Client) GetLogsOfWebhookTask(ctx context.Context, params *GetLogsOfWebhookTaskParams) (*GetLogsOfWebhookTaskOK, error) { 159 160 result, err := a.transport.Submit(&runtime.ClientOperation{ 161 ID: "GetLogsOfWebhookTask", 162 Method: "GET", 163 PathPattern: "/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}/executions/{execution_id}/tasks/{task_id}/log", 164 ProducesMediaTypes: []string{"text/plain"}, 165 ConsumesMediaTypes: []string{"application/json"}, 166 Schemes: []string{"http", "https"}, 167 Params: params, 168 Reader: &GetLogsOfWebhookTaskReader{formats: a.formats}, 169 AuthInfo: a.authInfo, 170 Context: ctx, 171 Client: params.HTTPClient, 172 }) 173 if err != nil { 174 return nil, err 175 } 176 return result.(*GetLogsOfWebhookTaskOK), nil 177 178 } 179 180 /* 181 GetSupportedEventTypes gets supported event types and notify types 182 183 Get supported event types and notify types. 184 */ 185 func (a *Client) GetSupportedEventTypes(ctx context.Context, params *GetSupportedEventTypesParams) (*GetSupportedEventTypesOK, error) { 186 187 result, err := a.transport.Submit(&runtime.ClientOperation{ 188 ID: "GetSupportedEventTypes", 189 Method: "GET", 190 PathPattern: "/projects/{project_name_or_id}/webhook/events", 191 ProducesMediaTypes: []string{"application/json"}, 192 ConsumesMediaTypes: []string{"application/json"}, 193 Schemes: []string{"http", "https"}, 194 Params: params, 195 Reader: &GetSupportedEventTypesReader{formats: a.formats}, 196 AuthInfo: a.authInfo, 197 Context: ctx, 198 Client: params.HTTPClient, 199 }) 200 if err != nil { 201 return nil, err 202 } 203 return result.(*GetSupportedEventTypesOK), nil 204 205 } 206 207 /* 208 GetWebhookPolicyOfProject gets project webhook policy 209 210 This endpoint returns specified webhook policy of a project. 211 */ 212 func (a *Client) GetWebhookPolicyOfProject(ctx context.Context, params *GetWebhookPolicyOfProjectParams) (*GetWebhookPolicyOfProjectOK, error) { 213 214 result, err := a.transport.Submit(&runtime.ClientOperation{ 215 ID: "GetWebhookPolicyOfProject", 216 Method: "GET", 217 PathPattern: "/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}", 218 ProducesMediaTypes: []string{"application/json"}, 219 ConsumesMediaTypes: []string{"application/json"}, 220 Schemes: []string{"http", "https"}, 221 Params: params, 222 Reader: &GetWebhookPolicyOfProjectReader{formats: a.formats}, 223 AuthInfo: a.authInfo, 224 Context: ctx, 225 Client: params.HTTPClient, 226 }) 227 if err != nil { 228 return nil, err 229 } 230 return result.(*GetWebhookPolicyOfProjectOK), nil 231 232 } 233 234 /* 235 LastTrigger gets project webhook policy last trigger info 236 237 This endpoint returns last trigger information of project webhook policy. 238 */ 239 func (a *Client) LastTrigger(ctx context.Context, params *LastTriggerParams) (*LastTriggerOK, error) { 240 241 result, err := a.transport.Submit(&runtime.ClientOperation{ 242 ID: "LastTrigger", 243 Method: "GET", 244 PathPattern: "/projects/{project_name_or_id}/webhook/lasttrigger", 245 ProducesMediaTypes: []string{"application/json"}, 246 ConsumesMediaTypes: []string{"application/json"}, 247 Schemes: []string{"http", "https"}, 248 Params: params, 249 Reader: &LastTriggerReader{formats: a.formats}, 250 AuthInfo: a.authInfo, 251 Context: ctx, 252 Client: params.HTTPClient, 253 }) 254 if err != nil { 255 return nil, err 256 } 257 return result.(*LastTriggerOK), nil 258 259 } 260 261 /* 262 ListExecutionsOfWebhookPolicy lists executions for a specific webhook policy 263 264 This endpoint returns the executions of a specific webhook policy. 265 */ 266 func (a *Client) ListExecutionsOfWebhookPolicy(ctx context.Context, params *ListExecutionsOfWebhookPolicyParams) (*ListExecutionsOfWebhookPolicyOK, error) { 267 268 result, err := a.transport.Submit(&runtime.ClientOperation{ 269 ID: "ListExecutionsOfWebhookPolicy", 270 Method: "GET", 271 PathPattern: "/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}/executions", 272 ProducesMediaTypes: []string{"application/json"}, 273 ConsumesMediaTypes: []string{"application/json"}, 274 Schemes: []string{"http", "https"}, 275 Params: params, 276 Reader: &ListExecutionsOfWebhookPolicyReader{formats: a.formats}, 277 AuthInfo: a.authInfo, 278 Context: ctx, 279 Client: params.HTTPClient, 280 }) 281 if err != nil { 282 return nil, err 283 } 284 return result.(*ListExecutionsOfWebhookPolicyOK), nil 285 286 } 287 288 /* 289 ListTasksOfWebhookExecution lists tasks for a specific webhook execution 290 291 This endpoint returns the tasks of a specific webhook execution. 292 */ 293 func (a *Client) ListTasksOfWebhookExecution(ctx context.Context, params *ListTasksOfWebhookExecutionParams) (*ListTasksOfWebhookExecutionOK, error) { 294 295 result, err := a.transport.Submit(&runtime.ClientOperation{ 296 ID: "ListTasksOfWebhookExecution", 297 Method: "GET", 298 PathPattern: "/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}/executions/{execution_id}/tasks", 299 ProducesMediaTypes: []string{"application/json"}, 300 ConsumesMediaTypes: []string{"application/json"}, 301 Schemes: []string{"http", "https"}, 302 Params: params, 303 Reader: &ListTasksOfWebhookExecutionReader{formats: a.formats}, 304 AuthInfo: a.authInfo, 305 Context: ctx, 306 Client: params.HTTPClient, 307 }) 308 if err != nil { 309 return nil, err 310 } 311 return result.(*ListTasksOfWebhookExecutionOK), nil 312 313 } 314 315 /* 316 ListWebhookPoliciesOfProject lists project webhook policies 317 318 This endpoint returns webhook policies of a project. 319 */ 320 func (a *Client) ListWebhookPoliciesOfProject(ctx context.Context, params *ListWebhookPoliciesOfProjectParams) (*ListWebhookPoliciesOfProjectOK, error) { 321 322 result, err := a.transport.Submit(&runtime.ClientOperation{ 323 ID: "ListWebhookPoliciesOfProject", 324 Method: "GET", 325 PathPattern: "/projects/{project_name_or_id}/webhook/policies", 326 ProducesMediaTypes: []string{"application/json"}, 327 ConsumesMediaTypes: []string{"application/json"}, 328 Schemes: []string{"http", "https"}, 329 Params: params, 330 Reader: &ListWebhookPoliciesOfProjectReader{formats: a.formats}, 331 AuthInfo: a.authInfo, 332 Context: ctx, 333 Client: params.HTTPClient, 334 }) 335 if err != nil { 336 return nil, err 337 } 338 return result.(*ListWebhookPoliciesOfProjectOK), nil 339 340 } 341 342 /* 343 UpdateWebhookPolicyOfProject updates webhook policy of a project 344 345 This endpoint is aimed to update the webhook policy of a project. 346 */ 347 func (a *Client) UpdateWebhookPolicyOfProject(ctx context.Context, params *UpdateWebhookPolicyOfProjectParams) (*UpdateWebhookPolicyOfProjectOK, error) { 348 349 result, err := a.transport.Submit(&runtime.ClientOperation{ 350 ID: "UpdateWebhookPolicyOfProject", 351 Method: "PUT", 352 PathPattern: "/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}", 353 ProducesMediaTypes: []string{"application/json"}, 354 ConsumesMediaTypes: []string{"application/json"}, 355 Schemes: []string{"http", "https"}, 356 Params: params, 357 Reader: &UpdateWebhookPolicyOfProjectReader{formats: a.formats}, 358 AuthInfo: a.authInfo, 359 Context: ctx, 360 Client: params.HTTPClient, 361 }) 362 if err != nil { 363 return nil, err 364 } 365 return result.(*UpdateWebhookPolicyOfProjectOK), nil 366 367 }