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

252 lines
7.9 KiB
Go
Raw Permalink Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-01-19 16:58:40 +00:00
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
2021-01-08 17:40:28 +00:00
// 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
}
2021-02-09 16:56:57 +00:00
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
2021-01-08 17:40:28 +00:00
// ClientService is the interface for Client methods
type ClientService interface {
2021-02-09 16:56:57 +00:00
DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams, opts ...ClientOption) (*DeleteAPIV2UsersUserIDRolesNoContent, error)
2021-01-08 17:40:28 +00:00
2021-02-09 16:56:57 +00:00
GetUserByEmail(params *GetUserByEmailParams, opts ...ClientOption) (*GetUserByEmailOK, error)
2021-01-08 17:40:28 +00:00
2021-02-09 16:56:57 +00:00
GetUserRoles(params *GetUserRolesParams, opts ...ClientOption) (*GetUserRolesOK, error)
2021-01-08 17:40:28 +00:00
2021-02-09 16:56:57 +00:00
GetUsers(params *GetUsersParams, opts ...ClientOption) (*GetUsersOK, error)
2021-01-08 17:40:28 +00:00
2021-02-09 16:56:57 +00:00
PostUsers(params *PostUsersParams, opts ...ClientOption) (*PostUsersCreated, error)
2021-01-08 17:40:28 +00:00
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPIV2UsersUserIDRoles delete API v2 users user ID roles API
*/
2021-02-09 16:56:57 +00:00
func (a *Client) DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams, opts ...ClientOption) (*DeleteAPIV2UsersUserIDRolesNoContent, error) {
2021-01-08 17:40:28 +00:00
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPIV2UsersUserIDRolesParams()
}
2021-02-09 16:56:57 +00:00
op := &runtime.ClientOperation{
2021-01-08 17:40:28 +00:00
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,
2021-02-09 16:56:57 +00:00
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
2021-01-08 17:40:28 +00:00
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
*/
2021-02-09 16:56:57 +00:00
func (a *Client) GetUserByEmail(params *GetUserByEmailParams, opts ...ClientOption) (*GetUserByEmailOK, error) {
2021-01-08 17:40:28 +00:00
// TODO: Validate the params before sending
if params == nil {
params = NewGetUserByEmailParams()
}
2021-02-09 16:56:57 +00:00
op := &runtime.ClientOperation{
2021-01-08 17:40:28 +00:00
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,
2021-02-09 16:56:57 +00:00
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
2021-01-08 17:40:28 +00:00
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
*/
2021-02-09 16:56:57 +00:00
func (a *Client) GetUserRoles(params *GetUserRolesParams, opts ...ClientOption) (*GetUserRolesOK, error) {
2021-01-08 17:40:28 +00:00
// TODO: Validate the params before sending
if params == nil {
params = NewGetUserRolesParams()
}
2021-02-09 16:56:57 +00:00
op := &runtime.ClientOperation{
2021-01-08 17:40:28 +00:00
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,
2021-02-09 16:56:57 +00:00
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
2021-01-08 17:40:28 +00:00
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
*/
2021-02-09 16:56:57 +00:00
func (a *Client) GetUsers(params *GetUsersParams, opts ...ClientOption) (*GetUsersOK, error) {
2021-01-08 17:40:28 +00:00
// TODO: Validate the params before sending
if params == nil {
params = NewGetUsersParams()
}
2021-02-09 16:56:57 +00:00
op := &runtime.ClientOperation{
2021-01-08 17:40:28 +00:00
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,
2021-02-09 16:56:57 +00:00
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
2021-01-08 17:40:28 +00:00
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
*/
2021-02-09 16:56:57 +00:00
func (a *Client) PostUsers(params *PostUsersParams, opts ...ClientOption) (*PostUsersCreated, error) {
2021-01-08 17:40:28 +00:00
// TODO: Validate the params before sending
if params == nil {
params = NewPostUsersParams()
}
2021-02-09 16:56:57 +00:00
op := &runtime.ClientOperation{
2021-01-08 17:40:28 +00:00
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,
2021-02-09 16:56:57 +00:00
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
2021-01-08 17:40:28 +00:00
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
}