github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/authentication/authentication_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package authentication 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 authentication 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 authentication 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 GetLoginJwtToken(params *GetLoginJwtTokenParams, opts ...ClientOption) error 34 35 GetLogout(params *GetLogoutParams, opts ...ClientOption) (*GetLogoutNoContent, error) 36 37 GetRenew(params *GetRenewParams, opts ...ClientOption) (*GetRenewOK, error) 38 39 PostLogin(params *PostLoginParams, opts ...ClientOption) (*PostLoginOK, error) 40 41 AddToken(params *AddTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddTokenOK, error) 42 43 ChangePassword(params *ChangePasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ChangePasswordOK, error) 44 45 DeleteToken(params *DeleteTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteTokenOK, error) 46 47 DisableTOTP(params *DisableTOTPParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DisableTOTPOK, error) 48 49 EnableTOTP(params *EnableTOTPParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnableTOTPOK, error) 50 51 GithubAuthError(params *GithubAuthErrorParams, opts ...ClientOption) error 52 53 LinkGithubAccount(params *LinkGithubAccountParams, opts ...ClientOption) error 54 55 ListTokens(params *ListTokensParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTokensOK, error) 56 57 LoginAs(params *LoginAsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LoginAsOK, error) 58 59 LoginWithGithub(params *LoginWithGithubParams, opts ...ClientOption) error 60 61 NewTOTP(params *NewTOTPParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NewTOTPOK, error) 62 63 RequestReset(params *RequestResetParams, opts ...ClientOption) (*RequestResetOK, error) 64 65 ResetPassword(params *ResetPasswordParams, opts ...ClientOption) (*ResetPasswordOK, error) 66 67 SignupWithGithub(params *SignupWithGithubParams, opts ...ClientOption) error 68 69 UnlinkGithubAccount(params *UnlinkGithubAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlinkGithubAccountOK, error) 70 71 SetTransport(transport runtime.ClientTransport) 72 } 73 74 /* 75 GetLoginJwtToken logins with a valid j w t and redirect to a platform URL 76 77 Login with a valid JWT and redirect to a platform URL 78 */ 79 func (a *Client) GetLoginJwtToken(params *GetLoginJwtTokenParams, opts ...ClientOption) error { 80 // TODO: Validate the params before sending 81 if params == nil { 82 params = NewGetLoginJwtTokenParams() 83 } 84 op := &runtime.ClientOperation{ 85 ID: "GetLoginJwtToken", 86 Method: "GET", 87 PathPattern: "/login/jwt/{token}", 88 ProducesMediaTypes: []string{"application/json"}, 89 ConsumesMediaTypes: []string{"application/json"}, 90 Schemes: []string{"http", "https"}, 91 Params: params, 92 Reader: &GetLoginJwtTokenReader{formats: a.formats}, 93 Context: params.Context, 94 Client: params.HTTPClient, 95 } 96 for _, opt := range opts { 97 opt(op) 98 } 99 100 _, err := a.transport.Submit(op) 101 if err != nil { 102 return err 103 } 104 return nil 105 } 106 107 /* 108 GetLogout logs out of the current session 109 110 Log out of the current session 111 */ 112 func (a *Client) GetLogout(params *GetLogoutParams, opts ...ClientOption) (*GetLogoutNoContent, error) { 113 // TODO: Validate the params before sending 114 if params == nil { 115 params = NewGetLogoutParams() 116 } 117 op := &runtime.ClientOperation{ 118 ID: "GetLogout", 119 Method: "GET", 120 PathPattern: "/logout", 121 ProducesMediaTypes: []string{"application/json"}, 122 ConsumesMediaTypes: []string{"application/json"}, 123 Schemes: []string{"http", "https"}, 124 Params: params, 125 Reader: &GetLogoutReader{formats: a.formats}, 126 Context: params.Context, 127 Client: params.HTTPClient, 128 } 129 for _, opt := range opts { 130 opt(op) 131 } 132 133 result, err := a.transport.Submit(op) 134 if err != nil { 135 return nil, err 136 } 137 success, ok := result.(*GetLogoutNoContent) 138 if ok { 139 return success, nil 140 } 141 // unexpected success response 142 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 143 msg := fmt.Sprintf("unexpected success response for GetLogout: API contract not enforced by server. Client expected to get an error, but got: %T", result) 144 panic(msg) 145 } 146 147 /* 148 GetRenew renews a valid j w t 149 150 Renew your current JWT to forestall expiration 151 */ 152 func (a *Client) GetRenew(params *GetRenewParams, opts ...ClientOption) (*GetRenewOK, error) { 153 // TODO: Validate the params before sending 154 if params == nil { 155 params = NewGetRenewParams() 156 } 157 op := &runtime.ClientOperation{ 158 ID: "GetRenew", 159 Method: "GET", 160 PathPattern: "/renew", 161 ProducesMediaTypes: []string{"application/json"}, 162 ConsumesMediaTypes: []string{"application/json"}, 163 Schemes: []string{"http", "https"}, 164 Params: params, 165 Reader: &GetRenewReader{formats: a.formats}, 166 Context: params.Context, 167 Client: params.HTTPClient, 168 } 169 for _, opt := range opts { 170 opt(op) 171 } 172 173 result, err := a.transport.Submit(op) 174 if err != nil { 175 return nil, err 176 } 177 success, ok := result.(*GetRenewOK) 178 if ok { 179 return success, nil 180 } 181 // unexpected success response 182 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 183 msg := fmt.Sprintf("unexpected success response for GetRenew: API contract not enforced by server. Client expected to get an error, but got: %T", result) 184 panic(msg) 185 } 186 187 /* 188 PostLogin trades your credentials for a j w t 189 190 Supply either username/password OR token 191 */ 192 func (a *Client) PostLogin(params *PostLoginParams, opts ...ClientOption) (*PostLoginOK, error) { 193 // TODO: Validate the params before sending 194 if params == nil { 195 params = NewPostLoginParams() 196 } 197 op := &runtime.ClientOperation{ 198 ID: "PostLogin", 199 Method: "POST", 200 PathPattern: "/login", 201 ProducesMediaTypes: []string{"application/json"}, 202 ConsumesMediaTypes: []string{"application/json"}, 203 Schemes: []string{"http", "https"}, 204 Params: params, 205 Reader: &PostLoginReader{formats: a.formats}, 206 Context: params.Context, 207 Client: params.HTTPClient, 208 } 209 for _, opt := range opts { 210 opt(op) 211 } 212 213 result, err := a.transport.Submit(op) 214 if err != nil { 215 return nil, err 216 } 217 success, ok := result.(*PostLoginOK) 218 if ok { 219 return success, nil 220 } 221 // unexpected success response 222 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 223 msg := fmt.Sprintf("unexpected success response for PostLogin: API contract not enforced by server. Client expected to get an error, but got: %T", result) 224 panic(msg) 225 } 226 227 /* 228 AddToken generates an API token for current user 229 230 Produces an API token for use with automated API clients 231 */ 232 func (a *Client) AddToken(params *AddTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddTokenOK, error) { 233 // TODO: Validate the params before sending 234 if params == nil { 235 params = NewAddTokenParams() 236 } 237 op := &runtime.ClientOperation{ 238 ID: "addToken", 239 Method: "POST", 240 PathPattern: "/apikeys", 241 ProducesMediaTypes: []string{"application/json"}, 242 ConsumesMediaTypes: []string{"application/json"}, 243 Schemes: []string{"http", "https"}, 244 Params: params, 245 Reader: &AddTokenReader{formats: a.formats}, 246 AuthInfo: authInfo, 247 Context: params.Context, 248 Client: params.HTTPClient, 249 } 250 for _, opt := range opts { 251 opt(op) 252 } 253 254 result, err := a.transport.Submit(op) 255 if err != nil { 256 return nil, err 257 } 258 success, ok := result.(*AddTokenOK) 259 if ok { 260 return success, nil 261 } 262 // unexpected success response 263 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 264 msg := fmt.Sprintf("unexpected success response for addToken: API contract not enforced by server. Client expected to get an error, but got: %T", result) 265 panic(msg) 266 } 267 268 /* 269 ChangePassword changes the current password 270 271 Prompts for current password which is used to change it to something new. 272 */ 273 func (a *Client) ChangePassword(params *ChangePasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ChangePasswordOK, error) { 274 // TODO: Validate the params before sending 275 if params == nil { 276 params = NewChangePasswordParams() 277 } 278 op := &runtime.ClientOperation{ 279 ID: "changePassword", 280 Method: "POST", 281 PathPattern: "/change-password", 282 ProducesMediaTypes: []string{"application/json"}, 283 ConsumesMediaTypes: []string{"application/json"}, 284 Schemes: []string{"http", "https"}, 285 Params: params, 286 Reader: &ChangePasswordReader{formats: a.formats}, 287 AuthInfo: authInfo, 288 Context: params.Context, 289 Client: params.HTTPClient, 290 } 291 for _, opt := range opts { 292 opt(op) 293 } 294 295 result, err := a.transport.Submit(op) 296 if err != nil { 297 return nil, err 298 } 299 success, ok := result.(*ChangePasswordOK) 300 if ok { 301 return success, nil 302 } 303 // unexpected success response 304 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 305 msg := fmt.Sprintf("unexpected success response for changePassword: API contract not enforced by server. Client expected to get an error, but got: %T", result) 306 panic(msg) 307 } 308 309 /* 310 DeleteToken deletes an API token 311 312 Deletes the specified API Token 313 */ 314 func (a *Client) DeleteToken(params *DeleteTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteTokenOK, error) { 315 // TODO: Validate the params before sending 316 if params == nil { 317 params = NewDeleteTokenParams() 318 } 319 op := &runtime.ClientOperation{ 320 ID: "deleteToken", 321 Method: "DELETE", 322 PathPattern: "/apikeys/{tokenID}", 323 ProducesMediaTypes: []string{"application/json"}, 324 ConsumesMediaTypes: []string{"application/json"}, 325 Schemes: []string{"http", "https"}, 326 Params: params, 327 Reader: &DeleteTokenReader{formats: a.formats}, 328 AuthInfo: authInfo, 329 Context: params.Context, 330 Client: params.HTTPClient, 331 } 332 for _, opt := range opts { 333 opt(op) 334 } 335 336 result, err := a.transport.Submit(op) 337 if err != nil { 338 return nil, err 339 } 340 success, ok := result.(*DeleteTokenOK) 341 if ok { 342 return success, nil 343 } 344 // unexpected success response 345 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 346 msg := fmt.Sprintf("unexpected success response for deleteToken: API contract not enforced by server. Client expected to get an error, but got: %T", result) 347 panic(msg) 348 } 349 350 /* 351 DisableTOTP disables t o t p 352 353 Disable TOTP authentication 354 */ 355 func (a *Client) DisableTOTP(params *DisableTOTPParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DisableTOTPOK, error) { 356 // TODO: Validate the params before sending 357 if params == nil { 358 params = NewDisableTOTPParams() 359 } 360 op := &runtime.ClientOperation{ 361 ID: "disableTOTP", 362 Method: "DELETE", 363 PathPattern: "/totp", 364 ProducesMediaTypes: []string{"application/json"}, 365 ConsumesMediaTypes: []string{"application/json"}, 366 Schemes: []string{"http", "https"}, 367 Params: params, 368 Reader: &DisableTOTPReader{formats: a.formats}, 369 AuthInfo: authInfo, 370 Context: params.Context, 371 Client: params.HTTPClient, 372 } 373 for _, opt := range opts { 374 opt(op) 375 } 376 377 result, err := a.transport.Submit(op) 378 if err != nil { 379 return nil, err 380 } 381 success, ok := result.(*DisableTOTPOK) 382 if ok { 383 return success, nil 384 } 385 // unexpected success response 386 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 387 msg := fmt.Sprintf("unexpected success response for disableTOTP: API contract not enforced by server. Client expected to get an error, but got: %T", result) 388 panic(msg) 389 } 390 391 /* 392 EnableTOTP enables t o t p 393 394 Enable TOTP authentication by performing initial code validation 395 */ 396 func (a *Client) EnableTOTP(params *EnableTOTPParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnableTOTPOK, error) { 397 // TODO: Validate the params before sending 398 if params == nil { 399 params = NewEnableTOTPParams() 400 } 401 op := &runtime.ClientOperation{ 402 ID: "enableTOTP", 403 Method: "POST", 404 PathPattern: "/totp", 405 ProducesMediaTypes: []string{"application/json"}, 406 ConsumesMediaTypes: []string{"application/json"}, 407 Schemes: []string{"http", "https"}, 408 Params: params, 409 Reader: &EnableTOTPReader{formats: a.formats}, 410 AuthInfo: authInfo, 411 Context: params.Context, 412 Client: params.HTTPClient, 413 } 414 for _, opt := range opts { 415 opt(op) 416 } 417 418 result, err := a.transport.Submit(op) 419 if err != nil { 420 return nil, err 421 } 422 success, ok := result.(*EnableTOTPOK) 423 if ok { 424 return success, nil 425 } 426 // unexpected success response 427 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 428 msg := fmt.Sprintf("unexpected success response for enableTOTP: API contract not enforced by server. Client expected to get an error, but got: %T", result) 429 panic(msg) 430 } 431 432 /* 433 GithubAuthError callbacks endpoint for handling errors that come from github 434 */ 435 func (a *Client) GithubAuthError(params *GithubAuthErrorParams, opts ...ClientOption) error { 436 // TODO: Validate the params before sending 437 if params == nil { 438 params = NewGithubAuthErrorParams() 439 } 440 op := &runtime.ClientOperation{ 441 ID: "githubAuthError", 442 Method: "GET", 443 PathPattern: "/oauth/github", 444 ProducesMediaTypes: []string{"application/json"}, 445 ConsumesMediaTypes: []string{"application/json"}, 446 Schemes: []string{"http", "https"}, 447 Params: params, 448 Reader: &GithubAuthErrorReader{formats: a.formats}, 449 Context: params.Context, 450 Client: params.HTTPClient, 451 } 452 for _, opt := range opts { 453 opt(op) 454 } 455 456 _, err := a.transport.Submit(op) 457 if err != nil { 458 return err 459 } 460 return nil 461 } 462 463 /* 464 LinkGithubAccount callbacks endpoint for linking an account to github 465 */ 466 func (a *Client) LinkGithubAccount(params *LinkGithubAccountParams, opts ...ClientOption) error { 467 // TODO: Validate the params before sending 468 if params == nil { 469 params = NewLinkGithubAccountParams() 470 } 471 op := &runtime.ClientOperation{ 472 ID: "linkGithubAccount", 473 Method: "GET", 474 PathPattern: "/oauth/github/link", 475 ProducesMediaTypes: []string{"application/json"}, 476 ConsumesMediaTypes: []string{"application/json"}, 477 Schemes: []string{"http", "https"}, 478 Params: params, 479 Reader: &LinkGithubAccountReader{formats: a.formats}, 480 Context: params.Context, 481 Client: params.HTTPClient, 482 } 483 for _, opt := range opts { 484 opt(op) 485 } 486 487 _, err := a.transport.Submit(op) 488 if err != nil { 489 return err 490 } 491 return nil 492 } 493 494 /* 495 ListTokens lists current user s API tokens 496 497 List of all active API Tokens for current user 498 */ 499 func (a *Client) ListTokens(params *ListTokensParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTokensOK, error) { 500 // TODO: Validate the params before sending 501 if params == nil { 502 params = NewListTokensParams() 503 } 504 op := &runtime.ClientOperation{ 505 ID: "listTokens", 506 Method: "GET", 507 PathPattern: "/apikeys", 508 ProducesMediaTypes: []string{"application/json"}, 509 ConsumesMediaTypes: []string{"application/json"}, 510 Schemes: []string{"http", "https"}, 511 Params: params, 512 Reader: &ListTokensReader{formats: a.formats}, 513 AuthInfo: authInfo, 514 Context: params.Context, 515 Client: params.HTTPClient, 516 } 517 for _, opt := range opts { 518 opt(op) 519 } 520 521 result, err := a.transport.Submit(op) 522 if err != nil { 523 return nil, err 524 } 525 success, ok := result.(*ListTokensOK) 526 if ok { 527 return success, nil 528 } 529 // unexpected success response 530 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 531 msg := fmt.Sprintf("unexpected success response for listTokens: API contract not enforced by server. Client expected to get an error, but got: %T", result) 532 panic(msg) 533 } 534 535 /* 536 LoginAs logins as given user requires you to be a superuser 537 */ 538 func (a *Client) LoginAs(params *LoginAsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LoginAsOK, error) { 539 // TODO: Validate the params before sending 540 if params == nil { 541 params = NewLoginAsParams() 542 } 543 op := &runtime.ClientOperation{ 544 ID: "loginAs", 545 Method: "POST", 546 PathPattern: "/login/{username}", 547 ProducesMediaTypes: []string{"application/json"}, 548 ConsumesMediaTypes: []string{"application/json"}, 549 Schemes: []string{"http", "https"}, 550 Params: params, 551 Reader: &LoginAsReader{formats: a.formats}, 552 AuthInfo: authInfo, 553 Context: params.Context, 554 Client: params.HTTPClient, 555 } 556 for _, opt := range opts { 557 opt(op) 558 } 559 560 result, err := a.transport.Submit(op) 561 if err != nil { 562 return nil, err 563 } 564 success, ok := result.(*LoginAsOK) 565 if ok { 566 return success, nil 567 } 568 // unexpected success response 569 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 570 msg := fmt.Sprintf("unexpected success response for loginAs: API contract not enforced by server. Client expected to get an error, but got: %T", result) 571 panic(msg) 572 } 573 574 /* 575 LoginWithGithub callbacks endpoint for logging in via github auth 576 */ 577 func (a *Client) LoginWithGithub(params *LoginWithGithubParams, opts ...ClientOption) error { 578 // TODO: Validate the params before sending 579 if params == nil { 580 params = NewLoginWithGithubParams() 581 } 582 op := &runtime.ClientOperation{ 583 ID: "loginWithGithub", 584 Method: "GET", 585 PathPattern: "/oauth/github/login", 586 ProducesMediaTypes: []string{"application/json"}, 587 ConsumesMediaTypes: []string{"application/json"}, 588 Schemes: []string{"http", "https"}, 589 Params: params, 590 Reader: &LoginWithGithubReader{formats: a.formats}, 591 Context: params.Context, 592 Client: params.HTTPClient, 593 } 594 for _, opt := range opts { 595 opt(op) 596 } 597 598 _, err := a.transport.Submit(op) 599 if err != nil { 600 return err 601 } 602 return nil 603 } 604 605 /* 606 NewTOTP sets up a new t o t p key 607 608 Establish the private key for two-factor authentication 609 */ 610 func (a *Client) NewTOTP(params *NewTOTPParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NewTOTPOK, error) { 611 // TODO: Validate the params before sending 612 if params == nil { 613 params = NewNewTOTPParams() 614 } 615 op := &runtime.ClientOperation{ 616 ID: "newTOTP", 617 Method: "GET", 618 PathPattern: "/totp", 619 ProducesMediaTypes: []string{"application/json"}, 620 ConsumesMediaTypes: []string{"application/json"}, 621 Schemes: []string{"http", "https"}, 622 Params: params, 623 Reader: &NewTOTPReader{formats: a.formats}, 624 AuthInfo: authInfo, 625 Context: params.Context, 626 Client: params.HTTPClient, 627 } 628 for _, opt := range opts { 629 opt(op) 630 } 631 632 result, err := a.transport.Submit(op) 633 if err != nil { 634 return nil, err 635 } 636 success, ok := result.(*NewTOTPOK) 637 if ok { 638 return success, nil 639 } 640 // unexpected success response 641 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 642 msg := fmt.Sprintf("unexpected success response for newTOTP: API contract not enforced by server. Client expected to get an error, but got: %T", result) 643 panic(msg) 644 } 645 646 /* 647 RequestReset requests a password recovery email 648 649 Sends a link which can be used to reset a forgotten password. 650 */ 651 func (a *Client) RequestReset(params *RequestResetParams, opts ...ClientOption) (*RequestResetOK, error) { 652 // TODO: Validate the params before sending 653 if params == nil { 654 params = NewRequestResetParams() 655 } 656 op := &runtime.ClientOperation{ 657 ID: "requestReset", 658 Method: "POST", 659 PathPattern: "/request-reset/{email}", 660 ProducesMediaTypes: []string{"application/json"}, 661 ConsumesMediaTypes: []string{"application/json"}, 662 Schemes: []string{"http", "https"}, 663 Params: params, 664 Reader: &RequestResetReader{formats: a.formats}, 665 Context: params.Context, 666 Client: params.HTTPClient, 667 } 668 for _, opt := range opts { 669 opt(op) 670 } 671 672 result, err := a.transport.Submit(op) 673 if err != nil { 674 return nil, err 675 } 676 success, ok := result.(*RequestResetOK) 677 if ok { 678 return success, nil 679 } 680 // unexpected success response 681 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 682 msg := fmt.Sprintf("unexpected success response for requestReset: API contract not enforced by server. Client expected to get an error, but got: %T", result) 683 panic(msg) 684 } 685 686 /* 687 ResetPassword resets a forgotten password 688 689 Sends a link which can be used to reset a forgotten password. 690 */ 691 func (a *Client) ResetPassword(params *ResetPasswordParams, opts ...ClientOption) (*ResetPasswordOK, error) { 692 // TODO: Validate the params before sending 693 if params == nil { 694 params = NewResetPasswordParams() 695 } 696 op := &runtime.ClientOperation{ 697 ID: "resetPassword", 698 Method: "POST", 699 PathPattern: "/reset-password", 700 ProducesMediaTypes: []string{"application/json"}, 701 ConsumesMediaTypes: []string{"application/json"}, 702 Schemes: []string{"http", "https"}, 703 Params: params, 704 Reader: &ResetPasswordReader{formats: a.formats}, 705 Context: params.Context, 706 Client: params.HTTPClient, 707 } 708 for _, opt := range opts { 709 opt(op) 710 } 711 712 result, err := a.transport.Submit(op) 713 if err != nil { 714 return nil, err 715 } 716 success, ok := result.(*ResetPasswordOK) 717 if ok { 718 return success, nil 719 } 720 // unexpected success response 721 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 722 msg := fmt.Sprintf("unexpected success response for resetPassword: API contract not enforced by server. Client expected to get an error, but got: %T", result) 723 panic(msg) 724 } 725 726 /* 727 SignupWithGithub callbacks endpoint for signing up via github auth 728 */ 729 func (a *Client) SignupWithGithub(params *SignupWithGithubParams, opts ...ClientOption) error { 730 // TODO: Validate the params before sending 731 if params == nil { 732 params = NewSignupWithGithubParams() 733 } 734 op := &runtime.ClientOperation{ 735 ID: "signupWithGithub", 736 Method: "GET", 737 PathPattern: "/oauth/github/signup", 738 ProducesMediaTypes: []string{"application/json"}, 739 ConsumesMediaTypes: []string{"application/json"}, 740 Schemes: []string{"http", "https"}, 741 Params: params, 742 Reader: &SignupWithGithubReader{formats: a.formats}, 743 Context: params.Context, 744 Client: params.HTTPClient, 745 } 746 for _, opt := range opts { 747 opt(op) 748 } 749 750 _, err := a.transport.Submit(op) 751 if err != nil { 752 return err 753 } 754 return nil 755 } 756 757 /* 758 UnlinkGithubAccount callbacks endpoint for unlinking git hub accounts 759 */ 760 func (a *Client) UnlinkGithubAccount(params *UnlinkGithubAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlinkGithubAccountOK, error) { 761 // TODO: Validate the params before sending 762 if params == nil { 763 params = NewUnlinkGithubAccountParams() 764 } 765 op := &runtime.ClientOperation{ 766 ID: "unlinkGithubAccount", 767 Method: "POST", 768 PathPattern: "/oauth/github/unlink", 769 ProducesMediaTypes: []string{"application/json"}, 770 ConsumesMediaTypes: []string{"application/json"}, 771 Schemes: []string{"http", "https"}, 772 Params: params, 773 Reader: &UnlinkGithubAccountReader{formats: a.formats}, 774 AuthInfo: authInfo, 775 Context: params.Context, 776 Client: params.HTTPClient, 777 } 778 for _, opt := range opts { 779 opt(op) 780 } 781 782 result, err := a.transport.Submit(op) 783 if err != nil { 784 return nil, err 785 } 786 success, ok := result.(*UnlinkGithubAccountOK) 787 if ok { 788 return success, nil 789 } 790 // unexpected success response 791 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 792 msg := fmt.Sprintf("unexpected success response for unlinkGithubAccount: API contract not enforced by server. Client expected to get an error, but got: %T", result) 793 panic(msg) 794 } 795 796 // SetTransport changes the transport on the client 797 func (a *Client) SetTransport(transport runtime.ClientTransport) { 798 a.transport = transport 799 }