lib/api/auth0/auth0_client/user/user_client.go

229 lines
7.4 KiB
Go
Raw Permalink Normal View History

2021-08-05 19:37:53 +00:00
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package user
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new user API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for user API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientService is the interface for Client methods
type ClientService interface {
DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams) (*DeleteAPIV2UsersUserIDRolesNoContent, error)
GetUserByEmail(params *GetUserByEmailParams) (*GetUserByEmailOK, error)
GetUserRoles(params *GetUserRolesParams) (*GetUserRolesOK, error)
GetUsers(params *GetUsersParams) (*GetUsersOK, error)
PostUsers(params *PostUsersParams) (*PostUsersCreated, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPIV2UsersUserIDRoles delete API v2 users user ID roles API
*/
func (a *Client) DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams) (*DeleteAPIV2UsersUserIDRolesNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPIV2UsersUserIDRolesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "DeleteAPIV2UsersUserIDRoles",
Method: "DELETE",
PathPattern: "/api/v2/users/{userId}/roles",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DeleteAPIV2UsersUserIDRolesReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*DeleteAPIV2UsersUserIDRolesNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for DeleteAPIV2UsersUserIDRoles: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetUserByEmail gets a single user from auth0 by email address
Get a single user from Auth0 by Email Address
*/
func (a *Client) GetUserByEmail(params *GetUserByEmailParams) (*GetUserByEmailOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetUserByEmailParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getUserByEmail",
Method: "GET",
PathPattern: "/api/v2/users-by-email",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &GetUserByEmailReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetUserByEmailOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getUserByEmail: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetUserRoles gets a user s roles
Get a User's Roles
*/
func (a *Client) GetUserRoles(params *GetUserRolesParams) (*GetUserRolesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetUserRolesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getUserRoles",
Method: "GET",
PathPattern: "/api/v2/users/{userId}/roles",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &GetUserRolesReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetUserRolesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getUserRoles: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetUsers gets all users from auth0
Get all users from Auth0
*/
func (a *Client) GetUsers(params *GetUsersParams) (*GetUsersOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetUsersParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getUsers",
Method: "GET",
PathPattern: "/api/v2/users",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &GetUsersReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetUsersOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostUsers creates new auth0 user
create new Auth0 user
*/
func (a *Client) PostUsers(params *PostUsersParams) (*PostUsersCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostUsersParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "postUsers",
Method: "POST",
PathPattern: "/api/v2/users-by-email",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &PostUsersReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*PostUsersCreated)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for postUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}