| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
|
|
| package users |
|
|
| |
| |
|
|
| import ( |
| "fmt" |
|
|
| "github.com/go-openapi/runtime" |
| "github.com/go-openapi/strfmt" |
| ) |
|
|
| |
| func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { |
| return &Client{transport: transport, formats: formats} |
| } |
|
|
| |
| |
| |
| type Client struct { |
| transport runtime.ClientTransport |
| formats strfmt.Registry |
| } |
|
|
| |
| type ClientOption func(*runtime.ClientOperation) |
|
|
| |
| type ClientService interface { |
| ActivateUser(params *ActivateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ActivateUserOK, error) |
|
|
| CreateUser(params *CreateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateUserCreated, error) |
|
|
| DeactivateUser(params *DeactivateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeactivateUserOK, error) |
|
|
| DeleteUser(params *DeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteUserNoContent, error) |
|
|
| GetOwnInfo(params *GetOwnInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOwnInfoOK, error) |
|
|
| GetUserInfo(params *GetUserInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserInfoOK, error) |
|
|
| ListAllUsers(params *ListAllUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAllUsersOK, error) |
|
|
| RotateUserAPIKey(params *RotateUserAPIKeyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RotateUserAPIKeyOK, error) |
|
|
| SetTransport(transport runtime.ClientTransport) |
| } |
|
|
| |
| |
| |
| func (a *Client) ActivateUser(params *ActivateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ActivateUserOK, error) { |
| |
| if params == nil { |
| params = NewActivateUserParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "activateUser", |
| Method: "POST", |
| PathPattern: "/users/db/{user_id}/activate", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &ActivateUserReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*ActivateUserOK) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for activateUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| |
| |
| func (a *Client) CreateUser(params *CreateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateUserCreated, error) { |
| |
| if params == nil { |
| params = NewCreateUserParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "createUser", |
| Method: "POST", |
| PathPattern: "/users/db/{user_id}", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &CreateUserReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*CreateUserCreated) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for createUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| |
| |
| func (a *Client) DeactivateUser(params *DeactivateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeactivateUserOK, error) { |
| |
| if params == nil { |
| params = NewDeactivateUserParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "deactivateUser", |
| Method: "POST", |
| PathPattern: "/users/db/{user_id}/deactivate", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &DeactivateUserReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*DeactivateUserOK) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for deactivateUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| |
| |
| func (a *Client) DeleteUser(params *DeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteUserNoContent, error) { |
| |
| if params == nil { |
| params = NewDeleteUserParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "deleteUser", |
| Method: "DELETE", |
| PathPattern: "/users/db/{user_id}", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &DeleteUserReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*DeleteUserNoContent) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for deleteUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| |
| |
| func (a *Client) GetOwnInfo(params *GetOwnInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOwnInfoOK, error) { |
| |
| if params == nil { |
| params = NewGetOwnInfoParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "getOwnInfo", |
| Method: "GET", |
| PathPattern: "/users/own-info", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &GetOwnInfoReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*GetOwnInfoOK) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for getOwnInfo: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| |
| |
| func (a *Client) GetUserInfo(params *GetUserInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserInfoOK, error) { |
| |
| if params == nil { |
| params = NewGetUserInfoParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "getUserInfo", |
| Method: "GET", |
| PathPattern: "/users/db/{user_id}", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &GetUserInfoReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*GetUserInfoOK) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for getUserInfo: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| |
| |
| func (a *Client) ListAllUsers(params *ListAllUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAllUsersOK, error) { |
| |
| if params == nil { |
| params = NewListAllUsersParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "listAllUsers", |
| Method: "GET", |
| PathPattern: "/users/db", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &ListAllUsersReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*ListAllUsersOK) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for listAllUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| |
| |
| func (a *Client) RotateUserAPIKey(params *RotateUserAPIKeyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RotateUserAPIKeyOK, error) { |
| |
| if params == nil { |
| params = NewRotateUserAPIKeyParams() |
| } |
| op := &runtime.ClientOperation{ |
| ID: "rotateUserApiKey", |
| Method: "POST", |
| PathPattern: "/users/db/{user_id}/rotate-key", |
| ProducesMediaTypes: []string{"application/json"}, |
| ConsumesMediaTypes: []string{"application/json", "application/yaml"}, |
| Schemes: []string{"https"}, |
| Params: params, |
| Reader: &RotateUserAPIKeyReader{formats: a.formats}, |
| AuthInfo: authInfo, |
| Context: params.Context, |
| Client: params.HTTPClient, |
| } |
| for _, opt := range opts { |
| opt(op) |
| } |
|
|
| result, err := a.transport.Submit(op) |
| if err != nil { |
| return nil, err |
| } |
| success, ok := result.(*RotateUserAPIKeyOK) |
| if ok { |
| return success, nil |
| } |
| |
| |
| msg := fmt.Sprintf("unexpected success response for rotateUserApiKey: API contract not enforced by server. Client expected to get an error, but got: %T", result) |
| panic(msg) |
| } |
|
|
| |
| func (a *Client) SetTransport(transport runtime.ClientTransport) { |
| a.transport = transport |
| } |
|
|