github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/users_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package users 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 users 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 users 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 AddEmail(params *AddEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddEmailOK, error) 34 35 AddUser(params *AddUserParams, opts ...ClientOption) (*AddUserOK, error) 36 37 DeleteEmail(params *DeleteEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteEmailOK, error) 38 39 DeleteUser(params *DeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteUserOK, error) 40 41 EditUser(params *EditUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EditUserOK, error) 42 43 GetDomainsByUser(params *GetDomainsByUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainsByUserOK, error) 44 45 GetEmailVerificationLink(params *GetEmailVerificationLinkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailVerificationLinkOK, error) 46 47 GetEmailsByUser(params *GetEmailsByUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailsByUserOK, error) 48 49 GetInvitationByCode(params *GetInvitationByCodeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvitationByCodeOK, error) 50 51 GetInvitationsByUser(params *GetInvitationsByUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvitationsByUserOK, error) 52 53 GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) 54 55 GetUserByID(params *GetUserByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserByIDOK, error) 56 57 ListInvitations(params *ListInvitationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListInvitationsOK, error) 58 59 ListUsers(params *ListUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUsersOK, error) 60 61 SearchEmails(params *SearchEmailsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchEmailsOK, error) 62 63 SearchUsernames(params *SearchUsernamesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchUsernamesOK, error) 64 65 SendEmailVerification(params *SendEmailVerificationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SendEmailVerificationOK, error) 66 67 SetPreferredEmail(params *SetPreferredEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SetPreferredEmailOK, error) 68 69 UniqueUsername(params *UniqueUsernameParams, opts ...ClientOption) (*UniqueUsernameOK, error) 70 71 VerifyEmail(params *VerifyEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*VerifyEmailOK, error) 72 73 SetTransport(transport runtime.ClientTransport) 74 } 75 76 /* 77 AddEmail creates new email for a user 78 79 Create new email 80 */ 81 func (a *Client) AddEmail(params *AddEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddEmailOK, error) { 82 // TODO: Validate the params before sending 83 if params == nil { 84 params = NewAddEmailParams() 85 } 86 op := &runtime.ClientOperation{ 87 ID: "addEmail", 88 Method: "POST", 89 PathPattern: "/users/{username}/emails", 90 ProducesMediaTypes: []string{"application/json"}, 91 ConsumesMediaTypes: []string{"application/json"}, 92 Schemes: []string{"http", "https"}, 93 Params: params, 94 Reader: &AddEmailReader{formats: a.formats}, 95 AuthInfo: authInfo, 96 Context: params.Context, 97 Client: params.HTTPClient, 98 } 99 for _, opt := range opts { 100 opt(op) 101 } 102 103 result, err := a.transport.Submit(op) 104 if err != nil { 105 return nil, err 106 } 107 success, ok := result.(*AddEmailOK) 108 if ok { 109 return success, nil 110 } 111 // unexpected success response 112 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 113 msg := fmt.Sprintf("unexpected success response for addEmail: API contract not enforced by server. Client expected to get an error, but got: %T", result) 114 panic(msg) 115 } 116 117 /* 118 AddUser creates a new user 119 120 Create a new user 121 */ 122 func (a *Client) AddUser(params *AddUserParams, opts ...ClientOption) (*AddUserOK, error) { 123 // TODO: Validate the params before sending 124 if params == nil { 125 params = NewAddUserParams() 126 } 127 op := &runtime.ClientOperation{ 128 ID: "addUser", 129 Method: "POST", 130 PathPattern: "/users", 131 ProducesMediaTypes: []string{"application/json"}, 132 ConsumesMediaTypes: []string{"application/json"}, 133 Schemes: []string{"http", "https"}, 134 Params: params, 135 Reader: &AddUserReader{formats: a.formats}, 136 Context: params.Context, 137 Client: params.HTTPClient, 138 } 139 for _, opt := range opts { 140 opt(op) 141 } 142 143 result, err := a.transport.Submit(op) 144 if err != nil { 145 return nil, err 146 } 147 success, ok := result.(*AddUserOK) 148 if ok { 149 return success, nil 150 } 151 // unexpected success response 152 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 153 msg := fmt.Sprintf("unexpected success response for addUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) 154 panic(msg) 155 } 156 157 /* 158 DeleteEmail deletes email for a user 159 160 Delete email 161 */ 162 func (a *Client) DeleteEmail(params *DeleteEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteEmailOK, error) { 163 // TODO: Validate the params before sending 164 if params == nil { 165 params = NewDeleteEmailParams() 166 } 167 op := &runtime.ClientOperation{ 168 ID: "deleteEmail", 169 Method: "DELETE", 170 PathPattern: "/users/{username}/emails", 171 ProducesMediaTypes: []string{"application/json"}, 172 ConsumesMediaTypes: []string{"application/json"}, 173 Schemes: []string{"http", "https"}, 174 Params: params, 175 Reader: &DeleteEmailReader{formats: a.formats}, 176 AuthInfo: authInfo, 177 Context: params.Context, 178 Client: params.HTTPClient, 179 } 180 for _, opt := range opts { 181 opt(op) 182 } 183 184 result, err := a.transport.Submit(op) 185 if err != nil { 186 return nil, err 187 } 188 success, ok := result.(*DeleteEmailOK) 189 if ok { 190 return success, nil 191 } 192 // unexpected success response 193 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 194 msg := fmt.Sprintf("unexpected success response for deleteEmail: API contract not enforced by server. Client expected to get an error, but got: %T", result) 195 panic(msg) 196 } 197 198 /* 199 DeleteUser deletes a user 200 201 Delete a user 202 */ 203 func (a *Client) DeleteUser(params *DeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteUserOK, error) { 204 // TODO: Validate the params before sending 205 if params == nil { 206 params = NewDeleteUserParams() 207 } 208 op := &runtime.ClientOperation{ 209 ID: "deleteUser", 210 Method: "DELETE", 211 PathPattern: "/users/{username}", 212 ProducesMediaTypes: []string{"application/json"}, 213 ConsumesMediaTypes: []string{"application/json"}, 214 Schemes: []string{"http", "https"}, 215 Params: params, 216 Reader: &DeleteUserReader{formats: a.formats}, 217 AuthInfo: authInfo, 218 Context: params.Context, 219 Client: params.HTTPClient, 220 } 221 for _, opt := range opts { 222 opt(op) 223 } 224 225 result, err := a.transport.Submit(op) 226 if err != nil { 227 return nil, err 228 } 229 success, ok := result.(*DeleteUserOK) 230 if ok { 231 return success, nil 232 } 233 // unexpected success response 234 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 235 msg := fmt.Sprintf("unexpected success response for deleteUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) 236 panic(msg) 237 } 238 239 /* 240 EditUser edits a user 241 242 Edit a user record 243 */ 244 func (a *Client) EditUser(params *EditUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EditUserOK, error) { 245 // TODO: Validate the params before sending 246 if params == nil { 247 params = NewEditUserParams() 248 } 249 op := &runtime.ClientOperation{ 250 ID: "editUser", 251 Method: "POST", 252 PathPattern: "/users/{username}", 253 ProducesMediaTypes: []string{"application/json"}, 254 ConsumesMediaTypes: []string{"application/json"}, 255 Schemes: []string{"http", "https"}, 256 Params: params, 257 Reader: &EditUserReader{formats: a.formats}, 258 AuthInfo: authInfo, 259 Context: params.Context, 260 Client: params.HTTPClient, 261 } 262 for _, opt := range opts { 263 opt(op) 264 } 265 266 result, err := a.transport.Submit(op) 267 if err != nil { 268 return nil, err 269 } 270 success, ok := result.(*EditUserOK) 271 if ok { 272 return success, nil 273 } 274 // unexpected success response 275 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 276 msg := fmt.Sprintf("unexpected success response for editUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) 277 panic(msg) 278 } 279 280 /* 281 GetDomainsByUser retrieves a user s verified domains 282 283 Return a list of domains suitable for auto-invite 284 */ 285 func (a *Client) GetDomainsByUser(params *GetDomainsByUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainsByUserOK, error) { 286 // TODO: Validate the params before sending 287 if params == nil { 288 params = NewGetDomainsByUserParams() 289 } 290 op := &runtime.ClientOperation{ 291 ID: "getDomainsByUser", 292 Method: "GET", 293 PathPattern: "/users/{username}/domains", 294 ProducesMediaTypes: []string{"application/json"}, 295 ConsumesMediaTypes: []string{"application/json"}, 296 Schemes: []string{"http", "https"}, 297 Params: params, 298 Reader: &GetDomainsByUserReader{formats: a.formats}, 299 AuthInfo: authInfo, 300 Context: params.Context, 301 Client: params.HTTPClient, 302 } 303 for _, opt := range opts { 304 opt(op) 305 } 306 307 result, err := a.transport.Submit(op) 308 if err != nil { 309 return nil, err 310 } 311 success, ok := result.(*GetDomainsByUserOK) 312 if ok { 313 return success, nil 314 } 315 // unexpected success response 316 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 317 msg := fmt.Sprintf("unexpected success response for getDomainsByUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) 318 panic(msg) 319 } 320 321 /* 322 GetEmailVerificationLink gets the verification link for the given unverified email 323 324 Returns the link needed to verify ownership of the provided email address, if it exists and is unverified. Only available to superusers. 325 */ 326 func (a *Client) GetEmailVerificationLink(params *GetEmailVerificationLinkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailVerificationLinkOK, error) { 327 // TODO: Validate the params before sending 328 if params == nil { 329 params = NewGetEmailVerificationLinkParams() 330 } 331 op := &runtime.ClientOperation{ 332 ID: "getEmailVerificationLink", 333 Method: "GET", 334 PathPattern: "/users/verification/{email}", 335 ProducesMediaTypes: []string{"application/json"}, 336 ConsumesMediaTypes: []string{"application/json"}, 337 Schemes: []string{"http", "https"}, 338 Params: params, 339 Reader: &GetEmailVerificationLinkReader{formats: a.formats}, 340 AuthInfo: authInfo, 341 Context: params.Context, 342 Client: params.HTTPClient, 343 } 344 for _, opt := range opts { 345 opt(op) 346 } 347 348 result, err := a.transport.Submit(op) 349 if err != nil { 350 return nil, err 351 } 352 success, ok := result.(*GetEmailVerificationLinkOK) 353 if ok { 354 return success, nil 355 } 356 // unexpected success response 357 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 358 msg := fmt.Sprintf("unexpected success response for getEmailVerificationLink: API contract not enforced by server. Client expected to get an error, but got: %T", result) 359 panic(msg) 360 } 361 362 /* 363 GetEmailsByUser retrieves a user s emails 364 365 Return a list of emails matching username 366 */ 367 func (a *Client) GetEmailsByUser(params *GetEmailsByUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailsByUserOK, error) { 368 // TODO: Validate the params before sending 369 if params == nil { 370 params = NewGetEmailsByUserParams() 371 } 372 op := &runtime.ClientOperation{ 373 ID: "getEmailsByUser", 374 Method: "GET", 375 PathPattern: "/users/{username}/emails", 376 ProducesMediaTypes: []string{"application/json"}, 377 ConsumesMediaTypes: []string{"application/json"}, 378 Schemes: []string{"http", "https"}, 379 Params: params, 380 Reader: &GetEmailsByUserReader{formats: a.formats}, 381 AuthInfo: authInfo, 382 Context: params.Context, 383 Client: params.HTTPClient, 384 } 385 for _, opt := range opts { 386 opt(op) 387 } 388 389 result, err := a.transport.Submit(op) 390 if err != nil { 391 return nil, err 392 } 393 success, ok := result.(*GetEmailsByUserOK) 394 if ok { 395 return success, nil 396 } 397 // unexpected success response 398 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 399 msg := fmt.Sprintf("unexpected success response for getEmailsByUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) 400 panic(msg) 401 } 402 403 /* 404 GetInvitationByCode returns the invitation with the corresponding code 405 406 Returns the invitation with the corresponding code 407 */ 408 func (a *Client) GetInvitationByCode(params *GetInvitationByCodeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvitationByCodeOK, error) { 409 // TODO: Validate the params before sending 410 if params == nil { 411 params = NewGetInvitationByCodeParams() 412 } 413 op := &runtime.ClientOperation{ 414 ID: "getInvitationByCode", 415 Method: "GET", 416 PathPattern: "/invitations/code/{code}", 417 ProducesMediaTypes: []string{"application/json"}, 418 ConsumesMediaTypes: []string{"application/json"}, 419 Schemes: []string{"http", "https"}, 420 Params: params, 421 Reader: &GetInvitationByCodeReader{formats: a.formats}, 422 AuthInfo: authInfo, 423 Context: params.Context, 424 Client: params.HTTPClient, 425 } 426 for _, opt := range opts { 427 opt(op) 428 } 429 430 result, err := a.transport.Submit(op) 431 if err != nil { 432 return nil, err 433 } 434 success, ok := result.(*GetInvitationByCodeOK) 435 if ok { 436 return success, nil 437 } 438 // unexpected success response 439 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 440 msg := fmt.Sprintf("unexpected success response for getInvitationByCode: API contract not enforced by server. Client expected to get an error, but got: %T", result) 441 panic(msg) 442 } 443 444 /* 445 GetInvitationsByUser lists of pending invitations for the logged in user 446 447 Has this user been invited to any organizations 448 */ 449 func (a *Client) GetInvitationsByUser(params *GetInvitationsByUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvitationsByUserOK, error) { 450 // TODO: Validate the params before sending 451 if params == nil { 452 params = NewGetInvitationsByUserParams() 453 } 454 op := &runtime.ClientOperation{ 455 ID: "getInvitationsByUser", 456 Method: "GET", 457 PathPattern: "/invitations", 458 ProducesMediaTypes: []string{"application/json"}, 459 ConsumesMediaTypes: []string{"application/json"}, 460 Schemes: []string{"http", "https"}, 461 Params: params, 462 Reader: &GetInvitationsByUserReader{formats: a.formats}, 463 AuthInfo: authInfo, 464 Context: params.Context, 465 Client: params.HTTPClient, 466 } 467 for _, opt := range opts { 468 opt(op) 469 } 470 471 result, err := a.transport.Submit(op) 472 if err != nil { 473 return nil, err 474 } 475 success, ok := result.(*GetInvitationsByUserOK) 476 if ok { 477 return success, nil 478 } 479 // unexpected success response 480 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 481 msg := fmt.Sprintf("unexpected success response for getInvitationsByUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) 482 panic(msg) 483 } 484 485 /* 486 GetUser retrieves a user record 487 488 Return a specific user matching username 489 */ 490 func (a *Client) GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) { 491 // TODO: Validate the params before sending 492 if params == nil { 493 params = NewGetUserParams() 494 } 495 op := &runtime.ClientOperation{ 496 ID: "getUser", 497 Method: "GET", 498 PathPattern: "/users/{username}", 499 ProducesMediaTypes: []string{"application/json"}, 500 ConsumesMediaTypes: []string{"application/json"}, 501 Schemes: []string{"http", "https"}, 502 Params: params, 503 Reader: &GetUserReader{formats: a.formats}, 504 AuthInfo: authInfo, 505 Context: params.Context, 506 Client: params.HTTPClient, 507 } 508 for _, opt := range opts { 509 opt(op) 510 } 511 512 result, err := a.transport.Submit(op) 513 if err != nil { 514 return nil, err 515 } 516 success, ok := result.(*GetUserOK) 517 if ok { 518 return success, nil 519 } 520 // unexpected success response 521 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 522 msg := fmt.Sprintf("unexpected success response for getUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) 523 panic(msg) 524 } 525 526 /* 527 GetUserByID retrieves a user record by their user ID 528 529 Return a specific user matching user ID 530 */ 531 func (a *Client) GetUserByID(params *GetUserByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserByIDOK, error) { 532 // TODO: Validate the params before sending 533 if params == nil { 534 params = NewGetUserByIDParams() 535 } 536 op := &runtime.ClientOperation{ 537 ID: "getUserByID", 538 Method: "GET", 539 PathPattern: "/users/id/{userID}", 540 ProducesMediaTypes: []string{"application/json"}, 541 ConsumesMediaTypes: []string{"application/json"}, 542 Schemes: []string{"http", "https"}, 543 Params: params, 544 Reader: &GetUserByIDReader{formats: a.formats}, 545 AuthInfo: authInfo, 546 Context: params.Context, 547 Client: params.HTTPClient, 548 } 549 for _, opt := range opts { 550 opt(op) 551 } 552 553 result, err := a.transport.Submit(op) 554 if err != nil { 555 return nil, err 556 } 557 success, ok := result.(*GetUserByIDOK) 558 if ok { 559 return success, nil 560 } 561 // unexpected success response 562 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 563 msg := fmt.Sprintf("unexpected success response for getUserByID: API contract not enforced by server. Client expected to get an error, but got: %T", result) 564 panic(msg) 565 } 566 567 /* 568 ListInvitations lists of pending invitations for an email address 569 570 Has this email address been invited to any organizations 571 */ 572 func (a *Client) ListInvitations(params *ListInvitationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListInvitationsOK, error) { 573 // TODO: Validate the params before sending 574 if params == nil { 575 params = NewListInvitationsParams() 576 } 577 op := &runtime.ClientOperation{ 578 ID: "listInvitations", 579 Method: "GET", 580 PathPattern: "/invitations/{email}", 581 ProducesMediaTypes: []string{"application/json"}, 582 ConsumesMediaTypes: []string{"application/json"}, 583 Schemes: []string{"http", "https"}, 584 Params: params, 585 Reader: &ListInvitationsReader{formats: a.formats}, 586 AuthInfo: authInfo, 587 Context: params.Context, 588 Client: params.HTTPClient, 589 } 590 for _, opt := range opts { 591 opt(op) 592 } 593 594 result, err := a.transport.Submit(op) 595 if err != nil { 596 return nil, err 597 } 598 success, ok := result.(*ListInvitationsOK) 599 if ok { 600 return success, nil 601 } 602 // unexpected success response 603 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 604 msg := fmt.Sprintf("unexpected success response for listInvitations: API contract not enforced by server. Client expected to get an error, but got: %T", result) 605 panic(msg) 606 } 607 608 /* 609 ListUsers lists of visible users 610 611 Retrieve all users from the system that the user has access to 612 */ 613 func (a *Client) ListUsers(params *ListUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUsersOK, error) { 614 // TODO: Validate the params before sending 615 if params == nil { 616 params = NewListUsersParams() 617 } 618 op := &runtime.ClientOperation{ 619 ID: "listUsers", 620 Method: "GET", 621 PathPattern: "/users", 622 ProducesMediaTypes: []string{"application/json"}, 623 ConsumesMediaTypes: []string{"application/json"}, 624 Schemes: []string{"http", "https"}, 625 Params: params, 626 Reader: &ListUsersReader{formats: a.formats}, 627 AuthInfo: authInfo, 628 Context: params.Context, 629 Client: params.HTTPClient, 630 } 631 for _, opt := range opts { 632 opt(op) 633 } 634 635 result, err := a.transport.Submit(op) 636 if err != nil { 637 return nil, err 638 } 639 success, ok := result.(*ListUsersOK) 640 if ok { 641 return success, nil 642 } 643 // unexpected success response 644 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 645 msg := fmt.Sprintf("unexpected success response for listUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result) 646 panic(msg) 647 } 648 649 /* 650 SearchEmails Search for users by email address, requires superuser 651 */ 652 func (a *Client) SearchEmails(params *SearchEmailsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchEmailsOK, error) { 653 // TODO: Validate the params before sending 654 if params == nil { 655 params = NewSearchEmailsParams() 656 } 657 op := &runtime.ClientOperation{ 658 ID: "searchEmails", 659 Method: "POST", 660 PathPattern: "/users/search_emails", 661 ProducesMediaTypes: []string{"application/json"}, 662 ConsumesMediaTypes: []string{"application/json"}, 663 Schemes: []string{"http", "https"}, 664 Params: params, 665 Reader: &SearchEmailsReader{formats: a.formats}, 666 AuthInfo: authInfo, 667 Context: params.Context, 668 Client: params.HTTPClient, 669 } 670 for _, opt := range opts { 671 opt(op) 672 } 673 674 result, err := a.transport.Submit(op) 675 if err != nil { 676 return nil, err 677 } 678 success, ok := result.(*SearchEmailsOK) 679 if ok { 680 return success, nil 681 } 682 // unexpected success response 683 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 684 msg := fmt.Sprintf("unexpected success response for searchEmails: API contract not enforced by server. Client expected to get an error, but got: %T", result) 685 panic(msg) 686 } 687 688 /* 689 SearchUsernames Search for users, requires superuser 690 */ 691 func (a *Client) SearchUsernames(params *SearchUsernamesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchUsernamesOK, error) { 692 // TODO: Validate the params before sending 693 if params == nil { 694 params = NewSearchUsernamesParams() 695 } 696 op := &runtime.ClientOperation{ 697 ID: "searchUsernames", 698 Method: "POST", 699 PathPattern: "/users/search_usernames", 700 ProducesMediaTypes: []string{"application/json"}, 701 ConsumesMediaTypes: []string{"application/json"}, 702 Schemes: []string{"http", "https"}, 703 Params: params, 704 Reader: &SearchUsernamesReader{formats: a.formats}, 705 AuthInfo: authInfo, 706 Context: params.Context, 707 Client: params.HTTPClient, 708 } 709 for _, opt := range opts { 710 opt(op) 711 } 712 713 result, err := a.transport.Submit(op) 714 if err != nil { 715 return nil, err 716 } 717 success, ok := result.(*SearchUsernamesOK) 718 if ok { 719 return success, nil 720 } 721 // unexpected success response 722 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 723 msg := fmt.Sprintf("unexpected success response for searchUsernames: API contract not enforced by server. Client expected to get an error, but got: %T", result) 724 panic(msg) 725 } 726 727 /* 728 SendEmailVerification sends a verification email to user 729 730 Send a verification email to user 731 */ 732 func (a *Client) SendEmailVerification(params *SendEmailVerificationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SendEmailVerificationOK, error) { 733 // TODO: Validate the params before sending 734 if params == nil { 735 params = NewSendEmailVerificationParams() 736 } 737 op := &runtime.ClientOperation{ 738 ID: "sendEmailVerification", 739 Method: "POST", 740 PathPattern: "/users/{username}/emails/{email}/verification/send", 741 ProducesMediaTypes: []string{"application/json"}, 742 ConsumesMediaTypes: []string{"application/json"}, 743 Schemes: []string{"http", "https"}, 744 Params: params, 745 Reader: &SendEmailVerificationReader{formats: a.formats}, 746 AuthInfo: authInfo, 747 Context: params.Context, 748 Client: params.HTTPClient, 749 } 750 for _, opt := range opts { 751 opt(op) 752 } 753 754 result, err := a.transport.Submit(op) 755 if err != nil { 756 return nil, err 757 } 758 success, ok := result.(*SendEmailVerificationOK) 759 if ok { 760 return success, nil 761 } 762 // unexpected success response 763 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 764 msg := fmt.Sprintf("unexpected success response for sendEmailVerification: API contract not enforced by server. Client expected to get an error, but got: %T", result) 765 panic(msg) 766 } 767 768 /* 769 SetPreferredEmail updates preferred email 770 771 Update preferred email 772 */ 773 func (a *Client) SetPreferredEmail(params *SetPreferredEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SetPreferredEmailOK, error) { 774 // TODO: Validate the params before sending 775 if params == nil { 776 params = NewSetPreferredEmailParams() 777 } 778 op := &runtime.ClientOperation{ 779 ID: "setPreferredEmail", 780 Method: "PATCH", 781 PathPattern: "/users/{username}/emails/{email}/preferred", 782 ProducesMediaTypes: []string{"application/json"}, 783 ConsumesMediaTypes: []string{"application/json"}, 784 Schemes: []string{"http", "https"}, 785 Params: params, 786 Reader: &SetPreferredEmailReader{formats: a.formats}, 787 AuthInfo: authInfo, 788 Context: params.Context, 789 Client: params.HTTPClient, 790 } 791 for _, opt := range opts { 792 opt(op) 793 } 794 795 result, err := a.transport.Submit(op) 796 if err != nil { 797 return nil, err 798 } 799 success, ok := result.(*SetPreferredEmailOK) 800 if ok { 801 return success, nil 802 } 803 // unexpected success response 804 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 805 msg := fmt.Sprintf("unexpected success response for setPreferredEmail: API contract not enforced by server. Client expected to get an error, but got: %T", result) 806 panic(msg) 807 } 808 809 /* 810 UniqueUsername checks if a username is already taken in the system 811 812 Is the supplied username already assigned 813 */ 814 func (a *Client) UniqueUsername(params *UniqueUsernameParams, opts ...ClientOption) (*UniqueUsernameOK, error) { 815 // TODO: Validate the params before sending 816 if params == nil { 817 params = NewUniqueUsernameParams() 818 } 819 op := &runtime.ClientOperation{ 820 ID: "uniqueUsername", 821 Method: "GET", 822 PathPattern: "/users/uniqueUsername/{username}", 823 ProducesMediaTypes: []string{"application/json"}, 824 ConsumesMediaTypes: []string{"application/json"}, 825 Schemes: []string{"http", "https"}, 826 Params: params, 827 Reader: &UniqueUsernameReader{formats: a.formats}, 828 Context: params.Context, 829 Client: params.HTTPClient, 830 } 831 for _, opt := range opts { 832 opt(op) 833 } 834 835 result, err := a.transport.Submit(op) 836 if err != nil { 837 return nil, err 838 } 839 success, ok := result.(*UniqueUsernameOK) 840 if ok { 841 return success, nil 842 } 843 // unexpected success response 844 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 845 msg := fmt.Sprintf("unexpected success response for uniqueUsername: API contract not enforced by server. Client expected to get an error, but got: %T", result) 846 panic(msg) 847 } 848 849 /* 850 VerifyEmail verifies the designated email 851 852 Verify the designated email 853 */ 854 func (a *Client) VerifyEmail(params *VerifyEmailParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*VerifyEmailOK, error) { 855 // TODO: Validate the params before sending 856 if params == nil { 857 params = NewVerifyEmailParams() 858 } 859 op := &runtime.ClientOperation{ 860 ID: "verifyEmail", 861 Method: "POST", 862 PathPattern: "/users/{username}/emails/{email}/verification/check", 863 ProducesMediaTypes: []string{"application/json"}, 864 ConsumesMediaTypes: []string{"application/json"}, 865 Schemes: []string{"http", "https"}, 866 Params: params, 867 Reader: &VerifyEmailReader{formats: a.formats}, 868 AuthInfo: authInfo, 869 Context: params.Context, 870 Client: params.HTTPClient, 871 } 872 for _, opt := range opts { 873 opt(op) 874 } 875 876 result, err := a.transport.Submit(op) 877 if err != nil { 878 return nil, err 879 } 880 success, ok := result.(*VerifyEmailOK) 881 if ok { 882 return success, nil 883 } 884 // unexpected success response 885 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 886 msg := fmt.Sprintf("unexpected success response for verifyEmail: API contract not enforced by server. Client expected to get an error, but got: %T", result) 887 panic(msg) 888 } 889 890 // SetTransport changes the transport on the client 891 func (a *Client) SetTransport(transport runtime.ClientTransport) { 892 a.transport = transport 893 }