github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/projects/projects_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package projects 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 "fmt" 10 11 "github.com/go-openapi/runtime" 12 "github.com/go-openapi/strfmt" 13 ) 14 15 // New creates a new projects API client. 16 func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { 17 return &Client{transport: transport, formats: formats} 18 } 19 20 /* 21 Client for projects API 22 */ 23 type Client struct { 24 transport runtime.ClientTransport 25 formats strfmt.Registry 26 } 27 28 // ClientOption is the option for Client methods 29 type ClientOption func(*runtime.ClientOperation) 30 31 // ClientService is the interface for Client methods 32 type ClientService interface { 33 AddBranch(params *AddBranchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddBranchOK, error) 34 35 AddProject(params *AddProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddProjectOK, error) 36 37 DeleteProject(params *DeleteProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteProjectOK, error) 38 39 EditProject(params *EditProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EditProjectOK, error) 40 41 ForkProject(params *ForkProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ForkProjectOK, error) 42 43 GetProject(params *GetProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProjectOK, error) 44 45 GetProjectByID(params *GetProjectByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProjectByIDOK, error) 46 47 ListProjects(params *ListProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectsOK, error) 48 49 MoveProject(params *MoveProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MoveProjectOK, error) 50 51 SetTransport(transport runtime.ClientTransport) 52 } 53 54 /* 55 AddBranch adds branch 56 57 Add a branch on the specified project 58 */ 59 func (a *Client) AddBranch(params *AddBranchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddBranchOK, error) { 60 // TODO: Validate the params before sending 61 if params == nil { 62 params = NewAddBranchParams() 63 } 64 op := &runtime.ClientOperation{ 65 ID: "addBranch", 66 Method: "POST", 67 PathPattern: "/projects/{projectID}/branches", 68 ProducesMediaTypes: []string{"application/json"}, 69 ConsumesMediaTypes: []string{"application/json"}, 70 Schemes: []string{"http", "https"}, 71 Params: params, 72 Reader: &AddBranchReader{formats: a.formats}, 73 AuthInfo: authInfo, 74 Context: params.Context, 75 Client: params.HTTPClient, 76 } 77 for _, opt := range opts { 78 opt(op) 79 } 80 81 result, err := a.transport.Submit(op) 82 if err != nil { 83 return nil, err 84 } 85 success, ok := result.(*AddBranchOK) 86 if ok { 87 return success, nil 88 } 89 // unexpected success response 90 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 91 msg := fmt.Sprintf("unexpected success response for addBranch: API contract not enforced by server. Client expected to get an error, but got: %T", result) 92 panic(msg) 93 } 94 95 /* 96 AddProject creates a project 97 98 Add a new project to an organization 99 */ 100 func (a *Client) AddProject(params *AddProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddProjectOK, error) { 101 // TODO: Validate the params before sending 102 if params == nil { 103 params = NewAddProjectParams() 104 } 105 op := &runtime.ClientOperation{ 106 ID: "addProject", 107 Method: "POST", 108 PathPattern: "/organizations/{organizationName}/projects", 109 ProducesMediaTypes: []string{"application/json"}, 110 ConsumesMediaTypes: []string{"application/json"}, 111 Schemes: []string{"http", "https"}, 112 Params: params, 113 Reader: &AddProjectReader{formats: a.formats}, 114 AuthInfo: authInfo, 115 Context: params.Context, 116 Client: params.HTTPClient, 117 } 118 for _, opt := range opts { 119 opt(op) 120 } 121 122 result, err := a.transport.Submit(op) 123 if err != nil { 124 return nil, err 125 } 126 success, ok := result.(*AddProjectOK) 127 if ok { 128 return success, nil 129 } 130 // unexpected success response 131 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 132 msg := fmt.Sprintf("unexpected success response for addProject: API contract not enforced by server. Client expected to get an error, but got: %T", result) 133 panic(msg) 134 } 135 136 /* 137 DeleteProject deletes a project 138 139 Delete a Project 140 */ 141 func (a *Client) DeleteProject(params *DeleteProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteProjectOK, error) { 142 // TODO: Validate the params before sending 143 if params == nil { 144 params = NewDeleteProjectParams() 145 } 146 op := &runtime.ClientOperation{ 147 ID: "deleteProject", 148 Method: "DELETE", 149 PathPattern: "/organizations/{organizationName}/projects/{projectName}", 150 ProducesMediaTypes: []string{"application/json"}, 151 ConsumesMediaTypes: []string{"application/json"}, 152 Schemes: []string{"http", "https"}, 153 Params: params, 154 Reader: &DeleteProjectReader{formats: a.formats}, 155 AuthInfo: authInfo, 156 Context: params.Context, 157 Client: params.HTTPClient, 158 } 159 for _, opt := range opts { 160 opt(op) 161 } 162 163 result, err := a.transport.Submit(op) 164 if err != nil { 165 return nil, err 166 } 167 success, ok := result.(*DeleteProjectOK) 168 if ok { 169 return success, nil 170 } 171 // unexpected success response 172 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 173 msg := fmt.Sprintf("unexpected success response for deleteProject: API contract not enforced by server. Client expected to get an error, but got: %T", result) 174 panic(msg) 175 } 176 177 /* 178 EditProject edits a project 179 180 Edit a project 181 */ 182 func (a *Client) EditProject(params *EditProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EditProjectOK, error) { 183 // TODO: Validate the params before sending 184 if params == nil { 185 params = NewEditProjectParams() 186 } 187 op := &runtime.ClientOperation{ 188 ID: "editProject", 189 Method: "POST", 190 PathPattern: "/organizations/{organizationName}/projects/{projectName}", 191 ProducesMediaTypes: []string{"application/json"}, 192 ConsumesMediaTypes: []string{"application/json"}, 193 Schemes: []string{"http", "https"}, 194 Params: params, 195 Reader: &EditProjectReader{formats: a.formats}, 196 AuthInfo: authInfo, 197 Context: params.Context, 198 Client: params.HTTPClient, 199 } 200 for _, opt := range opts { 201 opt(op) 202 } 203 204 result, err := a.transport.Submit(op) 205 if err != nil { 206 return nil, err 207 } 208 success, ok := result.(*EditProjectOK) 209 if ok { 210 return success, nil 211 } 212 // unexpected success response 213 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 214 msg := fmt.Sprintf("unexpected success response for editProject: API contract not enforced by server. Client expected to get an error, but got: %T", result) 215 panic(msg) 216 } 217 218 /* 219 ForkProject forks a project 220 221 Fork a project 222 */ 223 func (a *Client) ForkProject(params *ForkProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ForkProjectOK, error) { 224 // TODO: Validate the params before sending 225 if params == nil { 226 params = NewForkProjectParams() 227 } 228 op := &runtime.ClientOperation{ 229 ID: "forkProject", 230 Method: "POST", 231 PathPattern: "/organizations/{organizationName}/projects/{projectName}/fork", 232 ProducesMediaTypes: []string{"application/json"}, 233 ConsumesMediaTypes: []string{"application/json"}, 234 Schemes: []string{"http", "https"}, 235 Params: params, 236 Reader: &ForkProjectReader{formats: a.formats}, 237 AuthInfo: authInfo, 238 Context: params.Context, 239 Client: params.HTTPClient, 240 } 241 for _, opt := range opts { 242 opt(op) 243 } 244 245 result, err := a.transport.Submit(op) 246 if err != nil { 247 return nil, err 248 } 249 success, ok := result.(*ForkProjectOK) 250 if ok { 251 return success, nil 252 } 253 // unexpected success response 254 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 255 msg := fmt.Sprintf("unexpected success response for forkProject: API contract not enforced by server. Client expected to get an error, but got: %T", result) 256 panic(msg) 257 } 258 259 /* 260 GetProject organizations project info 261 262 Get project details 263 */ 264 func (a *Client) GetProject(params *GetProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProjectOK, error) { 265 // TODO: Validate the params before sending 266 if params == nil { 267 params = NewGetProjectParams() 268 } 269 op := &runtime.ClientOperation{ 270 ID: "getProject", 271 Method: "GET", 272 PathPattern: "/organizations/{organizationName}/projects/{projectName}", 273 ProducesMediaTypes: []string{"application/json"}, 274 ConsumesMediaTypes: []string{"application/json"}, 275 Schemes: []string{"http", "https"}, 276 Params: params, 277 Reader: &GetProjectReader{formats: a.formats}, 278 AuthInfo: authInfo, 279 Context: params.Context, 280 Client: params.HTTPClient, 281 } 282 for _, opt := range opts { 283 opt(op) 284 } 285 286 result, err := a.transport.Submit(op) 287 if err != nil { 288 return nil, err 289 } 290 success, ok := result.(*GetProjectOK) 291 if ok { 292 return success, nil 293 } 294 // unexpected success response 295 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 296 msg := fmt.Sprintf("unexpected success response for getProject: API contract not enforced by server. Client expected to get an error, but got: %T", result) 297 panic(msg) 298 } 299 300 /* 301 GetProjectByID projects info 302 303 Get project details by ID 304 */ 305 func (a *Client) GetProjectByID(params *GetProjectByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProjectByIDOK, error) { 306 // TODO: Validate the params before sending 307 if params == nil { 308 params = NewGetProjectByIDParams() 309 } 310 op := &runtime.ClientOperation{ 311 ID: "getProjectByID", 312 Method: "GET", 313 PathPattern: "/projects/{projectID}", 314 ProducesMediaTypes: []string{"application/json"}, 315 ConsumesMediaTypes: []string{"application/json"}, 316 Schemes: []string{"http", "https"}, 317 Params: params, 318 Reader: &GetProjectByIDReader{formats: a.formats}, 319 AuthInfo: authInfo, 320 Context: params.Context, 321 Client: params.HTTPClient, 322 } 323 for _, opt := range opts { 324 opt(op) 325 } 326 327 result, err := a.transport.Submit(op) 328 if err != nil { 329 return nil, err 330 } 331 success, ok := result.(*GetProjectByIDOK) 332 if ok { 333 return success, nil 334 } 335 // unexpected success response 336 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 337 msg := fmt.Sprintf("unexpected success response for getProjectByID: API contract not enforced by server. Client expected to get an error, but got: %T", result) 338 panic(msg) 339 } 340 341 /* 342 ListProjects organizations projects 343 344 Return a list of projects for an organization 345 */ 346 func (a *Client) ListProjects(params *ListProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectsOK, error) { 347 // TODO: Validate the params before sending 348 if params == nil { 349 params = NewListProjectsParams() 350 } 351 op := &runtime.ClientOperation{ 352 ID: "listProjects", 353 Method: "GET", 354 PathPattern: "/organizations/{organizationName}/projects", 355 ProducesMediaTypes: []string{"application/json"}, 356 ConsumesMediaTypes: []string{"application/json"}, 357 Schemes: []string{"http", "https"}, 358 Params: params, 359 Reader: &ListProjectsReader{formats: a.formats}, 360 AuthInfo: authInfo, 361 Context: params.Context, 362 Client: params.HTTPClient, 363 } 364 for _, opt := range opts { 365 opt(op) 366 } 367 368 result, err := a.transport.Submit(op) 369 if err != nil { 370 return nil, err 371 } 372 success, ok := result.(*ListProjectsOK) 373 if ok { 374 return success, nil 375 } 376 // unexpected success response 377 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 378 msg := fmt.Sprintf("unexpected success response for listProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result) 379 panic(msg) 380 } 381 382 /* 383 MoveProject moves a project to a different organization 384 385 Move a project to a different organization 386 */ 387 func (a *Client) MoveProject(params *MoveProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MoveProjectOK, error) { 388 // TODO: Validate the params before sending 389 if params == nil { 390 params = NewMoveProjectParams() 391 } 392 op := &runtime.ClientOperation{ 393 ID: "moveProject", 394 Method: "POST", 395 PathPattern: "/organizations/{organizationIdentifier}/projects/{projectName}/move", 396 ProducesMediaTypes: []string{"application/json"}, 397 ConsumesMediaTypes: []string{"application/json"}, 398 Schemes: []string{"http", "https"}, 399 Params: params, 400 Reader: &MoveProjectReader{formats: a.formats}, 401 AuthInfo: authInfo, 402 Context: params.Context, 403 Client: params.HTTPClient, 404 } 405 for _, opt := range opts { 406 opt(op) 407 } 408 409 result, err := a.transport.Submit(op) 410 if err != nil { 411 return nil, err 412 } 413 success, ok := result.(*MoveProjectOK) 414 if ok { 415 return success, nil 416 } 417 // unexpected success response 418 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 419 msg := fmt.Sprintf("unexpected success response for moveProject: API contract not enforced by server. Client expected to get an error, but got: %T", result) 420 panic(msg) 421 } 422 423 // SetTransport changes the transport on the client 424 func (a *Client) SetTransport(transport runtime.ClientTransport) { 425 a.transport = transport 426 }