mirror of https://github.com/vernonkeenan/lib
commit
3315d4b105
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, build with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
*.log
|
||||||
|
/swagger/docs/*
|
||||||
|
/.sfdx/*
|
||||||
|
/swagger/apex/*
|
||||||
|
/swagger/mysql/*
|
||||||
|
/swagger/logs/*
|
||||||
|
/swagger/graphql/*
|
||||||
|
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
TELNEXUS_BUILD_ENV ?= dev
|
||||||
|
TELNEXUS_GELF_URI ?= udp://packrat.noc.tnxs.net:12201
|
||||||
|
TELNEXUS_REGISTRY_PRIV ?= hub.tnxs.net
|
||||||
|
TELNEXUS_REGISTRY_PUB ?= docker.io
|
||||||
|
TELNEXUS_REPO_NAME = lib
|
||||||
|
TELNEXUS_VERSION ?= 0.0.1
|
||||||
|
|
||||||
|
.PHONY: swagger
|
||||||
|
|
||||||
|
swagger:
|
||||||
|
rm -rf api
|
||||||
|
#
|
||||||
|
# generate auth0 client
|
||||||
|
#
|
||||||
|
mkdir -p lib/auth0
|
||||||
|
swagger generate client \
|
||||||
|
--log-output=./swagger/logs/generate-auth0-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=auth0 \
|
||||||
|
--spec=./swagger/auth0.yaml \
|
||||||
|
--target=./lib/auth0 \
|
||||||
|
--client-package=auth0-client \
|
||||||
|
--model-package=auth0-models
|
||||||
|
#
|
||||||
|
# generate auth client
|
||||||
|
#
|
||||||
|
mkdir api/auth
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-auth-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=auth \
|
||||||
|
--spec=./swagger/auth-telnexus.yaml \
|
||||||
|
--target=./api/auth \
|
||||||
|
--client-package=auth-client \
|
||||||
|
--model-package=auth-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate cloud client
|
||||||
|
#
|
||||||
|
mkdir api/cloud
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-cloud-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=cloud \
|
||||||
|
--spec=./swagger/cloud-telnexus.yaml \
|
||||||
|
--target=./api/cloud \
|
||||||
|
--client-package=cloud-client \
|
||||||
|
--model-package=cloud-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate crm client
|
||||||
|
#
|
||||||
|
mkdir api/crm
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-crm-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=crm \
|
||||||
|
--spec=./swagger/crm-telnexus.yaml \
|
||||||
|
--target=./api/crm \
|
||||||
|
--client-package=crm-client \
|
||||||
|
--model-package=crm-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate devops client
|
||||||
|
#
|
||||||
|
mkdir api/devops
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-devops-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=devops \
|
||||||
|
--spec=./swagger/devops-telnexus.yaml \
|
||||||
|
--target=./api/devops \
|
||||||
|
--client-package=devops-client \
|
||||||
|
--model-package=devops-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate isp client
|
||||||
|
#
|
||||||
|
mkdir api/isp
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-isp-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=isp \
|
||||||
|
--spec=./swagger/isp-telnexus.yaml \
|
||||||
|
--target=./api/isp \
|
||||||
|
--client-package=isp-client \
|
||||||
|
--model-package=isp-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate kazoo client
|
||||||
|
#
|
||||||
|
mkdir api/kazoo
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-kazoo-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=kazoo \
|
||||||
|
--spec=./swagger/kazoo-telnexus.yaml \
|
||||||
|
--target=./api/kazoo \
|
||||||
|
--client-package=kazoo-client \
|
||||||
|
--model-package=kazoo-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate stash client
|
||||||
|
#
|
||||||
|
mkdir api/stash
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-stash-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=stash \
|
||||||
|
--spec=./swagger/stash-telnexus.yaml \
|
||||||
|
--target=./api/stash \
|
||||||
|
--client-package=stash-client \
|
||||||
|
--model-package=stash-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate voip client
|
||||||
|
#
|
||||||
|
mkdir api/voip
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-voip-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=voip \
|
||||||
|
--spec=./swagger/voip-telnexus.yaml \
|
||||||
|
--target=./api/voip \
|
||||||
|
--client-package=voip-client \
|
||||||
|
--model-package=voip-models \
|
||||||
|
--principal=app.User
|
||||||
|
#
|
||||||
|
# generate workflow client
|
||||||
|
#
|
||||||
|
mkdir api/workflow
|
||||||
|
swagger-new generate client \
|
||||||
|
--log-output=./swagger/logs/generate-workflow-client.log \
|
||||||
|
--copyright-file=./build/COPYRIGHT \
|
||||||
|
--name=workflow \
|
||||||
|
--spec=./swagger/workflow-telnexus.yaml \
|
||||||
|
--target=./api/workflow \
|
||||||
|
--client-package=workflow-client \
|
||||||
|
--model-package=workflow-models \
|
||||||
|
--principal=app.User
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_client
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/auth/auth_client/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Default auth HTTP client.
|
||||||
|
var Default = NewHTTPClient(nil)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// DefaultHost is the default Host
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultHost string = "auth.infra.tnxs.net:8080"
|
||||||
|
// DefaultBasePath is the default BasePath
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultBasePath string = "/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
|
||||||
|
var DefaultSchemes = []string{"http"}
|
||||||
|
|
||||||
|
// NewHTTPClient creates a new auth HTTP client.
|
||||||
|
func NewHTTPClient(formats strfmt.Registry) *Auth {
|
||||||
|
return NewHTTPClientWithConfig(formats, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHTTPClientWithConfig creates a new auth HTTP client,
|
||||||
|
// using a customizable transport config.
|
||||||
|
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Auth {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if cfg == nil {
|
||||||
|
cfg = DefaultTransportConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
// create transport and client
|
||||||
|
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
|
||||||
|
return New(transport, formats)
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new auth client
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Auth {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if formats == nil {
|
||||||
|
formats = strfmt.Default
|
||||||
|
}
|
||||||
|
|
||||||
|
cli := new(Auth)
|
||||||
|
cli.Transport = transport
|
||||||
|
cli.User = user.New(transport, formats)
|
||||||
|
return cli
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultTransportConfig creates a TransportConfig with the
|
||||||
|
// default settings taken from the meta section of the spec file.
|
||||||
|
func DefaultTransportConfig() *TransportConfig {
|
||||||
|
return &TransportConfig{
|
||||||
|
Host: DefaultHost,
|
||||||
|
BasePath: DefaultBasePath,
|
||||||
|
Schemes: DefaultSchemes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TransportConfig contains the transport related info,
|
||||||
|
// found in the meta section of the spec file.
|
||||||
|
type TransportConfig struct {
|
||||||
|
Host string
|
||||||
|
BasePath string
|
||||||
|
Schemes []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHost overrides the default host,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
|
||||||
|
cfg.Host = host
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBasePath overrides the default basePath,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
|
||||||
|
cfg.BasePath = basePath
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSchemes overrides the default schemes,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
||||||
|
cfg.Schemes = schemes
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auth is a client for auth
|
||||||
|
type Auth struct {
|
||||||
|
User user.ClientService
|
||||||
|
|
||||||
|
Transport runtime.ClientTransport
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransport changes the transport on the client and all its subresources
|
||||||
|
func (c *Auth) SetTransport(transport runtime.ClientTransport) {
|
||||||
|
c.Transport = transport
|
||||||
|
c.User.SetTransport(transport)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetUsersParams creates a new GetUsersParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetUsersParams() *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersParamsWithTimeout creates a new GetUsersParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersParamsWithContext creates a new GetUsersParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get users operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetUsersParams struct {
|
||||||
|
|
||||||
|
/* Apikey.
|
||||||
|
|
||||||
|
Service account or developer API key
|
||||||
|
*/
|
||||||
|
Apikey *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get users params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetUsersParams) WithDefaults() *GetUsersParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get users params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetUsersParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get users params
|
||||||
|
func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get users params
|
||||||
|
func (o *GetUsersParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get users params
|
||||||
|
func (o *GetUsersParams) WithContext(ctx context.Context) *GetUsersParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get users params
|
||||||
|
func (o *GetUsersParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get users params
|
||||||
|
func (o *GetUsersParams) WithHTTPClient(client *http.Client) *GetUsersParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get users params
|
||||||
|
func (o *GetUsersParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithApikey adds the apikey to the get users params
|
||||||
|
func (o *GetUsersParams) WithApikey(apikey *string) *GetUsersParams {
|
||||||
|
o.SetApikey(apikey)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetApikey adds the apikey to the get users params
|
||||||
|
func (o *GetUsersParams) SetApikey(apikey *string) {
|
||||||
|
o.Apikey = apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.Apikey != nil {
|
||||||
|
|
||||||
|
// query param apikey
|
||||||
|
var qrApikey string
|
||||||
|
|
||||||
|
if o.Apikey != nil {
|
||||||
|
qrApikey = *o.Apikey
|
||||||
|
}
|
||||||
|
qApikey := qrApikey
|
||||||
|
if qApikey != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("apikey", qApikey); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,261 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// 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"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/auth/auth_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetUsersReader is a Reader for the GetUsers structure.
|
||||||
|
type GetUsersReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetUsersOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetUsersUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetUsersForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetUsersNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetUsersUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetUsersInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersOK creates a GetUsersOK with default headers values
|
||||||
|
func NewGetUsersOK() *GetUsersOK {
|
||||||
|
return &GetUsersOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with User objects
|
||||||
|
*/
|
||||||
|
type GetUsersOK struct {
|
||||||
|
Payload *auth_models.UserResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersOK) GetPayload() *auth_models.UserResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(auth_models.UserResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersUnauthorized creates a GetUsersUnauthorized with default headers values
|
||||||
|
func NewGetUsersUnauthorized() *GetUsersUnauthorized {
|
||||||
|
return &GetUsersUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access Unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetUsersUnauthorized struct {
|
||||||
|
Payload *auth_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersUnauthorized) GetPayload() *auth_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(auth_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersForbidden creates a GetUsersForbidden with default headers values
|
||||||
|
func NewGetUsersForbidden() *GetUsersForbidden {
|
||||||
|
return &GetUsersForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetUsersForbidden struct {
|
||||||
|
Payload *auth_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersForbidden) GetPayload() *auth_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(auth_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersNotFound creates a GetUsersNotFound with default headers values
|
||||||
|
func NewGetUsersNotFound() *GetUsersNotFound {
|
||||||
|
return &GetUsersNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetUsersNotFound struct {
|
||||||
|
Payload *auth_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersNotFound) GetPayload() *auth_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(auth_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersUnprocessableEntity creates a GetUsersUnprocessableEntity with default headers values
|
||||||
|
func NewGetUsersUnprocessableEntity() *GetUsersUnprocessableEntity {
|
||||||
|
return &GetUsersUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetUsersUnprocessableEntity struct {
|
||||||
|
Payload *auth_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersUnprocessableEntity) GetPayload() *auth_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(auth_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersInternalServerError creates a GetUsersInternalServerError with default headers values
|
||||||
|
func NewGetUsersInternalServerError() *GetUsersInternalServerError {
|
||||||
|
return &GetUsersInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetUsersInternalServerError struct {
|
||||||
|
Payload *auth_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersInternalServerError) GetPayload() *auth_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(auth_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetUsers checks API key
|
||||||
|
|
||||||
|
Checks for a valid API key, and returns full user record
|
||||||
|
*/
|
||||||
|
func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetUsersParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getUsers",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/users",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetUsersReader{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.(*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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransport changes the transport on the client
|
||||||
|
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||||
|
a.transport = transport
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Address address
|
||||||
|
//
|
||||||
|
// swagger:model Address
|
||||||
|
type Address struct {
|
||||||
|
|
||||||
|
// City
|
||||||
|
City string `json:"City,omitempty"`
|
||||||
|
|
||||||
|
// Country full name
|
||||||
|
Country string `json:"Country,omitempty"`
|
||||||
|
|
||||||
|
// Country Code
|
||||||
|
CountryCode string `json:"CountryCode,omitempty"`
|
||||||
|
|
||||||
|
// Postal Code
|
||||||
|
PostalCode string `json:"PostalCode,omitempty"`
|
||||||
|
|
||||||
|
// State full name
|
||||||
|
State string `json:"State,omitempty"`
|
||||||
|
|
||||||
|
// State Code
|
||||||
|
StateCode string `json:"StateCode,omitempty"`
|
||||||
|
|
||||||
|
// Street number and name
|
||||||
|
Street string `json:"Street,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this address
|
||||||
|
func (m *Address) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this address based on context it is used
|
||||||
|
func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *Address) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *Address) UnmarshalBinary(b []byte) error {
|
||||||
|
var res Address
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Error error
|
||||||
|
//
|
||||||
|
// swagger:model Error
|
||||||
|
type Error struct {
|
||||||
|
|
||||||
|
// code
|
||||||
|
Code int32 `json:"Code,omitempty"`
|
||||||
|
|
||||||
|
// fields
|
||||||
|
Fields string `json:"Fields,omitempty"`
|
||||||
|
|
||||||
|
// message
|
||||||
|
Message string `json:"Message,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this error
|
||||||
|
func (m *Error) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this error based on context it is used
|
||||||
|
func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *Error) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *Error) UnmarshalBinary(b []byte) error {
|
||||||
|
var res Error
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ResponseMeta response meta
|
||||||
|
//
|
||||||
|
// swagger:model ResponseMeta
|
||||||
|
type ResponseMeta struct {
|
||||||
|
|
||||||
|
// Microservice Contact Info
|
||||||
|
Contact string `json:"Contact,omitempty"`
|
||||||
|
|
||||||
|
// Copyright Info
|
||||||
|
Copyright string `json:"Copyright,omitempty"`
|
||||||
|
|
||||||
|
// License Information and Restrictions
|
||||||
|
License string `json:"License,omitempty"`
|
||||||
|
|
||||||
|
// Operation ID
|
||||||
|
OperationID string `json:"OperationID,omitempty"`
|
||||||
|
|
||||||
|
// Request IP Address
|
||||||
|
RequestIP string `json:"RequestIP,omitempty"`
|
||||||
|
|
||||||
|
// Request Type
|
||||||
|
RequestType string `json:"RequestType,omitempty"`
|
||||||
|
|
||||||
|
// Request URL
|
||||||
|
RequestURL string `json:"RequestURL,omitempty"`
|
||||||
|
|
||||||
|
// Data Server Info
|
||||||
|
ServerInfo string `json:"ServerInfo,omitempty"`
|
||||||
|
|
||||||
|
// Data Server Response Time (ms)
|
||||||
|
ServerResponseTime string `json:"ServerResponseTime,omitempty"`
|
||||||
|
|
||||||
|
// Backend Server Timestamp
|
||||||
|
ServerTimestamp string `json:"ServerTimestamp,omitempty"`
|
||||||
|
|
||||||
|
// Telnexus Account Number used for recording transactions
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this response meta
|
||||||
|
func (m *ResponseMeta) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this response meta based on context it is used
|
||||||
|
func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *ResponseMeta) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *ResponseMeta) UnmarshalBinary(b []byte) error {
|
||||||
|
var res ResponseMeta
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TenantUser Relationship object that connects users to a tenant
|
||||||
|
//
|
||||||
|
// swagger:model TenantUser
|
||||||
|
type TenantUser struct {
|
||||||
|
|
||||||
|
// The makeTenantUser access level for this User
|
||||||
|
AccessLevel string `json:"AccessLevel,omitempty"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID string `json:"AccountID,omitempty"`
|
||||||
|
|
||||||
|
// Auth0 User ID
|
||||||
|
Auth0UserID string `json:"Auth0UserID,omitempty"`
|
||||||
|
|
||||||
|
// Account Name
|
||||||
|
CompanyName string `json:"CompanyName,omitempty"`
|
||||||
|
|
||||||
|
// Contact ID
|
||||||
|
ContactID string `json:"ContactID,omitempty"`
|
||||||
|
|
||||||
|
// Telnexus Account
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
|
||||||
|
// Tenant active?
|
||||||
|
TenantActive bool `json:"TenantActive,omitempty"`
|
||||||
|
|
||||||
|
// The Tenant ID
|
||||||
|
TenantID string `json:"TenantID,omitempty"`
|
||||||
|
|
||||||
|
// Tenant Name
|
||||||
|
TenantName string `json:"TenantName,omitempty"`
|
||||||
|
|
||||||
|
// Tenant Status
|
||||||
|
TenantStatus string `json:"TenantStatus,omitempty"`
|
||||||
|
|
||||||
|
// Tenant type
|
||||||
|
TenantType string `json:"TenantType,omitempty"`
|
||||||
|
|
||||||
|
// Tenant Version
|
||||||
|
TenantVersion string `json:"TenantVersion,omitempty"`
|
||||||
|
|
||||||
|
// User Email Address
|
||||||
|
UserEmail string `json:"UserEmail,omitempty"`
|
||||||
|
|
||||||
|
// User Full Name
|
||||||
|
UserFullName string `json:"UserFullName,omitempty"`
|
||||||
|
|
||||||
|
// The User ID
|
||||||
|
UserID string `json:"UserID,omitempty"`
|
||||||
|
|
||||||
|
// Username
|
||||||
|
Username string `json:"Username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this tenant user
|
||||||
|
func (m *TenantUser) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this tenant user based on context it is used
|
||||||
|
func (m *TenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *TenantUser) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *TenantUser) UnmarshalBinary(b []byte) error {
|
||||||
|
var res TenantUser
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,376 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// User user
|
||||||
|
//
|
||||||
|
// swagger:model User
|
||||||
|
type User struct {
|
||||||
|
|
||||||
|
// API Key
|
||||||
|
APIKey string `json:"APIKey,omitempty"`
|
||||||
|
|
||||||
|
// About Me
|
||||||
|
AboutMe string `json:"AboutMe,omitempty"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID string `json:"AccountID,omitempty"`
|
||||||
|
|
||||||
|
// address
|
||||||
|
Address *Address `json:"Address,omitempty"`
|
||||||
|
|
||||||
|
// Alias
|
||||||
|
Alias string `json:"Alias,omitempty"`
|
||||||
|
|
||||||
|
// Auth0 User Id
|
||||||
|
Auth0UserID string `json:"Auth0UserID,omitempty"`
|
||||||
|
|
||||||
|
// Nickname
|
||||||
|
CommunityNickname string `json:"CommunityNickname,omitempty"`
|
||||||
|
|
||||||
|
// Company Name
|
||||||
|
CompanyName string `json:"CompanyName,omitempty"`
|
||||||
|
|
||||||
|
// Contact
|
||||||
|
ContactID string `json:"ContactID,omitempty"`
|
||||||
|
|
||||||
|
// Created User ID
|
||||||
|
CreatedByID string `json:"CreatedByID,omitempty"`
|
||||||
|
|
||||||
|
// Date Created
|
||||||
|
CreatedDate string `json:"CreatedDate,omitempty"`
|
||||||
|
|
||||||
|
// Delegated Approver
|
||||||
|
DelegatedApproverID string `json:"DelegatedApproverID,omitempty"`
|
||||||
|
|
||||||
|
// Department
|
||||||
|
Department string `json:"Department,omitempty"`
|
||||||
|
|
||||||
|
// Division
|
||||||
|
Division string `json:"Division,omitempty"`
|
||||||
|
|
||||||
|
// Email address
|
||||||
|
Email string `json:"Email,omitempty"`
|
||||||
|
|
||||||
|
// Employee Number
|
||||||
|
EmployeeNumber string `json:"EmployeeNumber,omitempty"`
|
||||||
|
|
||||||
|
// Time day ends
|
||||||
|
EndOfDay string `json:"EndOfDay,omitempty"`
|
||||||
|
|
||||||
|
// Environment
|
||||||
|
Environment string `json:"Environment,omitempty"`
|
||||||
|
|
||||||
|
// Extension
|
||||||
|
Extension string `json:"Extension,omitempty"`
|
||||||
|
|
||||||
|
// Fabric API Key
|
||||||
|
FabricAPIKey string `json:"FabricAPIKey,omitempty"`
|
||||||
|
|
||||||
|
// Fax
|
||||||
|
Fax string `json:"Fax,omitempty"`
|
||||||
|
|
||||||
|
// The first name
|
||||||
|
FirstName string `json:"FirstName,omitempty"`
|
||||||
|
|
||||||
|
// Allow Forecasting
|
||||||
|
ForecastEnabled bool `json:"ForecastEnabled,omitempty"`
|
||||||
|
|
||||||
|
// Full Photo URL
|
||||||
|
FullPhotoURL string `json:"FullPhotoURL,omitempty"`
|
||||||
|
|
||||||
|
// Telnexus ID
|
||||||
|
ID string `json:"ID,omitempty"`
|
||||||
|
|
||||||
|
// Active
|
||||||
|
IsActive bool `json:"IsActive,omitempty"`
|
||||||
|
|
||||||
|
// Is the user enabled for Communities?
|
||||||
|
IsPortalEnabled bool `json:"IsPortalEnabled,omitempty"`
|
||||||
|
|
||||||
|
// Has Profile Photo
|
||||||
|
IsProphilePhotoActive bool `json:"IsProphilePhotoActive,omitempty"`
|
||||||
|
|
||||||
|
// is system controlled
|
||||||
|
IsSystemControlled bool `json:"IsSystemControlled,omitempty"`
|
||||||
|
|
||||||
|
// IP address of last login
|
||||||
|
LastIP string `json:"LastIP,omitempty"`
|
||||||
|
|
||||||
|
// Last login time
|
||||||
|
LastLogin string `json:"LastLogin,omitempty"`
|
||||||
|
|
||||||
|
// Last Modified User ID
|
||||||
|
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
|
||||||
|
|
||||||
|
// Last Modified Date
|
||||||
|
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
|
||||||
|
|
||||||
|
// The Last Name
|
||||||
|
LastName string `json:"LastName,omitempty"`
|
||||||
|
|
||||||
|
// Number of times user has logged in
|
||||||
|
LoginCount int64 `json:"LoginCount,omitempty"`
|
||||||
|
|
||||||
|
// Manager
|
||||||
|
ManagerID string `json:"ManagerID,omitempty"`
|
||||||
|
|
||||||
|
// Mobile
|
||||||
|
MobilePhone string `json:"MobilePhone,omitempty"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"Name,omitempty"`
|
||||||
|
|
||||||
|
// Out of office message
|
||||||
|
OutOfOfficeMessage string `json:"OutOfOfficeMessage,omitempty"`
|
||||||
|
|
||||||
|
// Phone
|
||||||
|
Phone string `json:"Phone,omitempty"`
|
||||||
|
|
||||||
|
// Portal Role Level
|
||||||
|
PortalRole string `json:"PortalRole,omitempty"`
|
||||||
|
|
||||||
|
// Profile
|
||||||
|
ProfileID string `json:"ProfileID,omitempty"`
|
||||||
|
|
||||||
|
// Info Emails
|
||||||
|
ReceivesAdminEmails bool `json:"ReceivesAdminEmails,omitempty"`
|
||||||
|
|
||||||
|
// Admin Info Emails
|
||||||
|
ReceivesAdminInfoEmails bool `json:"ReceivesAdminInfoEmails,omitempty"`
|
||||||
|
|
||||||
|
// Email Sender Address
|
||||||
|
SenderEmail string `json:"SenderEmail,omitempty"`
|
||||||
|
|
||||||
|
// Email Sender Name
|
||||||
|
SenderName string `json:"SenderName,omitempty"`
|
||||||
|
|
||||||
|
// Email Signature
|
||||||
|
Signature string `json:"Signature,omitempty"`
|
||||||
|
|
||||||
|
// Small Photo URL
|
||||||
|
SmallPhotoURL string `json:"SmallPhotoURL,omitempty"`
|
||||||
|
|
||||||
|
// The time day starts
|
||||||
|
StartOfDay string `json:"StartOfDay,omitempty"`
|
||||||
|
|
||||||
|
// Telnexus Account
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
|
||||||
|
// Tenant ID associated with this user
|
||||||
|
TenantID string `json:"TenantID,omitempty"`
|
||||||
|
|
||||||
|
// tenant users
|
||||||
|
TenantUsers []*TenantUser `json:"TenantUsers"`
|
||||||
|
|
||||||
|
// Time Zone
|
||||||
|
TimeZone string `json:"TimeZone,omitempty"`
|
||||||
|
|
||||||
|
// Title
|
||||||
|
Title string `json:"Title,omitempty"`
|
||||||
|
|
||||||
|
// Role
|
||||||
|
UserRoleID string `json:"UserRoleID,omitempty"`
|
||||||
|
|
||||||
|
// user roles
|
||||||
|
UserRoles []*UserRole `json:"UserRoles"`
|
||||||
|
|
||||||
|
// User Type
|
||||||
|
UserType string `json:"UserType,omitempty"`
|
||||||
|
|
||||||
|
// Username
|
||||||
|
Username string `json:"Username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this user
|
||||||
|
func (m *User) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateAddress(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateTenantUsers(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateUserRoles(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) validateAddress(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Address) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Address != nil {
|
||||||
|
if err := m.Address.Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Address")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) validateTenantUsers(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.TenantUsers) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.TenantUsers); i++ {
|
||||||
|
if swag.IsZero(m.TenantUsers[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.TenantUsers[i] != nil {
|
||||||
|
if err := m.TenantUsers[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) validateUserRoles(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.UserRoles) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.UserRoles); i++ {
|
||||||
|
if swag.IsZero(m.UserRoles[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.UserRoles[i] != nil {
|
||||||
|
if err := m.UserRoles[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validate this user based on the context it is used
|
||||||
|
func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateAddress(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateTenantUsers(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateUserRoles(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if m.Address != nil {
|
||||||
|
if err := m.Address.ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Address")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.TenantUsers); i++ {
|
||||||
|
|
||||||
|
if m.TenantUsers[i] != nil {
|
||||||
|
if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) contextValidateUserRoles(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.UserRoles); i++ {
|
||||||
|
|
||||||
|
if m.UserRoles[i] != nil {
|
||||||
|
if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *User) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *User) UnmarshalBinary(b []byte) error {
|
||||||
|
var res User
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserResponse An array Telnexus user objects
|
||||||
|
//
|
||||||
|
// swagger:model UserResponse
|
||||||
|
type UserResponse struct {
|
||||||
|
|
||||||
|
// data
|
||||||
|
Data []*User `json:"Data"`
|
||||||
|
|
||||||
|
// meta
|
||||||
|
Meta *ResponseMeta `json:"Meta,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this user response
|
||||||
|
func (m *UserResponse) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateData(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateMeta(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) validateData(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Data) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
if swag.IsZero(m.Data[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) validateMeta(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Meta) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validate this user response based on the context it is used
|
||||||
|
func (m *UserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateMeta(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *UserResponse) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *UserResponse) UnmarshalBinary(b []byte) error {
|
||||||
|
var res UserResponse
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package auth_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserRole Relationship object that connects user to a role
|
||||||
|
//
|
||||||
|
// swagger:model UserRole
|
||||||
|
type UserRole struct {
|
||||||
|
|
||||||
|
// Account Id
|
||||||
|
AccountID string `json:"AccountID,omitempty"`
|
||||||
|
|
||||||
|
// Linked role ID
|
||||||
|
Auth0RoleID string `json:"Auth0RoleID,omitempty"`
|
||||||
|
|
||||||
|
// Auth0 User ID
|
||||||
|
Auth0UserID string `json:"Auth0UserID,omitempty"`
|
||||||
|
|
||||||
|
// Company Name
|
||||||
|
CompanyName string `json:"CompanyName,omitempty"`
|
||||||
|
|
||||||
|
// Contact ID
|
||||||
|
ContactID string `json:"ContactID,omitempty"`
|
||||||
|
|
||||||
|
// Role description
|
||||||
|
RoleDescription string `json:"RoleDescription,omitempty"`
|
||||||
|
|
||||||
|
// The Role ID
|
||||||
|
RoleID string `json:"RoleID,omitempty"`
|
||||||
|
|
||||||
|
// Role Name
|
||||||
|
RoleName string `json:"RoleName,omitempty"`
|
||||||
|
|
||||||
|
// Telnexus Account Number
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
|
||||||
|
// User Email Address
|
||||||
|
UserEmail string `json:"UserEmail,omitempty"`
|
||||||
|
|
||||||
|
// User Full Name
|
||||||
|
UserFullName string `json:"UserFullName,omitempty"`
|
||||||
|
|
||||||
|
// The User ID
|
||||||
|
UserID string `json:"UserID,omitempty"`
|
||||||
|
|
||||||
|
// Username
|
||||||
|
Username string `json:"Username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this user role
|
||||||
|
func (m *UserRole) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this user role based on context it is used
|
||||||
|
func (m *UserRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *UserRole) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *UserRole) UnmarshalBinary(b []byte) error {
|
||||||
|
var res UserRole
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_client
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_client/cors"
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_client/hub"
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_client/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Default cloud HTTP client.
|
||||||
|
var Default = NewHTTPClient(nil)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// DefaultHost is the default Host
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultHost string = "cloud.infra.tnxs.net:8080"
|
||||||
|
// DefaultBasePath is the default BasePath
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultBasePath string = "/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
|
||||||
|
var DefaultSchemes = []string{"http"}
|
||||||
|
|
||||||
|
// NewHTTPClient creates a new cloud HTTP client.
|
||||||
|
func NewHTTPClient(formats strfmt.Registry) *Cloud {
|
||||||
|
return NewHTTPClientWithConfig(formats, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHTTPClientWithConfig creates a new cloud HTTP client,
|
||||||
|
// using a customizable transport config.
|
||||||
|
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Cloud {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if cfg == nil {
|
||||||
|
cfg = DefaultTransportConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
// create transport and client
|
||||||
|
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
|
||||||
|
return New(transport, formats)
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new cloud client
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Cloud {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if formats == nil {
|
||||||
|
formats = strfmt.Default
|
||||||
|
}
|
||||||
|
|
||||||
|
cli := new(Cloud)
|
||||||
|
cli.Transport = transport
|
||||||
|
cli.Cors = cors.New(transport, formats)
|
||||||
|
cli.Hub = hub.New(transport, formats)
|
||||||
|
cli.User = user.New(transport, formats)
|
||||||
|
return cli
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultTransportConfig creates a TransportConfig with the
|
||||||
|
// default settings taken from the meta section of the spec file.
|
||||||
|
func DefaultTransportConfig() *TransportConfig {
|
||||||
|
return &TransportConfig{
|
||||||
|
Host: DefaultHost,
|
||||||
|
BasePath: DefaultBasePath,
|
||||||
|
Schemes: DefaultSchemes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TransportConfig contains the transport related info,
|
||||||
|
// found in the meta section of the spec file.
|
||||||
|
type TransportConfig struct {
|
||||||
|
Host string
|
||||||
|
BasePath string
|
||||||
|
Schemes []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHost overrides the default host,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
|
||||||
|
cfg.Host = host
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBasePath overrides the default basePath,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
|
||||||
|
cfg.BasePath = basePath
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSchemes overrides the default schemes,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
||||||
|
cfg.Schemes = schemes
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cloud is a client for cloud
|
||||||
|
type Cloud struct {
|
||||||
|
Cors cors.ClientService
|
||||||
|
|
||||||
|
Hub hub.ClientService
|
||||||
|
|
||||||
|
User user.ClientService
|
||||||
|
|
||||||
|
Transport runtime.ClientTransport
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransport changes the transport on the client and all its subresources
|
||||||
|
func (c *Cloud) SetTransport(transport runtime.ClientTransport) {
|
||||||
|
c.Transport = transport
|
||||||
|
c.Cors.SetTransport(transport)
|
||||||
|
c.Hub.SetTransport(transport)
|
||||||
|
c.User.SetTransport(transport)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAccountOptionsParams creates a new AccountOptionsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewAccountOptionsParams() *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsParamsWithTimeout creates a new AccountOptionsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAccountOptionsParamsWithTimeout(timeout time.Duration) *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsParamsWithContext creates a new AccountOptionsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAccountOptionsParamsWithContext(ctx context.Context) *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsParamsWithHTTPClient creates a new AccountOptionsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAccountOptionsParamsWithHTTPClient(client *http.Client) *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AccountOptionsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the account options operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AccountOptionsParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the account options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AccountOptionsParams) WithDefaults() *AccountOptionsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the account options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AccountOptionsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the account options params
|
||||||
|
func (o *AccountOptionsParams) WithTimeout(timeout time.Duration) *AccountOptionsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the account options params
|
||||||
|
func (o *AccountOptionsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the account options params
|
||||||
|
func (o *AccountOptionsParams) WithContext(ctx context.Context) *AccountOptionsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the account options params
|
||||||
|
func (o *AccountOptionsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the account options params
|
||||||
|
func (o *AccountOptionsParams) WithHTTPClient(client *http.Client) *AccountOptionsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the account options params
|
||||||
|
func (o *AccountOptionsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AccountOptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccountOptionsReader is a Reader for the AccountOptions structure.
|
||||||
|
type AccountOptionsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AccountOptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAccountOptionsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsOK creates a AccountOptionsOK with default headers values
|
||||||
|
func NewAccountOptionsOK() *AccountOptionsOK {
|
||||||
|
return &AccountOptionsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AccountOptionsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type AccountOptionsOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AccountOptionsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /hubs][%d] accountOptionsOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AccountOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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 cors API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for cors API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
AccountOptions(params *AccountOptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountOptionsOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AccountOptions CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) AccountOptions(params *AccountOptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountOptionsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewAccountOptionsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "accountOptions",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/hubs",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &AccountOptionsReader{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.(*AccountOptionsOK)
|
||||||
|
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 accountOptions: 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
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewDeleteHubParams creates a new DeleteHubParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewDeleteHubParams() *DeleteHubParams {
|
||||||
|
return &DeleteHubParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubParamsWithTimeout creates a new DeleteHubParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewDeleteHubParamsWithTimeout(timeout time.Duration) *DeleteHubParams {
|
||||||
|
return &DeleteHubParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubParamsWithContext creates a new DeleteHubParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewDeleteHubParamsWithContext(ctx context.Context) *DeleteHubParams {
|
||||||
|
return &DeleteHubParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubParamsWithHTTPClient creates a new DeleteHubParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewDeleteHubParamsWithHTTPClient(client *http.Client) *DeleteHubParams {
|
||||||
|
return &DeleteHubParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteHubParams contains all the parameters to send to the API endpoint
|
||||||
|
for the delete hub operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type DeleteHubParams struct {
|
||||||
|
|
||||||
|
/* AccountID.
|
||||||
|
|
||||||
|
Taxnexus Record Id of an Account
|
||||||
|
*/
|
||||||
|
AccountID *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the delete hub params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteHubParams) WithDefaults() *DeleteHubParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the delete hub params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteHubParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the delete hub params
|
||||||
|
func (o *DeleteHubParams) WithTimeout(timeout time.Duration) *DeleteHubParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the delete hub params
|
||||||
|
func (o *DeleteHubParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the delete hub params
|
||||||
|
func (o *DeleteHubParams) WithContext(ctx context.Context) *DeleteHubParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the delete hub params
|
||||||
|
func (o *DeleteHubParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the delete hub params
|
||||||
|
func (o *DeleteHubParams) WithHTTPClient(client *http.Client) *DeleteHubParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the delete hub params
|
||||||
|
func (o *DeleteHubParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAccountID adds the accountID to the delete hub params
|
||||||
|
func (o *DeleteHubParams) WithAccountID(accountID *string) *DeleteHubParams {
|
||||||
|
o.SetAccountID(accountID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAccountID adds the accountId to the delete hub params
|
||||||
|
func (o *DeleteHubParams) SetAccountID(accountID *string) {
|
||||||
|
o.AccountID = accountID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *DeleteHubParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
|
||||||
|
// query param accountId
|
||||||
|
var qrAccountID string
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
qrAccountID = *o.AccountID
|
||||||
|
}
|
||||||
|
qAccountID := qrAccountID
|
||||||
|
if qAccountID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("accountId", qAccountID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,270 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteHubReader is a Reader for the DeleteHub structure.
|
||||||
|
type DeleteHubReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *DeleteHubReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewDeleteHubOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewDeleteHubUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewDeleteHubForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewDeleteHubNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewDeleteHubUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewDeleteHubInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubOK creates a DeleteHubOK with default headers values
|
||||||
|
func NewDeleteHubOK() *DeleteHubOK {
|
||||||
|
return &DeleteHubOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteHubOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Taxnexus Response with Message Objects with Delete Status
|
||||||
|
*/
|
||||||
|
type DeleteHubOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *cloud_models.DeleteResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubOK) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /hubs][%d] deleteHubOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteHubOK) GetPayload() *cloud_models.DeleteResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.DeleteResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubUnauthorized creates a DeleteHubUnauthorized with default headers values
|
||||||
|
func NewDeleteHubUnauthorized() *DeleteHubUnauthorized {
|
||||||
|
return &DeleteHubUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteHubUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access Unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type DeleteHubUnauthorized struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /hubs][%d] deleteHubUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteHubUnauthorized) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubForbidden creates a DeleteHubForbidden with default headers values
|
||||||
|
func NewDeleteHubForbidden() *DeleteHubForbidden {
|
||||||
|
return &DeleteHubForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteHubForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type DeleteHubForbidden struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /hubs][%d] deleteHubForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteHubForbidden) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubNotFound creates a DeleteHubNotFound with default headers values
|
||||||
|
func NewDeleteHubNotFound() *DeleteHubNotFound {
|
||||||
|
return &DeleteHubNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteHubNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type DeleteHubNotFound struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /hubs][%d] deleteHubNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteHubNotFound) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubUnprocessableEntity creates a DeleteHubUnprocessableEntity with default headers values
|
||||||
|
func NewDeleteHubUnprocessableEntity() *DeleteHubUnprocessableEntity {
|
||||||
|
return &DeleteHubUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteHubUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type DeleteHubUnprocessableEntity struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /hubs][%d] deleteHubUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteHubUnprocessableEntity) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteHubInternalServerError creates a DeleteHubInternalServerError with default headers values
|
||||||
|
func NewDeleteHubInternalServerError() *DeleteHubInternalServerError {
|
||||||
|
return &DeleteHubInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteHubInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type DeleteHubInternalServerError struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /hubs][%d] deleteHubInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteHubInternalServerError) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteHubInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,340 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetHubsParams creates a new GetHubsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetHubsParams() *GetHubsParams {
|
||||||
|
return &GetHubsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsParamsWithTimeout creates a new GetHubsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetHubsParamsWithTimeout(timeout time.Duration) *GetHubsParams {
|
||||||
|
return &GetHubsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsParamsWithContext creates a new GetHubsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetHubsParamsWithContext(ctx context.Context) *GetHubsParams {
|
||||||
|
return &GetHubsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsParamsWithHTTPClient creates a new GetHubsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetHubsParamsWithHTTPClient(client *http.Client) *GetHubsParams {
|
||||||
|
return &GetHubsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetHubsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get hubs operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetHubsParams struct {
|
||||||
|
|
||||||
|
/* AccountID.
|
||||||
|
|
||||||
|
Taxnexus Record Id of an Account
|
||||||
|
*/
|
||||||
|
AccountID *string
|
||||||
|
|
||||||
|
/* Active.
|
||||||
|
|
||||||
|
Retrieve active records?
|
||||||
|
*/
|
||||||
|
Active *bool
|
||||||
|
|
||||||
|
/* Email.
|
||||||
|
|
||||||
|
Email address?
|
||||||
|
*/
|
||||||
|
Email *string
|
||||||
|
|
||||||
|
/* Limit.
|
||||||
|
|
||||||
|
How many objects to return at one time
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Limit *int64
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
The Name of this Object
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
/* Offset.
|
||||||
|
|
||||||
|
How many objects to skip? (default 0)
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Offset *int64
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get hubs params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetHubsParams) WithDefaults() *GetHubsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get hubs params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetHubsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithTimeout(timeout time.Duration) *GetHubsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithContext(ctx context.Context) *GetHubsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithHTTPClient(client *http.Client) *GetHubsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAccountID adds the accountID to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithAccountID(accountID *string) *GetHubsParams {
|
||||||
|
o.SetAccountID(accountID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAccountID adds the accountId to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetAccountID(accountID *string) {
|
||||||
|
o.AccountID = accountID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithActive adds the active to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithActive(active *bool) *GetHubsParams {
|
||||||
|
o.SetActive(active)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetActive adds the active to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetActive(active *bool) {
|
||||||
|
o.Active = active
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithEmail adds the email to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithEmail(email *string) *GetHubsParams {
|
||||||
|
o.SetEmail(email)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEmail adds the email to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetEmail(email *string) {
|
||||||
|
o.Email = email
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithLimit(limit *int64) *GetHubsParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithName(name *string) *GetHubsParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOffset adds the offset to the get hubs params
|
||||||
|
func (o *GetHubsParams) WithOffset(offset *int64) *GetHubsParams {
|
||||||
|
o.SetOffset(offset)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOffset adds the offset to the get hubs params
|
||||||
|
func (o *GetHubsParams) SetOffset(offset *int64) {
|
||||||
|
o.Offset = offset
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetHubsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
|
||||||
|
// query param accountId
|
||||||
|
var qrAccountID string
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
qrAccountID = *o.AccountID
|
||||||
|
}
|
||||||
|
qAccountID := qrAccountID
|
||||||
|
if qAccountID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("accountId", qAccountID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
|
||||||
|
// query param active
|
||||||
|
var qrActive bool
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
qrActive = *o.Active
|
||||||
|
}
|
||||||
|
qActive := swag.FormatBool(qrActive)
|
||||||
|
if qActive != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("active", qActive); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
|
||||||
|
// query param email
|
||||||
|
var qrEmail string
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
qrEmail = *o.Email
|
||||||
|
}
|
||||||
|
qEmail := qrEmail
|
||||||
|
if qEmail != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("email", qEmail); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
|
||||||
|
// query param limit
|
||||||
|
var qrLimit int64
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
qrLimit = *o.Limit
|
||||||
|
}
|
||||||
|
qLimit := swag.FormatInt64(qrLimit)
|
||||||
|
if qLimit != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
|
||||||
|
// query param offset
|
||||||
|
var qrOffset int64
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
qrOffset = *o.Offset
|
||||||
|
}
|
||||||
|
qOffset := swag.FormatInt64(qrOffset)
|
||||||
|
if qOffset != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,278 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetHubsReader is a Reader for the GetHubs structure.
|
||||||
|
type GetHubsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetHubsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetHubsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetHubsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetHubsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetHubsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetHubsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetHubsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsOK creates a GetHubsOK with default headers values
|
||||||
|
func NewGetHubsOK() *GetHubsOK {
|
||||||
|
return &GetHubsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetHubsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Hub objects
|
||||||
|
*/
|
||||||
|
type GetHubsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *cloud_models.HubResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /hubs][%d] getHubsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetHubsOK) GetPayload() *cloud_models.HubResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.HubResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsUnauthorized creates a GetHubsUnauthorized with default headers values
|
||||||
|
func NewGetHubsUnauthorized() *GetHubsUnauthorized {
|
||||||
|
return &GetHubsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetHubsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access Unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetHubsUnauthorized struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /hubs][%d] getHubsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetHubsUnauthorized) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsForbidden creates a GetHubsForbidden with default headers values
|
||||||
|
func NewGetHubsForbidden() *GetHubsForbidden {
|
||||||
|
return &GetHubsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetHubsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetHubsForbidden struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /hubs][%d] getHubsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetHubsForbidden) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsNotFound creates a GetHubsNotFound with default headers values
|
||||||
|
func NewGetHubsNotFound() *GetHubsNotFound {
|
||||||
|
return &GetHubsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetHubsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetHubsNotFound struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /hubs][%d] getHubsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetHubsNotFound) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsUnprocessableEntity creates a GetHubsUnprocessableEntity with default headers values
|
||||||
|
func NewGetHubsUnprocessableEntity() *GetHubsUnprocessableEntity {
|
||||||
|
return &GetHubsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetHubsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetHubsUnprocessableEntity struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /hubs][%d] getHubsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetHubsUnprocessableEntity) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetHubsInternalServerError creates a GetHubsInternalServerError with default headers values
|
||||||
|
func NewGetHubsInternalServerError() *GetHubsInternalServerError {
|
||||||
|
return &GetHubsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetHubsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetHubsInternalServerError struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /hubs][%d] getHubsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetHubsInternalServerError) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetHubsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,215 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// 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 hub API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for hub API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
DeleteHub(params *DeleteHubParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteHubOK, error)
|
||||||
|
|
||||||
|
GetHubs(params *GetHubsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetHubsOK, error)
|
||||||
|
|
||||||
|
PostHubs(params *PostHubsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostHubsOK, error)
|
||||||
|
|
||||||
|
PutHub(params *PutHubParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutHubOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DeleteHub deletes an hub
|
||||||
|
|
||||||
|
Delete Telnexus Hub record
|
||||||
|
*/
|
||||||
|
func (a *Client) DeleteHub(params *DeleteHubParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteHubOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewDeleteHubParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "deleteHub",
|
||||||
|
Method: "DELETE",
|
||||||
|
PathPattern: "/hubs",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &DeleteHubReader{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.(*DeleteHubOK)
|
||||||
|
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 deleteHub: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetHubs gets a list of accounts
|
||||||
|
|
||||||
|
Return a list of all available Hubs
|
||||||
|
*/
|
||||||
|
func (a *Client) GetHubs(params *GetHubsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetHubsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetHubsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getHubs",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/hubs",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetHubsReader{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.(*GetHubsOK)
|
||||||
|
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 getHubs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PostHubs adds a new account to telnexus
|
||||||
|
|
||||||
|
Hub record to be added
|
||||||
|
*/
|
||||||
|
func (a *Client) PostHubs(params *PostHubsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostHubsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPostHubsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "postHubs",
|
||||||
|
Method: "POST",
|
||||||
|
PathPattern: "/hubs",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PostHubsReader{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.(*PostHubsOK)
|
||||||
|
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 postHubs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PutHub updates a single account
|
||||||
|
|
||||||
|
Update Hubs
|
||||||
|
*/
|
||||||
|
func (a *Client) PutHub(params *PutHubParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutHubOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPutHubParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "putHub",
|
||||||
|
Method: "PUT",
|
||||||
|
PathPattern: "/hubs",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PutHubReader{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.(*PutHubOK)
|
||||||
|
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 putHub: 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
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPostHubsParams creates a new PostHubsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPostHubsParams() *PostHubsParams {
|
||||||
|
return &PostHubsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsParamsWithTimeout creates a new PostHubsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPostHubsParamsWithTimeout(timeout time.Duration) *PostHubsParams {
|
||||||
|
return &PostHubsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsParamsWithContext creates a new PostHubsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPostHubsParamsWithContext(ctx context.Context) *PostHubsParams {
|
||||||
|
return &PostHubsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsParamsWithHTTPClient creates a new PostHubsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPostHubsParamsWithHTTPClient(client *http.Client) *PostHubsParams {
|
||||||
|
return &PostHubsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostHubsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the post hubs operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PostHubsParams struct {
|
||||||
|
|
||||||
|
/* HubRequest.
|
||||||
|
|
||||||
|
An array of new Hub records
|
||||||
|
*/
|
||||||
|
HubRequest *cloud_models.HubRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the post hubs params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostHubsParams) WithDefaults() *PostHubsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the post hubs params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostHubsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the post hubs params
|
||||||
|
func (o *PostHubsParams) WithTimeout(timeout time.Duration) *PostHubsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the post hubs params
|
||||||
|
func (o *PostHubsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the post hubs params
|
||||||
|
func (o *PostHubsParams) WithContext(ctx context.Context) *PostHubsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the post hubs params
|
||||||
|
func (o *PostHubsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the post hubs params
|
||||||
|
func (o *PostHubsParams) WithHTTPClient(client *http.Client) *PostHubsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the post hubs params
|
||||||
|
func (o *PostHubsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHubRequest adds the hubRequest to the post hubs params
|
||||||
|
func (o *PostHubsParams) WithHubRequest(hubRequest *cloud_models.HubRequest) *PostHubsParams {
|
||||||
|
o.SetHubRequest(hubRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHubRequest adds the hubRequest to the post hubs params
|
||||||
|
func (o *PostHubsParams) SetHubRequest(hubRequest *cloud_models.HubRequest) {
|
||||||
|
o.HubRequest = hubRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PostHubsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.HubRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.HubRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,278 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PostHubsReader is a Reader for the PostHubs structure.
|
||||||
|
type PostHubsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PostHubsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPostHubsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPostHubsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPostHubsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPostHubsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPostHubsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPostHubsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsOK creates a PostHubsOK with default headers values
|
||||||
|
func NewPostHubsOK() *PostHubsOK {
|
||||||
|
return &PostHubsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostHubsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Hub objects
|
||||||
|
*/
|
||||||
|
type PostHubsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *cloud_models.HubResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /hubs][%d] postHubsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostHubsOK) GetPayload() *cloud_models.HubResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.HubResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsUnauthorized creates a PostHubsUnauthorized with default headers values
|
||||||
|
func NewPostHubsUnauthorized() *PostHubsUnauthorized {
|
||||||
|
return &PostHubsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostHubsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access Unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PostHubsUnauthorized struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /hubs][%d] postHubsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostHubsUnauthorized) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsForbidden creates a PostHubsForbidden with default headers values
|
||||||
|
func NewPostHubsForbidden() *PostHubsForbidden {
|
||||||
|
return &PostHubsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostHubsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PostHubsForbidden struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /hubs][%d] postHubsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostHubsForbidden) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsNotFound creates a PostHubsNotFound with default headers values
|
||||||
|
func NewPostHubsNotFound() *PostHubsNotFound {
|
||||||
|
return &PostHubsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostHubsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PostHubsNotFound struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /hubs][%d] postHubsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostHubsNotFound) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsUnprocessableEntity creates a PostHubsUnprocessableEntity with default headers values
|
||||||
|
func NewPostHubsUnprocessableEntity() *PostHubsUnprocessableEntity {
|
||||||
|
return &PostHubsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostHubsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PostHubsUnprocessableEntity struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /hubs][%d] postHubsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostHubsUnprocessableEntity) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostHubsInternalServerError creates a PostHubsInternalServerError with default headers values
|
||||||
|
func NewPostHubsInternalServerError() *PostHubsInternalServerError {
|
||||||
|
return &PostHubsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostHubsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PostHubsInternalServerError struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /hubs][%d] postHubsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostHubsInternalServerError) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostHubsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPutHubParams creates a new PutHubParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPutHubParams() *PutHubParams {
|
||||||
|
return &PutHubParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubParamsWithTimeout creates a new PutHubParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPutHubParamsWithTimeout(timeout time.Duration) *PutHubParams {
|
||||||
|
return &PutHubParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubParamsWithContext creates a new PutHubParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPutHubParamsWithContext(ctx context.Context) *PutHubParams {
|
||||||
|
return &PutHubParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubParamsWithHTTPClient creates a new PutHubParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPutHubParamsWithHTTPClient(client *http.Client) *PutHubParams {
|
||||||
|
return &PutHubParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutHubParams contains all the parameters to send to the API endpoint
|
||||||
|
for the put hub operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PutHubParams struct {
|
||||||
|
|
||||||
|
/* HubRequest.
|
||||||
|
|
||||||
|
An array of new Hub records
|
||||||
|
*/
|
||||||
|
HubRequest *cloud_models.HubRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the put hub params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutHubParams) WithDefaults() *PutHubParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the put hub params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutHubParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the put hub params
|
||||||
|
func (o *PutHubParams) WithTimeout(timeout time.Duration) *PutHubParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the put hub params
|
||||||
|
func (o *PutHubParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the put hub params
|
||||||
|
func (o *PutHubParams) WithContext(ctx context.Context) *PutHubParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the put hub params
|
||||||
|
func (o *PutHubParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the put hub params
|
||||||
|
func (o *PutHubParams) WithHTTPClient(client *http.Client) *PutHubParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the put hub params
|
||||||
|
func (o *PutHubParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHubRequest adds the hubRequest to the put hub params
|
||||||
|
func (o *PutHubParams) WithHubRequest(hubRequest *cloud_models.HubRequest) *PutHubParams {
|
||||||
|
o.SetHubRequest(hubRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHubRequest adds the hubRequest to the put hub params
|
||||||
|
func (o *PutHubParams) SetHubRequest(hubRequest *cloud_models.HubRequest) {
|
||||||
|
o.HubRequest = hubRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PutHubParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.HubRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.HubRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,278 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package hub
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PutHubReader is a Reader for the PutHub structure.
|
||||||
|
type PutHubReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PutHubReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPutHubOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPutHubUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPutHubForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPutHubNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPutHubUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPutHubInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubOK creates a PutHubOK with default headers values
|
||||||
|
func NewPutHubOK() *PutHubOK {
|
||||||
|
return &PutHubOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutHubOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Hub objects
|
||||||
|
*/
|
||||||
|
type PutHubOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *cloud_models.HubResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubOK) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /hubs][%d] putHubOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutHubOK) GetPayload() *cloud_models.HubResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.HubResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubUnauthorized creates a PutHubUnauthorized with default headers values
|
||||||
|
func NewPutHubUnauthorized() *PutHubUnauthorized {
|
||||||
|
return &PutHubUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutHubUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access Unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PutHubUnauthorized struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /hubs][%d] putHubUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutHubUnauthorized) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubForbidden creates a PutHubForbidden with default headers values
|
||||||
|
func NewPutHubForbidden() *PutHubForbidden {
|
||||||
|
return &PutHubForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutHubForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PutHubForbidden struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /hubs][%d] putHubForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutHubForbidden) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubNotFound creates a PutHubNotFound with default headers values
|
||||||
|
func NewPutHubNotFound() *PutHubNotFound {
|
||||||
|
return &PutHubNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutHubNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PutHubNotFound struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /hubs][%d] putHubNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutHubNotFound) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubUnprocessableEntity creates a PutHubUnprocessableEntity with default headers values
|
||||||
|
func NewPutHubUnprocessableEntity() *PutHubUnprocessableEntity {
|
||||||
|
return &PutHubUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutHubUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PutHubUnprocessableEntity struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /hubs][%d] putHubUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutHubUnprocessableEntity) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutHubInternalServerError creates a PutHubInternalServerError with default headers values
|
||||||
|
func NewPutHubInternalServerError() *PutHubInternalServerError {
|
||||||
|
return &PutHubInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutHubInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PutHubInternalServerError struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /hubs][%d] putHubInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutHubInternalServerError) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutHubInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetUsersParams creates a new GetUsersParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetUsersParams() *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersParamsWithTimeout creates a new GetUsersParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersParamsWithContext creates a new GetUsersParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams {
|
||||||
|
return &GetUsersParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get users operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetUsersParams struct {
|
||||||
|
|
||||||
|
/* Apikey.
|
||||||
|
|
||||||
|
Service account or developer API key
|
||||||
|
*/
|
||||||
|
Apikey *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get users params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetUsersParams) WithDefaults() *GetUsersParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get users params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetUsersParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get users params
|
||||||
|
func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get users params
|
||||||
|
func (o *GetUsersParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get users params
|
||||||
|
func (o *GetUsersParams) WithContext(ctx context.Context) *GetUsersParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get users params
|
||||||
|
func (o *GetUsersParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get users params
|
||||||
|
func (o *GetUsersParams) WithHTTPClient(client *http.Client) *GetUsersParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get users params
|
||||||
|
func (o *GetUsersParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithApikey adds the apikey to the get users params
|
||||||
|
func (o *GetUsersParams) WithApikey(apikey *string) *GetUsersParams {
|
||||||
|
o.SetApikey(apikey)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetApikey adds the apikey to the get users params
|
||||||
|
func (o *GetUsersParams) SetApikey(apikey *string) {
|
||||||
|
o.Apikey = apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.Apikey != nil {
|
||||||
|
|
||||||
|
// query param apikey
|
||||||
|
var qrApikey string
|
||||||
|
|
||||||
|
if o.Apikey != nil {
|
||||||
|
qrApikey = *o.Apikey
|
||||||
|
}
|
||||||
|
qApikey := qrApikey
|
||||||
|
if qApikey != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("apikey", qApikey); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,261 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// 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"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/cloud/cloud_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetUsersReader is a Reader for the GetUsers structure.
|
||||||
|
type GetUsersReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetUsersOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetUsersUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetUsersForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetUsersNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetUsersUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetUsersInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersOK creates a GetUsersOK with default headers values
|
||||||
|
func NewGetUsersOK() *GetUsersOK {
|
||||||
|
return &GetUsersOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Taxnexus Response with User objects
|
||||||
|
*/
|
||||||
|
type GetUsersOK struct {
|
||||||
|
Payload *cloud_models.UserResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersOK) GetPayload() *cloud_models.UserResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.UserResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersUnauthorized creates a GetUsersUnauthorized with default headers values
|
||||||
|
func NewGetUsersUnauthorized() *GetUsersUnauthorized {
|
||||||
|
return &GetUsersUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access Unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetUsersUnauthorized struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersUnauthorized) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersForbidden creates a GetUsersForbidden with default headers values
|
||||||
|
func NewGetUsersForbidden() *GetUsersForbidden {
|
||||||
|
return &GetUsersForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetUsersForbidden struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersForbidden) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersNotFound creates a GetUsersNotFound with default headers values
|
||||||
|
func NewGetUsersNotFound() *GetUsersNotFound {
|
||||||
|
return &GetUsersNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetUsersNotFound struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersNotFound) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersUnprocessableEntity creates a GetUsersUnprocessableEntity with default headers values
|
||||||
|
func NewGetUsersUnprocessableEntity() *GetUsersUnprocessableEntity {
|
||||||
|
return &GetUsersUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetUsersUnprocessableEntity struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersUnprocessableEntity) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetUsersInternalServerError creates a GetUsersInternalServerError with default headers values
|
||||||
|
func NewGetUsersInternalServerError() *GetUsersInternalServerError {
|
||||||
|
return &GetUsersInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetUsersInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetUsersInternalServerError struct {
|
||||||
|
Payload *cloud_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetUsersInternalServerError) GetPayload() *cloud_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetUsersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(cloud_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetUsers checks API key
|
||||||
|
|
||||||
|
Checks for a valid API key, and returns full user record
|
||||||
|
*/
|
||||||
|
func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetUsersParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getUsers",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/users",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetUsersReader{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.(*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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransport changes the transport on the client
|
||||||
|
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||||
|
a.transport = transport
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Address address
|
||||||
|
//
|
||||||
|
// swagger:model Address
|
||||||
|
type Address struct {
|
||||||
|
|
||||||
|
// City
|
||||||
|
City string `json:"City,omitempty"`
|
||||||
|
|
||||||
|
// Country full name
|
||||||
|
Country string `json:"Country,omitempty"`
|
||||||
|
|
||||||
|
// Country Code
|
||||||
|
CountryCode string `json:"CountryCode,omitempty"`
|
||||||
|
|
||||||
|
// Postal Code
|
||||||
|
PostalCode string `json:"PostalCode,omitempty"`
|
||||||
|
|
||||||
|
// State full name
|
||||||
|
State string `json:"State,omitempty"`
|
||||||
|
|
||||||
|
// State Code
|
||||||
|
StateCode string `json:"StateCode,omitempty"`
|
||||||
|
|
||||||
|
// Street number and name
|
||||||
|
Street string `json:"Street,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this address
|
||||||
|
func (m *Address) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this address based on context it is used
|
||||||
|
func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *Address) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *Address) UnmarshalBinary(b []byte) error {
|
||||||
|
var res Address
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteResponse delete response
|
||||||
|
//
|
||||||
|
// swagger:model DeleteResponse
|
||||||
|
type DeleteResponse struct {
|
||||||
|
|
||||||
|
// data
|
||||||
|
Data []*Message `json:"Data"`
|
||||||
|
|
||||||
|
// meta
|
||||||
|
Meta *ResponseMeta `json:"Meta,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this delete response
|
||||||
|
func (m *DeleteResponse) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateData(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateMeta(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DeleteResponse) validateData(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Data) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
if swag.IsZero(m.Data[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Meta) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validate this delete response based on the context it is used
|
||||||
|
func (m *DeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateMeta(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DeleteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *DeleteResponse) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *DeleteResponse) UnmarshalBinary(b []byte) error {
|
||||||
|
var res DeleteResponse
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Error error
|
||||||
|
//
|
||||||
|
// swagger:model Error
|
||||||
|
type Error struct {
|
||||||
|
|
||||||
|
// code
|
||||||
|
Code int32 `json:"Code,omitempty"`
|
||||||
|
|
||||||
|
// fields
|
||||||
|
Fields string `json:"Fields,omitempty"`
|
||||||
|
|
||||||
|
// message
|
||||||
|
Message string `json:"Message,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this error
|
||||||
|
func (m *Error) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this error based on context it is used
|
||||||
|
func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *Error) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *Error) UnmarshalBinary(b []byte) error {
|
||||||
|
var res Error
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Hub hub
|
||||||
|
//
|
||||||
|
// swagger:model Hub
|
||||||
|
type Hub struct {
|
||||||
|
|
||||||
|
// Account
|
||||||
|
AccountID string `json:"AccountID,omitempty"`
|
||||||
|
|
||||||
|
// Billing Contact
|
||||||
|
BillingContactID string `json:"BillingContactID,omitempty"`
|
||||||
|
|
||||||
|
// Contact
|
||||||
|
ContactID string `json:"ContactID,omitempty"`
|
||||||
|
|
||||||
|
// Created By
|
||||||
|
CreatedByID string `json:"CreatedById,omitempty"`
|
||||||
|
|
||||||
|
// Created Date
|
||||||
|
CreatedDate string `json:"CreatedDate,omitempty"`
|
||||||
|
|
||||||
|
// Current Users
|
||||||
|
CurrentUsers float64 `json:"CurrentUsers,omitempty"`
|
||||||
|
|
||||||
|
// Record Id
|
||||||
|
ID string `json:"ID,omitempty"`
|
||||||
|
|
||||||
|
// Last Modified By
|
||||||
|
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
|
||||||
|
|
||||||
|
// Last Modifed Date
|
||||||
|
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
|
||||||
|
|
||||||
|
// Max Users
|
||||||
|
MaxUsers float64 `json:"MaxUsers,omitempty"`
|
||||||
|
|
||||||
|
// Hub Name
|
||||||
|
Name string `json:"Name,omitempty"`
|
||||||
|
|
||||||
|
// Order Item
|
||||||
|
OrderItem string `json:"OrderItem,omitempty"`
|
||||||
|
|
||||||
|
// Vendor
|
||||||
|
VendorID string `json:"VendorID,omitempty"`
|
||||||
|
|
||||||
|
// Vendor Tenant ID
|
||||||
|
VendorTenantID string `json:"VendorTenantID,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this hub
|
||||||
|
func (m *Hub) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this hub based on context it is used
|
||||||
|
func (m *Hub) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *Hub) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *Hub) UnmarshalBinary(b []byte) error {
|
||||||
|
var res Hub
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HubRequest An array of Hub objects
|
||||||
|
//
|
||||||
|
// swagger:model HubRequest
|
||||||
|
type HubRequest struct {
|
||||||
|
|
||||||
|
// data
|
||||||
|
Data []*Hub `json:"Data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this hub request
|
||||||
|
func (m *HubRequest) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateData(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HubRequest) validateData(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Data) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
if swag.IsZero(m.Data[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validate this hub request based on the context it is used
|
||||||
|
func (m *HubRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HubRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *HubRequest) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *HubRequest) UnmarshalBinary(b []byte) error {
|
||||||
|
var res HubRequest
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HubResponse An array of Hub objects
|
||||||
|
//
|
||||||
|
// swagger:model HubResponse
|
||||||
|
type HubResponse struct {
|
||||||
|
|
||||||
|
// data
|
||||||
|
Data []*Hub `json:"Data"`
|
||||||
|
|
||||||
|
// meta
|
||||||
|
Meta *ResponseMeta `json:"Meta,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this hub response
|
||||||
|
func (m *HubResponse) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateData(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateMeta(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HubResponse) validateData(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Data) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
if swag.IsZero(m.Data[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HubResponse) validateMeta(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Meta) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validate this hub response based on the context it is used
|
||||||
|
func (m *HubResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateMeta(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HubResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HubResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *HubResponse) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *HubResponse) UnmarshalBinary(b []byte) error {
|
||||||
|
var res HubResponse
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Message message
|
||||||
|
//
|
||||||
|
// swagger:model Message
|
||||||
|
type Message struct {
|
||||||
|
|
||||||
|
// message
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
|
|
||||||
|
// ref
|
||||||
|
Ref string `json:"ref,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this message
|
||||||
|
func (m *Message) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this message based on context it is used
|
||||||
|
func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *Message) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *Message) UnmarshalBinary(b []byte) error {
|
||||||
|
var res Message
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ResponseMeta response meta
|
||||||
|
//
|
||||||
|
// swagger:model ResponseMeta
|
||||||
|
type ResponseMeta struct {
|
||||||
|
|
||||||
|
// Microservice Contact Info
|
||||||
|
Contact string `json:"Contact,omitempty"`
|
||||||
|
|
||||||
|
// Copyright Info
|
||||||
|
Copyright string `json:"Copyright,omitempty"`
|
||||||
|
|
||||||
|
// License Information and Restrictions
|
||||||
|
License string `json:"License,omitempty"`
|
||||||
|
|
||||||
|
// Operation ID
|
||||||
|
OperationID string `json:"OperationID,omitempty"`
|
||||||
|
|
||||||
|
// Request IP Address
|
||||||
|
RequestIP string `json:"RequestIP,omitempty"`
|
||||||
|
|
||||||
|
// Request Type
|
||||||
|
RequestType string `json:"RequestType,omitempty"`
|
||||||
|
|
||||||
|
// Request URL
|
||||||
|
RequestURL string `json:"RequestURL,omitempty"`
|
||||||
|
|
||||||
|
// Data Server Info
|
||||||
|
ServerInfo string `json:"ServerInfo,omitempty"`
|
||||||
|
|
||||||
|
// Data Server Response Time (ms)
|
||||||
|
ServerResponseTime string `json:"ServerResponseTime,omitempty"`
|
||||||
|
|
||||||
|
// Backend Server Timestamp
|
||||||
|
ServerTimestamp string `json:"ServerTimestamp,omitempty"`
|
||||||
|
|
||||||
|
// Taxnexus Account Number used for recording transactions
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this response meta
|
||||||
|
func (m *ResponseMeta) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this response meta based on context it is used
|
||||||
|
func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *ResponseMeta) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *ResponseMeta) UnmarshalBinary(b []byte) error {
|
||||||
|
var res ResponseMeta
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TenantUser Relationship object that connects users to a tenant
|
||||||
|
//
|
||||||
|
// swagger:model TenantUser
|
||||||
|
type TenantUser struct {
|
||||||
|
|
||||||
|
// The makeTenantUser access level for this User
|
||||||
|
AccessLevel string `json:"AccessLevel,omitempty"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID string `json:"AccountID,omitempty"`
|
||||||
|
|
||||||
|
// Auth0 User ID
|
||||||
|
Auth0UserID string `json:"Auth0UserID,omitempty"`
|
||||||
|
|
||||||
|
// Account Name
|
||||||
|
CompanyName string `json:"CompanyName,omitempty"`
|
||||||
|
|
||||||
|
// Contact ID
|
||||||
|
ContactID string `json:"ContactID,omitempty"`
|
||||||
|
|
||||||
|
// Taxnexus Account
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
|
||||||
|
// Tenant active?
|
||||||
|
TenantActive bool `json:"TenantActive,omitempty"`
|
||||||
|
|
||||||
|
// The Tenant ID
|
||||||
|
TenantID string `json:"TenantID,omitempty"`
|
||||||
|
|
||||||
|
// Tenant Name
|
||||||
|
TenantName string `json:"TenantName,omitempty"`
|
||||||
|
|
||||||
|
// Tenant Status
|
||||||
|
TenantStatus string `json:"TenantStatus,omitempty"`
|
||||||
|
|
||||||
|
// Tenant type
|
||||||
|
TenantType string `json:"TenantType,omitempty"`
|
||||||
|
|
||||||
|
// Tenant Version
|
||||||
|
TenantVersion string `json:"TenantVersion,omitempty"`
|
||||||
|
|
||||||
|
// User Email Address
|
||||||
|
UserEmail string `json:"UserEmail,omitempty"`
|
||||||
|
|
||||||
|
// User Full Name
|
||||||
|
UserFullName string `json:"UserFullName,omitempty"`
|
||||||
|
|
||||||
|
// The User ID
|
||||||
|
UserID string `json:"UserID,omitempty"`
|
||||||
|
|
||||||
|
// Username
|
||||||
|
Username string `json:"Username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this tenant user
|
||||||
|
func (m *TenantUser) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this tenant user based on context it is used
|
||||||
|
func (m *TenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *TenantUser) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *TenantUser) UnmarshalBinary(b []byte) error {
|
||||||
|
var res TenantUser
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,376 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// User user
|
||||||
|
//
|
||||||
|
// swagger:model User
|
||||||
|
type User struct {
|
||||||
|
|
||||||
|
// API Key
|
||||||
|
APIKey string `json:"APIKey,omitempty"`
|
||||||
|
|
||||||
|
// About Me
|
||||||
|
AboutMe string `json:"AboutMe,omitempty"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
AccountID string `json:"AccountID,omitempty"`
|
||||||
|
|
||||||
|
// address
|
||||||
|
Address *Address `json:"Address,omitempty"`
|
||||||
|
|
||||||
|
// Alias
|
||||||
|
Alias string `json:"Alias,omitempty"`
|
||||||
|
|
||||||
|
// Auth0 User Id
|
||||||
|
Auth0UserID string `json:"Auth0UserID,omitempty"`
|
||||||
|
|
||||||
|
// Nickname
|
||||||
|
CommunityNickname string `json:"CommunityNickname,omitempty"`
|
||||||
|
|
||||||
|
// Company Name
|
||||||
|
CompanyName string `json:"CompanyName,omitempty"`
|
||||||
|
|
||||||
|
// Contact
|
||||||
|
ContactID string `json:"ContactID,omitempty"`
|
||||||
|
|
||||||
|
// Created User ID
|
||||||
|
CreatedByID string `json:"CreatedByID,omitempty"`
|
||||||
|
|
||||||
|
// Date Created
|
||||||
|
CreatedDate string `json:"CreatedDate,omitempty"`
|
||||||
|
|
||||||
|
// Delegated Approver
|
||||||
|
DelegatedApproverID string `json:"DelegatedApproverID,omitempty"`
|
||||||
|
|
||||||
|
// Department
|
||||||
|
Department string `json:"Department,omitempty"`
|
||||||
|
|
||||||
|
// Division
|
||||||
|
Division string `json:"Division,omitempty"`
|
||||||
|
|
||||||
|
// Email address
|
||||||
|
Email string `json:"Email,omitempty"`
|
||||||
|
|
||||||
|
// Employee Number
|
||||||
|
EmployeeNumber string `json:"EmployeeNumber,omitempty"`
|
||||||
|
|
||||||
|
// Time day ends
|
||||||
|
EndOfDay string `json:"EndOfDay,omitempty"`
|
||||||
|
|
||||||
|
// Environment
|
||||||
|
Environment string `json:"Environment,omitempty"`
|
||||||
|
|
||||||
|
// Extension
|
||||||
|
Extension string `json:"Extension,omitempty"`
|
||||||
|
|
||||||
|
// Fabric API Key
|
||||||
|
FabricAPIKey string `json:"FabricAPIKey,omitempty"`
|
||||||
|
|
||||||
|
// Fax
|
||||||
|
Fax string `json:"Fax,omitempty"`
|
||||||
|
|
||||||
|
// The first name
|
||||||
|
FirstName string `json:"FirstName,omitempty"`
|
||||||
|
|
||||||
|
// Allow Forecasting
|
||||||
|
ForecastEnabled bool `json:"ForecastEnabled,omitempty"`
|
||||||
|
|
||||||
|
// Full Photo URL
|
||||||
|
FullPhotoURL string `json:"FullPhotoURL,omitempty"`
|
||||||
|
|
||||||
|
// Taxnexus ID
|
||||||
|
ID string `json:"ID,omitempty"`
|
||||||
|
|
||||||
|
// Active
|
||||||
|
IsActive bool `json:"IsActive,omitempty"`
|
||||||
|
|
||||||
|
// Is the user enabled for Communities?
|
||||||
|
IsPortalEnabled bool `json:"IsPortalEnabled,omitempty"`
|
||||||
|
|
||||||
|
// Has Profile Photo
|
||||||
|
IsProphilePhotoActive bool `json:"IsProphilePhotoActive,omitempty"`
|
||||||
|
|
||||||
|
// is system controlled
|
||||||
|
IsSystemControlled bool `json:"IsSystemControlled,omitempty"`
|
||||||
|
|
||||||
|
// IP address of last login
|
||||||
|
LastIP string `json:"LastIP,omitempty"`
|
||||||
|
|
||||||
|
// Last login time
|
||||||
|
LastLogin string `json:"LastLogin,omitempty"`
|
||||||
|
|
||||||
|
// Last Modified User ID
|
||||||
|
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
|
||||||
|
|
||||||
|
// Last Modified Date
|
||||||
|
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
|
||||||
|
|
||||||
|
// The Last Name
|
||||||
|
LastName string `json:"LastName,omitempty"`
|
||||||
|
|
||||||
|
// Number of times user has logged in
|
||||||
|
LoginCount int64 `json:"LoginCount,omitempty"`
|
||||||
|
|
||||||
|
// Manager
|
||||||
|
ManagerID string `json:"ManagerID,omitempty"`
|
||||||
|
|
||||||
|
// Mobile
|
||||||
|
MobilePhone string `json:"MobilePhone,omitempty"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"Name,omitempty"`
|
||||||
|
|
||||||
|
// Out of office message
|
||||||
|
OutOfOfficeMessage string `json:"OutOfOfficeMessage,omitempty"`
|
||||||
|
|
||||||
|
// Phone
|
||||||
|
Phone string `json:"Phone,omitempty"`
|
||||||
|
|
||||||
|
// Portal Role Level
|
||||||
|
PortalRole string `json:"PortalRole,omitempty"`
|
||||||
|
|
||||||
|
// Profile
|
||||||
|
ProfileID string `json:"ProfileID,omitempty"`
|
||||||
|
|
||||||
|
// Info Emails
|
||||||
|
ReceivesAdminEmails bool `json:"ReceivesAdminEmails,omitempty"`
|
||||||
|
|
||||||
|
// Admin Info Emails
|
||||||
|
ReceivesAdminInfoEmails bool `json:"ReceivesAdminInfoEmails,omitempty"`
|
||||||
|
|
||||||
|
// Email Sender Address
|
||||||
|
SenderEmail string `json:"SenderEmail,omitempty"`
|
||||||
|
|
||||||
|
// Email Sender Name
|
||||||
|
SenderName string `json:"SenderName,omitempty"`
|
||||||
|
|
||||||
|
// Email Signature
|
||||||
|
Signature string `json:"Signature,omitempty"`
|
||||||
|
|
||||||
|
// Small Photo URL
|
||||||
|
SmallPhotoURL string `json:"SmallPhotoURL,omitempty"`
|
||||||
|
|
||||||
|
// The time day starts
|
||||||
|
StartOfDay string `json:"StartOfDay,omitempty"`
|
||||||
|
|
||||||
|
// Taxnexus Account
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
|
||||||
|
// Tenant ID associated with this user
|
||||||
|
TenantID string `json:"TenantID,omitempty"`
|
||||||
|
|
||||||
|
// tenant users
|
||||||
|
TenantUsers []*TenantUser `json:"TenantUsers"`
|
||||||
|
|
||||||
|
// Time Zone
|
||||||
|
TimeZone string `json:"TimeZone,omitempty"`
|
||||||
|
|
||||||
|
// Title
|
||||||
|
Title string `json:"Title,omitempty"`
|
||||||
|
|
||||||
|
// Role
|
||||||
|
UserRoleID string `json:"UserRoleID,omitempty"`
|
||||||
|
|
||||||
|
// user roles
|
||||||
|
UserRoles []*UserRole `json:"UserRoles"`
|
||||||
|
|
||||||
|
// User Type
|
||||||
|
UserType string `json:"UserType,omitempty"`
|
||||||
|
|
||||||
|
// Username
|
||||||
|
Username string `json:"Username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this user
|
||||||
|
func (m *User) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateAddress(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateTenantUsers(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateUserRoles(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) validateAddress(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Address) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Address != nil {
|
||||||
|
if err := m.Address.Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Address")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) validateTenantUsers(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.TenantUsers) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.TenantUsers); i++ {
|
||||||
|
if swag.IsZero(m.TenantUsers[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.TenantUsers[i] != nil {
|
||||||
|
if err := m.TenantUsers[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) validateUserRoles(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.UserRoles) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.UserRoles); i++ {
|
||||||
|
if swag.IsZero(m.UserRoles[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.UserRoles[i] != nil {
|
||||||
|
if err := m.UserRoles[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validate this user based on the context it is used
|
||||||
|
func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateAddress(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateTenantUsers(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateUserRoles(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if m.Address != nil {
|
||||||
|
if err := m.Address.ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Address")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.TenantUsers); i++ {
|
||||||
|
|
||||||
|
if m.TenantUsers[i] != nil {
|
||||||
|
if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *User) contextValidateUserRoles(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.UserRoles); i++ {
|
||||||
|
|
||||||
|
if m.UserRoles[i] != nil {
|
||||||
|
if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *User) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *User) UnmarshalBinary(b []byte) error {
|
||||||
|
var res User
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserResponse An array Taxnexus user objects
|
||||||
|
//
|
||||||
|
// swagger:model UserResponse
|
||||||
|
type UserResponse struct {
|
||||||
|
|
||||||
|
// data
|
||||||
|
Data []*User `json:"Data"`
|
||||||
|
|
||||||
|
// meta
|
||||||
|
Meta *ResponseMeta `json:"Meta,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this user response
|
||||||
|
func (m *UserResponse) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateData(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateMeta(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) validateData(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Data) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
if swag.IsZero(m.Data[i]) { // not required
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) validateMeta(formats strfmt.Registry) error {
|
||||||
|
if swag.IsZero(m.Meta) { // not required
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.Validate(formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validate this user response based on the context it is used
|
||||||
|
func (m *UserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.contextValidateData(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.contextValidateMeta(ctx, formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
for i := 0; i < len(m.Data); i++ {
|
||||||
|
|
||||||
|
if m.Data[i] != nil {
|
||||||
|
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Data" + "." + strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if m.Meta != nil {
|
||||||
|
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
|
||||||
|
if ve, ok := err.(*errors.Validation); ok {
|
||||||
|
return ve.ValidateName("Meta")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *UserResponse) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *UserResponse) UnmarshalBinary(b []byte) error {
|
||||||
|
var res UserResponse
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cloud_models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserRole Relationship object that connects user to a role
|
||||||
|
//
|
||||||
|
// swagger:model UserRole
|
||||||
|
type UserRole struct {
|
||||||
|
|
||||||
|
// Account Id
|
||||||
|
AccountID string `json:"AccountID,omitempty"`
|
||||||
|
|
||||||
|
// Linked role ID
|
||||||
|
Auth0RoleID string `json:"Auth0RoleID,omitempty"`
|
||||||
|
|
||||||
|
// Auth0 User ID
|
||||||
|
Auth0UserID string `json:"Auth0UserID,omitempty"`
|
||||||
|
|
||||||
|
// Company Name
|
||||||
|
CompanyName string `json:"CompanyName,omitempty"`
|
||||||
|
|
||||||
|
// Contact ID
|
||||||
|
ContactID string `json:"ContactID,omitempty"`
|
||||||
|
|
||||||
|
// Role description
|
||||||
|
RoleDescription string `json:"RoleDescription,omitempty"`
|
||||||
|
|
||||||
|
// The Role ID
|
||||||
|
RoleID string `json:"RoleID,omitempty"`
|
||||||
|
|
||||||
|
// Role Name
|
||||||
|
RoleName string `json:"RoleName,omitempty"`
|
||||||
|
|
||||||
|
// Taxnexus Account Number
|
||||||
|
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
|
||||||
|
|
||||||
|
// User Email Address
|
||||||
|
UserEmail string `json:"UserEmail,omitempty"`
|
||||||
|
|
||||||
|
// User Full Name
|
||||||
|
UserFullName string `json:"UserFullName,omitempty"`
|
||||||
|
|
||||||
|
// The User ID
|
||||||
|
UserID string `json:"UserID,omitempty"`
|
||||||
|
|
||||||
|
// Username
|
||||||
|
Username string `json:"Username,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this user role
|
||||||
|
func (m *UserRole) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this user role based on context it is used
|
||||||
|
func (m *UserRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *UserRole) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *UserRole) UnmarshalBinary(b []byte) error {
|
||||||
|
var res UserRole
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,258 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// 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 accounts API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for accounts API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error)
|
||||||
|
|
||||||
|
GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error)
|
||||||
|
|
||||||
|
GetAccountsObservable(params *GetAccountsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsObservableOK, error)
|
||||||
|
|
||||||
|
PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error)
|
||||||
|
|
||||||
|
PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DeleteAccount deletes an account
|
||||||
|
|
||||||
|
Delete Telnexus Account record
|
||||||
|
*/
|
||||||
|
func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewDeleteAccountParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "deleteAccount",
|
||||||
|
Method: "DELETE",
|
||||||
|
PathPattern: "/accounts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &DeleteAccountReader{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.(*DeleteAccountOK)
|
||||||
|
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 deleteAccount: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetAccounts gets a list of accounts
|
||||||
|
|
||||||
|
Return a list of all available Accounts
|
||||||
|
*/
|
||||||
|
func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetAccountsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getAccounts",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/accounts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetAccountsReader{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.(*GetAccountsOK)
|
||||||
|
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 getAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetAccountsObservable gets telnexus accounts in an observable array
|
||||||
|
|
||||||
|
A list of accounts in a simple JSON array
|
||||||
|
*/
|
||||||
|
func (a *Client) GetAccountsObservable(params *GetAccountsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsObservableOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetAccountsObservableParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getAccountsObservable",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/accounts/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetAccountsObservableReader{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.(*GetAccountsObservableOK)
|
||||||
|
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 getAccountsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PostAccounts adds a new account to telnexus
|
||||||
|
|
||||||
|
Account record to be added
|
||||||
|
*/
|
||||||
|
func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPostAccountsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "postAccounts",
|
||||||
|
Method: "POST",
|
||||||
|
PathPattern: "/accounts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PostAccountsReader{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.(*PostAccountsOK)
|
||||||
|
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 postAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PutAccount updates a single account
|
||||||
|
|
||||||
|
Update a single account specified by accountId
|
||||||
|
*/
|
||||||
|
func (a *Client) PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPutAccountParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "putAccount",
|
||||||
|
Method: "PUT",
|
||||||
|
PathPattern: "/accounts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PutAccountReader{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.(*PutAccountOK)
|
||||||
|
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 putAccount: 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
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewDeleteAccountParams creates a new DeleteAccountParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewDeleteAccountParams() *DeleteAccountParams {
|
||||||
|
return &DeleteAccountParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountParamsWithTimeout creates a new DeleteAccountParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewDeleteAccountParamsWithTimeout(timeout time.Duration) *DeleteAccountParams {
|
||||||
|
return &DeleteAccountParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountParamsWithContext creates a new DeleteAccountParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewDeleteAccountParamsWithContext(ctx context.Context) *DeleteAccountParams {
|
||||||
|
return &DeleteAccountParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountParamsWithHTTPClient creates a new DeleteAccountParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewDeleteAccountParamsWithHTTPClient(client *http.Client) *DeleteAccountParams {
|
||||||
|
return &DeleteAccountParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteAccountParams contains all the parameters to send to the API endpoint
|
||||||
|
for the delete account operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type DeleteAccountParams struct {
|
||||||
|
|
||||||
|
/* AccountID.
|
||||||
|
|
||||||
|
Telnexus Record Id of an Account
|
||||||
|
*/
|
||||||
|
AccountID *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the delete account params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteAccountParams) WithDefaults() *DeleteAccountParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the delete account params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteAccountParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the delete account params
|
||||||
|
func (o *DeleteAccountParams) WithTimeout(timeout time.Duration) *DeleteAccountParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the delete account params
|
||||||
|
func (o *DeleteAccountParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the delete account params
|
||||||
|
func (o *DeleteAccountParams) WithContext(ctx context.Context) *DeleteAccountParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the delete account params
|
||||||
|
func (o *DeleteAccountParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the delete account params
|
||||||
|
func (o *DeleteAccountParams) WithHTTPClient(client *http.Client) *DeleteAccountParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the delete account params
|
||||||
|
func (o *DeleteAccountParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAccountID adds the accountID to the delete account params
|
||||||
|
func (o *DeleteAccountParams) WithAccountID(accountID *string) *DeleteAccountParams {
|
||||||
|
o.SetAccountID(accountID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAccountID adds the accountId to the delete account params
|
||||||
|
func (o *DeleteAccountParams) SetAccountID(accountID *string) {
|
||||||
|
o.AccountID = accountID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *DeleteAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
|
||||||
|
// query param accountId
|
||||||
|
var qrAccountID string
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
qrAccountID = *o.AccountID
|
||||||
|
}
|
||||||
|
qAccountID := qrAccountID
|
||||||
|
if qAccountID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("accountId", qAccountID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,315 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteAccountReader is a Reader for the DeleteAccount structure.
|
||||||
|
type DeleteAccountReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewDeleteAccountOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewDeleteAccountUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewDeleteAccountForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewDeleteAccountNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewDeleteAccountUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewDeleteAccountInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountOK creates a DeleteAccountOK with default headers values
|
||||||
|
func NewDeleteAccountOK() *DeleteAccountOK {
|
||||||
|
return &DeleteAccountOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteAccountOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Message Objects with Delete Status
|
||||||
|
*/
|
||||||
|
type DeleteAccountOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.DeleteResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountOK) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteAccountOK) GetPayload() *crm_models.DeleteResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.DeleteResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountUnauthorized creates a DeleteAccountUnauthorized with default headers values
|
||||||
|
func NewDeleteAccountUnauthorized() *DeleteAccountUnauthorized {
|
||||||
|
return &DeleteAccountUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteAccountUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type DeleteAccountUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteAccountUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountForbidden creates a DeleteAccountForbidden with default headers values
|
||||||
|
func NewDeleteAccountForbidden() *DeleteAccountForbidden {
|
||||||
|
return &DeleteAccountForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteAccountForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type DeleteAccountForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteAccountForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountNotFound creates a DeleteAccountNotFound with default headers values
|
||||||
|
func NewDeleteAccountNotFound() *DeleteAccountNotFound {
|
||||||
|
return &DeleteAccountNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteAccountNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type DeleteAccountNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteAccountNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountUnprocessableEntity creates a DeleteAccountUnprocessableEntity with default headers values
|
||||||
|
func NewDeleteAccountUnprocessableEntity() *DeleteAccountUnprocessableEntity {
|
||||||
|
return &DeleteAccountUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteAccountUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type DeleteAccountUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteAccountUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteAccountInternalServerError creates a DeleteAccountInternalServerError with default headers values
|
||||||
|
func NewDeleteAccountInternalServerError() *DeleteAccountInternalServerError {
|
||||||
|
return &DeleteAccountInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteAccountInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type DeleteAccountInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteAccountInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteAccountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,268 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetAccountsObservableParams creates a new GetAccountsObservableParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetAccountsObservableParams() *GetAccountsObservableParams {
|
||||||
|
return &GetAccountsObservableParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableParamsWithTimeout creates a new GetAccountsObservableParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetAccountsObservableParamsWithTimeout(timeout time.Duration) *GetAccountsObservableParams {
|
||||||
|
return &GetAccountsObservableParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableParamsWithContext creates a new GetAccountsObservableParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetAccountsObservableParamsWithContext(ctx context.Context) *GetAccountsObservableParams {
|
||||||
|
return &GetAccountsObservableParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableParamsWithHTTPClient creates a new GetAccountsObservableParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetAccountsObservableParamsWithHTTPClient(client *http.Client) *GetAccountsObservableParams {
|
||||||
|
return &GetAccountsObservableParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsObservableParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get accounts observable operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetAccountsObservableParams struct {
|
||||||
|
|
||||||
|
/* AccountID.
|
||||||
|
|
||||||
|
Telnexus Record Id of an Account
|
||||||
|
*/
|
||||||
|
AccountID *string
|
||||||
|
|
||||||
|
/* Active.
|
||||||
|
|
||||||
|
Only retrieve active records?
|
||||||
|
*/
|
||||||
|
Active *bool
|
||||||
|
|
||||||
|
/* Email.
|
||||||
|
|
||||||
|
Email address used for identity lookup
|
||||||
|
*/
|
||||||
|
Email *string
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
The Name of this Object
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get accounts observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetAccountsObservableParams) WithDefaults() *GetAccountsObservableParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get accounts observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetAccountsObservableParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) WithTimeout(timeout time.Duration) *GetAccountsObservableParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) WithContext(ctx context.Context) *GetAccountsObservableParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) WithHTTPClient(client *http.Client) *GetAccountsObservableParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAccountID adds the accountID to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) WithAccountID(accountID *string) *GetAccountsObservableParams {
|
||||||
|
o.SetAccountID(accountID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAccountID adds the accountId to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) SetAccountID(accountID *string) {
|
||||||
|
o.AccountID = accountID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithActive adds the active to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) WithActive(active *bool) *GetAccountsObservableParams {
|
||||||
|
o.SetActive(active)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetActive adds the active to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) SetActive(active *bool) {
|
||||||
|
o.Active = active
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithEmail adds the email to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) WithEmail(email *string) *GetAccountsObservableParams {
|
||||||
|
o.SetEmail(email)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEmail adds the email to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) SetEmail(email *string) {
|
||||||
|
o.Email = email
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) WithName(name *string) *GetAccountsObservableParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the get accounts observable params
|
||||||
|
func (o *GetAccountsObservableParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetAccountsObservableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
|
||||||
|
// query param accountId
|
||||||
|
var qrAccountID string
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
qrAccountID = *o.AccountID
|
||||||
|
}
|
||||||
|
qAccountID := qrAccountID
|
||||||
|
if qAccountID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("accountId", qAccountID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
|
||||||
|
// query param active
|
||||||
|
var qrActive bool
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
qrActive = *o.Active
|
||||||
|
}
|
||||||
|
qActive := swag.FormatBool(qrActive)
|
||||||
|
if qActive != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("active", qActive); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
|
||||||
|
// query param email
|
||||||
|
var qrEmail string
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
qrEmail = *o.Email
|
||||||
|
}
|
||||||
|
qEmail := qrEmail
|
||||||
|
if qEmail != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("email", qEmail); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,321 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetAccountsObservableReader is a Reader for the GetAccountsObservable structure.
|
||||||
|
type GetAccountsObservableReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetAccountsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetAccountsObservableOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetAccountsObservableUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetAccountsObservableForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetAccountsObservableNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetAccountsObservableUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetAccountsObservableInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableOK creates a GetAccountsObservableOK with default headers values
|
||||||
|
func NewGetAccountsObservableOK() *GetAccountsObservableOK {
|
||||||
|
return &GetAccountsObservableOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsObservableOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Account objects
|
||||||
|
*/
|
||||||
|
type GetAccountsObservableOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload []*crm_models.Account
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsObservableOK) GetPayload() []*crm_models.Account {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableUnauthorized creates a GetAccountsObservableUnauthorized with default headers values
|
||||||
|
func NewGetAccountsObservableUnauthorized() *GetAccountsObservableUnauthorized {
|
||||||
|
return &GetAccountsObservableUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsObservableUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetAccountsObservableUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsObservableUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableForbidden creates a GetAccountsObservableForbidden with default headers values
|
||||||
|
func NewGetAccountsObservableForbidden() *GetAccountsObservableForbidden {
|
||||||
|
return &GetAccountsObservableForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsObservableForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetAccountsObservableForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsObservableForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableNotFound creates a GetAccountsObservableNotFound with default headers values
|
||||||
|
func NewGetAccountsObservableNotFound() *GetAccountsObservableNotFound {
|
||||||
|
return &GetAccountsObservableNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsObservableNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetAccountsObservableNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsObservableNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableUnprocessableEntity creates a GetAccountsObservableUnprocessableEntity with default headers values
|
||||||
|
func NewGetAccountsObservableUnprocessableEntity() *GetAccountsObservableUnprocessableEntity {
|
||||||
|
return &GetAccountsObservableUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsObservableUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetAccountsObservableUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsObservableUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsObservableInternalServerError creates a GetAccountsObservableInternalServerError with default headers values
|
||||||
|
func NewGetAccountsObservableInternalServerError() *GetAccountsObservableInternalServerError {
|
||||||
|
return &GetAccountsObservableInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsObservableInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetAccountsObservableInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsObservableInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,340 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetAccountsParams creates a new GetAccountsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetAccountsParams() *GetAccountsParams {
|
||||||
|
return &GetAccountsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsParamsWithTimeout creates a new GetAccountsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetAccountsParamsWithTimeout(timeout time.Duration) *GetAccountsParams {
|
||||||
|
return &GetAccountsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsParamsWithContext creates a new GetAccountsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetAccountsParamsWithContext(ctx context.Context) *GetAccountsParams {
|
||||||
|
return &GetAccountsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsParamsWithHTTPClient creates a new GetAccountsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetAccountsParamsWithHTTPClient(client *http.Client) *GetAccountsParams {
|
||||||
|
return &GetAccountsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get accounts operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetAccountsParams struct {
|
||||||
|
|
||||||
|
/* AccountID.
|
||||||
|
|
||||||
|
Telnexus Record Id of an Account
|
||||||
|
*/
|
||||||
|
AccountID *string
|
||||||
|
|
||||||
|
/* Active.
|
||||||
|
|
||||||
|
Only retrieve active records?
|
||||||
|
*/
|
||||||
|
Active *bool
|
||||||
|
|
||||||
|
/* Email.
|
||||||
|
|
||||||
|
Email address used for identity lookup
|
||||||
|
*/
|
||||||
|
Email *string
|
||||||
|
|
||||||
|
/* Limit.
|
||||||
|
|
||||||
|
How many objects to return at one time
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Limit *int64
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
The Name of this Object
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
/* Offset.
|
||||||
|
|
||||||
|
How many objects to skip?
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Offset *int64
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get accounts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetAccountsParams) WithDefaults() *GetAccountsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get accounts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetAccountsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithTimeout(timeout time.Duration) *GetAccountsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithContext(ctx context.Context) *GetAccountsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithHTTPClient(client *http.Client) *GetAccountsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAccountID adds the accountID to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithAccountID(accountID *string) *GetAccountsParams {
|
||||||
|
o.SetAccountID(accountID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAccountID adds the accountId to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetAccountID(accountID *string) {
|
||||||
|
o.AccountID = accountID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithActive adds the active to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithActive(active *bool) *GetAccountsParams {
|
||||||
|
o.SetActive(active)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetActive adds the active to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetActive(active *bool) {
|
||||||
|
o.Active = active
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithEmail adds the email to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithEmail(email *string) *GetAccountsParams {
|
||||||
|
o.SetEmail(email)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEmail adds the email to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetEmail(email *string) {
|
||||||
|
o.Email = email
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithLimit(limit *int64) *GetAccountsParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithName(name *string) *GetAccountsParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOffset adds the offset to the get accounts params
|
||||||
|
func (o *GetAccountsParams) WithOffset(offset *int64) *GetAccountsParams {
|
||||||
|
o.SetOffset(offset)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOffset adds the offset to the get accounts params
|
||||||
|
func (o *GetAccountsParams) SetOffset(offset *int64) {
|
||||||
|
o.Offset = offset
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
|
||||||
|
// query param accountId
|
||||||
|
var qrAccountID string
|
||||||
|
|
||||||
|
if o.AccountID != nil {
|
||||||
|
qrAccountID = *o.AccountID
|
||||||
|
}
|
||||||
|
qAccountID := qrAccountID
|
||||||
|
if qAccountID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("accountId", qAccountID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
|
||||||
|
// query param active
|
||||||
|
var qrActive bool
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
qrActive = *o.Active
|
||||||
|
}
|
||||||
|
qActive := swag.FormatBool(qrActive)
|
||||||
|
if qActive != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("active", qActive); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
|
||||||
|
// query param email
|
||||||
|
var qrEmail string
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
qrEmail = *o.Email
|
||||||
|
}
|
||||||
|
qEmail := qrEmail
|
||||||
|
if qEmail != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("email", qEmail); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
|
||||||
|
// query param limit
|
||||||
|
var qrLimit int64
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
qrLimit = *o.Limit
|
||||||
|
}
|
||||||
|
qLimit := swag.FormatInt64(qrLimit)
|
||||||
|
if qLimit != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
|
||||||
|
// query param offset
|
||||||
|
var qrOffset int64
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
qrOffset = *o.Offset
|
||||||
|
}
|
||||||
|
qOffset := swag.FormatInt64(qrOffset)
|
||||||
|
if qOffset != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetAccountsReader is a Reader for the GetAccounts structure.
|
||||||
|
type GetAccountsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetAccountsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetAccountsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetAccountsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetAccountsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetAccountsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetAccountsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsOK creates a GetAccountsOK with default headers values
|
||||||
|
func NewGetAccountsOK() *GetAccountsOK {
|
||||||
|
return &GetAccountsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Account objects with Contacts
|
||||||
|
*/
|
||||||
|
type GetAccountsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.AccountResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsOK) GetPayload() *crm_models.AccountResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.AccountResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsUnauthorized creates a GetAccountsUnauthorized with default headers values
|
||||||
|
func NewGetAccountsUnauthorized() *GetAccountsUnauthorized {
|
||||||
|
return &GetAccountsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetAccountsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsForbidden creates a GetAccountsForbidden with default headers values
|
||||||
|
func NewGetAccountsForbidden() *GetAccountsForbidden {
|
||||||
|
return &GetAccountsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetAccountsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsNotFound creates a GetAccountsNotFound with default headers values
|
||||||
|
func NewGetAccountsNotFound() *GetAccountsNotFound {
|
||||||
|
return &GetAccountsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetAccountsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsUnprocessableEntity creates a GetAccountsUnprocessableEntity with default headers values
|
||||||
|
func NewGetAccountsUnprocessableEntity() *GetAccountsUnprocessableEntity {
|
||||||
|
return &GetAccountsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetAccountsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetAccountsInternalServerError creates a GetAccountsInternalServerError with default headers values
|
||||||
|
func NewGetAccountsInternalServerError() *GetAccountsInternalServerError {
|
||||||
|
return &GetAccountsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetAccountsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetAccountsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetAccountsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPostAccountsParams creates a new PostAccountsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPostAccountsParams() *PostAccountsParams {
|
||||||
|
return &PostAccountsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsParamsWithTimeout creates a new PostAccountsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPostAccountsParamsWithTimeout(timeout time.Duration) *PostAccountsParams {
|
||||||
|
return &PostAccountsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsParamsWithContext creates a new PostAccountsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPostAccountsParamsWithContext(ctx context.Context) *PostAccountsParams {
|
||||||
|
return &PostAccountsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsParamsWithHTTPClient creates a new PostAccountsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPostAccountsParamsWithHTTPClient(client *http.Client) *PostAccountsParams {
|
||||||
|
return &PostAccountsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostAccountsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the post accounts operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PostAccountsParams struct {
|
||||||
|
|
||||||
|
/* AccountRequest.
|
||||||
|
|
||||||
|
An array of new Account records
|
||||||
|
*/
|
||||||
|
AccountRequest *crm_models.AccountRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the post accounts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostAccountsParams) WithDefaults() *PostAccountsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the post accounts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostAccountsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the post accounts params
|
||||||
|
func (o *PostAccountsParams) WithTimeout(timeout time.Duration) *PostAccountsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the post accounts params
|
||||||
|
func (o *PostAccountsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the post accounts params
|
||||||
|
func (o *PostAccountsParams) WithContext(ctx context.Context) *PostAccountsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the post accounts params
|
||||||
|
func (o *PostAccountsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the post accounts params
|
||||||
|
func (o *PostAccountsParams) WithHTTPClient(client *http.Client) *PostAccountsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the post accounts params
|
||||||
|
func (o *PostAccountsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAccountRequest adds the accountRequest to the post accounts params
|
||||||
|
func (o *PostAccountsParams) WithAccountRequest(accountRequest *crm_models.AccountRequest) *PostAccountsParams {
|
||||||
|
o.SetAccountRequest(accountRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAccountRequest adds the accountRequest to the post accounts params
|
||||||
|
func (o *PostAccountsParams) SetAccountRequest(accountRequest *crm_models.AccountRequest) {
|
||||||
|
o.AccountRequest = accountRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PostAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.AccountRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.AccountRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PostAccountsReader is a Reader for the PostAccounts structure.
|
||||||
|
type PostAccountsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPostAccountsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPostAccountsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPostAccountsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPostAccountsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPostAccountsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPostAccountsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsOK creates a PostAccountsOK with default headers values
|
||||||
|
func NewPostAccountsOK() *PostAccountsOK {
|
||||||
|
return &PostAccountsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostAccountsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Account objects with Contacts
|
||||||
|
*/
|
||||||
|
type PostAccountsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.AccountResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostAccountsOK) GetPayload() *crm_models.AccountResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.AccountResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsUnauthorized creates a PostAccountsUnauthorized with default headers values
|
||||||
|
func NewPostAccountsUnauthorized() *PostAccountsUnauthorized {
|
||||||
|
return &PostAccountsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostAccountsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PostAccountsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostAccountsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsForbidden creates a PostAccountsForbidden with default headers values
|
||||||
|
func NewPostAccountsForbidden() *PostAccountsForbidden {
|
||||||
|
return &PostAccountsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostAccountsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PostAccountsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostAccountsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsNotFound creates a PostAccountsNotFound with default headers values
|
||||||
|
func NewPostAccountsNotFound() *PostAccountsNotFound {
|
||||||
|
return &PostAccountsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostAccountsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PostAccountsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostAccountsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsUnprocessableEntity creates a PostAccountsUnprocessableEntity with default headers values
|
||||||
|
func NewPostAccountsUnprocessableEntity() *PostAccountsUnprocessableEntity {
|
||||||
|
return &PostAccountsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostAccountsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PostAccountsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostAccountsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostAccountsInternalServerError creates a PostAccountsInternalServerError with default headers values
|
||||||
|
func NewPostAccountsInternalServerError() *PostAccountsInternalServerError {
|
||||||
|
return &PostAccountsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostAccountsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PostAccountsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostAccountsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPutAccountParams creates a new PutAccountParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPutAccountParams() *PutAccountParams {
|
||||||
|
return &PutAccountParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountParamsWithTimeout creates a new PutAccountParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPutAccountParamsWithTimeout(timeout time.Duration) *PutAccountParams {
|
||||||
|
return &PutAccountParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountParamsWithContext creates a new PutAccountParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPutAccountParamsWithContext(ctx context.Context) *PutAccountParams {
|
||||||
|
return &PutAccountParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountParamsWithHTTPClient creates a new PutAccountParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPutAccountParamsWithHTTPClient(client *http.Client) *PutAccountParams {
|
||||||
|
return &PutAccountParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutAccountParams contains all the parameters to send to the API endpoint
|
||||||
|
for the put account operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PutAccountParams struct {
|
||||||
|
|
||||||
|
/* AccountRequest.
|
||||||
|
|
||||||
|
An array of new Account records
|
||||||
|
*/
|
||||||
|
AccountRequest *crm_models.AccountRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the put account params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutAccountParams) WithDefaults() *PutAccountParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the put account params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutAccountParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the put account params
|
||||||
|
func (o *PutAccountParams) WithTimeout(timeout time.Duration) *PutAccountParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the put account params
|
||||||
|
func (o *PutAccountParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the put account params
|
||||||
|
func (o *PutAccountParams) WithContext(ctx context.Context) *PutAccountParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the put account params
|
||||||
|
func (o *PutAccountParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the put account params
|
||||||
|
func (o *PutAccountParams) WithHTTPClient(client *http.Client) *PutAccountParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the put account params
|
||||||
|
func (o *PutAccountParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAccountRequest adds the accountRequest to the put account params
|
||||||
|
func (o *PutAccountParams) WithAccountRequest(accountRequest *crm_models.AccountRequest) *PutAccountParams {
|
||||||
|
o.SetAccountRequest(accountRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAccountRequest adds the accountRequest to the put account params
|
||||||
|
func (o *PutAccountParams) SetAccountRequest(accountRequest *crm_models.AccountRequest) {
|
||||||
|
o.AccountRequest = accountRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PutAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.AccountRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.AccountRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package accounts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PutAccountReader is a Reader for the PutAccount structure.
|
||||||
|
type PutAccountReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PutAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPutAccountOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPutAccountUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPutAccountForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPutAccountNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPutAccountUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPutAccountInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountOK creates a PutAccountOK with default headers values
|
||||||
|
func NewPutAccountOK() *PutAccountOK {
|
||||||
|
return &PutAccountOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutAccountOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Account objects with Contacts
|
||||||
|
*/
|
||||||
|
type PutAccountOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.AccountResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountOK) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /accounts][%d] putAccountOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutAccountOK) GetPayload() *crm_models.AccountResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.AccountResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountUnauthorized creates a PutAccountUnauthorized with default headers values
|
||||||
|
func NewPutAccountUnauthorized() *PutAccountUnauthorized {
|
||||||
|
return &PutAccountUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutAccountUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PutAccountUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /accounts][%d] putAccountUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutAccountUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountForbidden creates a PutAccountForbidden with default headers values
|
||||||
|
func NewPutAccountForbidden() *PutAccountForbidden {
|
||||||
|
return &PutAccountForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutAccountForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PutAccountForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /accounts][%d] putAccountForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutAccountForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountNotFound creates a PutAccountNotFound with default headers values
|
||||||
|
func NewPutAccountNotFound() *PutAccountNotFound {
|
||||||
|
return &PutAccountNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutAccountNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PutAccountNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /accounts][%d] putAccountNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutAccountNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountUnprocessableEntity creates a PutAccountUnprocessableEntity with default headers values
|
||||||
|
func NewPutAccountUnprocessableEntity() *PutAccountUnprocessableEntity {
|
||||||
|
return &PutAccountUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutAccountUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PutAccountUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /accounts][%d] putAccountUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutAccountUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutAccountInternalServerError creates a PutAccountInternalServerError with default headers values
|
||||||
|
func NewPutAccountInternalServerError() *PutAccountInternalServerError {
|
||||||
|
return &PutAccountInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutAccountInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PutAccountInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /accounts][%d] putAccountInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutAccountInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutAccountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package companies
|
||||||
|
|
||||||
|
// 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 companies API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for companies API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesOK, error)
|
||||||
|
|
||||||
|
GetCompaniesObservable(params *GetCompaniesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesObservableOK, error)
|
||||||
|
|
||||||
|
PostCompanies(params *PostCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompaniesOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetCompanies gets company records
|
||||||
|
|
||||||
|
Retrieve Company records from the datastore
|
||||||
|
*/
|
||||||
|
func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetCompaniesParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getCompanies",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/companies",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetCompaniesReader{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.(*GetCompaniesOK)
|
||||||
|
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 getCompanies: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetCompaniesObservable gets telnexus companies in an observable array
|
||||||
|
|
||||||
|
A list of companies in a simple JSON array
|
||||||
|
*/
|
||||||
|
func (a *Client) GetCompaniesObservable(params *GetCompaniesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesObservableOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetCompaniesObservableParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getCompaniesObservable",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/companies/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetCompaniesObservableReader{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.(*GetCompaniesObservableOK)
|
||||||
|
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 getCompaniesObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PostCompanies adds new companies
|
||||||
|
|
||||||
|
Add new companies
|
||||||
|
*/
|
||||||
|
func (a *Client) PostCompanies(params *PostCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompaniesOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPostCompaniesParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "postCompanies",
|
||||||
|
Method: "POST",
|
||||||
|
PathPattern: "/companies",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PostCompaniesReader{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.(*PostCompaniesOK)
|
||||||
|
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 postCompanies: 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
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package companies
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableParams creates a new GetCompaniesObservableParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetCompaniesObservableParams() *GetCompaniesObservableParams {
|
||||||
|
return &GetCompaniesObservableParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableParamsWithTimeout creates a new GetCompaniesObservableParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetCompaniesObservableParamsWithTimeout(timeout time.Duration) *GetCompaniesObservableParams {
|
||||||
|
return &GetCompaniesObservableParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableParamsWithContext creates a new GetCompaniesObservableParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetCompaniesObservableParamsWithContext(ctx context.Context) *GetCompaniesObservableParams {
|
||||||
|
return &GetCompaniesObservableParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableParamsWithHTTPClient creates a new GetCompaniesObservableParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetCompaniesObservableParamsWithHTTPClient(client *http.Client) *GetCompaniesObservableParams {
|
||||||
|
return &GetCompaniesObservableParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesObservableParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get companies observable operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetCompaniesObservableParams struct {
|
||||||
|
|
||||||
|
/* CompanyID.
|
||||||
|
|
||||||
|
Telnexus Company record ID
|
||||||
|
*/
|
||||||
|
CompanyID *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get companies observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetCompaniesObservableParams) WithDefaults() *GetCompaniesObservableParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get companies observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetCompaniesObservableParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) WithTimeout(timeout time.Duration) *GetCompaniesObservableParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) WithContext(ctx context.Context) *GetCompaniesObservableParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) WithHTTPClient(client *http.Client) *GetCompaniesObservableParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCompanyID adds the companyID to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) WithCompanyID(companyID *string) *GetCompaniesObservableParams {
|
||||||
|
o.SetCompanyID(companyID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCompanyID adds the companyId to the get companies observable params
|
||||||
|
func (o *GetCompaniesObservableParams) SetCompanyID(companyID *string) {
|
||||||
|
o.CompanyID = companyID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetCompaniesObservableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.CompanyID != nil {
|
||||||
|
|
||||||
|
// query param companyId
|
||||||
|
var qrCompanyID string
|
||||||
|
|
||||||
|
if o.CompanyID != nil {
|
||||||
|
qrCompanyID = *o.CompanyID
|
||||||
|
}
|
||||||
|
qCompanyID := qrCompanyID
|
||||||
|
if qCompanyID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("companyId", qCompanyID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,321 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package companies
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetCompaniesObservableReader is a Reader for the GetCompaniesObservable structure.
|
||||||
|
type GetCompaniesObservableReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetCompaniesObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetCompaniesObservableOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetCompaniesObservableUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetCompaniesObservableForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetCompaniesObservableNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetCompaniesObservableUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetCompaniesObservableInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableOK creates a GetCompaniesObservableOK with default headers values
|
||||||
|
func NewGetCompaniesObservableOK() *GetCompaniesObservableOK {
|
||||||
|
return &GetCompaniesObservableOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesObservableOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Company objects
|
||||||
|
*/
|
||||||
|
type GetCompaniesObservableOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload []*crm_models.Company
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesObservableOK) GetPayload() []*crm_models.Company {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableUnauthorized creates a GetCompaniesObservableUnauthorized with default headers values
|
||||||
|
func NewGetCompaniesObservableUnauthorized() *GetCompaniesObservableUnauthorized {
|
||||||
|
return &GetCompaniesObservableUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesObservableUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetCompaniesObservableUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesObservableUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableForbidden creates a GetCompaniesObservableForbidden with default headers values
|
||||||
|
func NewGetCompaniesObservableForbidden() *GetCompaniesObservableForbidden {
|
||||||
|
return &GetCompaniesObservableForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesObservableForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetCompaniesObservableForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesObservableForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableNotFound creates a GetCompaniesObservableNotFound with default headers values
|
||||||
|
func NewGetCompaniesObservableNotFound() *GetCompaniesObservableNotFound {
|
||||||
|
return &GetCompaniesObservableNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesObservableNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetCompaniesObservableNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesObservableNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableUnprocessableEntity creates a GetCompaniesObservableUnprocessableEntity with default headers values
|
||||||
|
func NewGetCompaniesObservableUnprocessableEntity() *GetCompaniesObservableUnprocessableEntity {
|
||||||
|
return &GetCompaniesObservableUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesObservableUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetCompaniesObservableUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesObservableUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesObservableInternalServerError creates a GetCompaniesObservableInternalServerError with default headers values
|
||||||
|
func NewGetCompaniesObservableInternalServerError() *GetCompaniesObservableInternalServerError {
|
||||||
|
return &GetCompaniesObservableInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesObservableInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetCompaniesObservableInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesObservableInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package companies
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetCompaniesParams creates a new GetCompaniesParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetCompaniesParams() *GetCompaniesParams {
|
||||||
|
return &GetCompaniesParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesParamsWithTimeout creates a new GetCompaniesParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetCompaniesParamsWithTimeout(timeout time.Duration) *GetCompaniesParams {
|
||||||
|
return &GetCompaniesParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesParamsWithContext creates a new GetCompaniesParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetCompaniesParamsWithContext(ctx context.Context) *GetCompaniesParams {
|
||||||
|
return &GetCompaniesParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesParamsWithHTTPClient creates a new GetCompaniesParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetCompaniesParamsWithHTTPClient(client *http.Client) *GetCompaniesParams {
|
||||||
|
return &GetCompaniesParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get companies operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetCompaniesParams struct {
|
||||||
|
|
||||||
|
/* CompanyID.
|
||||||
|
|
||||||
|
Telnexus Company record ID
|
||||||
|
*/
|
||||||
|
CompanyID *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get companies params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetCompaniesParams) WithDefaults() *GetCompaniesParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get companies params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetCompaniesParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get companies params
|
||||||
|
func (o *GetCompaniesParams) WithTimeout(timeout time.Duration) *GetCompaniesParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get companies params
|
||||||
|
func (o *GetCompaniesParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get companies params
|
||||||
|
func (o *GetCompaniesParams) WithContext(ctx context.Context) *GetCompaniesParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get companies params
|
||||||
|
func (o *GetCompaniesParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get companies params
|
||||||
|
func (o *GetCompaniesParams) WithHTTPClient(client *http.Client) *GetCompaniesParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get companies params
|
||||||
|
func (o *GetCompaniesParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCompanyID adds the companyID to the get companies params
|
||||||
|
func (o *GetCompaniesParams) WithCompanyID(companyID *string) *GetCompaniesParams {
|
||||||
|
o.SetCompanyID(companyID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCompanyID adds the companyId to the get companies params
|
||||||
|
func (o *GetCompaniesParams) SetCompanyID(companyID *string) {
|
||||||
|
o.CompanyID = companyID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetCompaniesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.CompanyID != nil {
|
||||||
|
|
||||||
|
// query param companyId
|
||||||
|
var qrCompanyID string
|
||||||
|
|
||||||
|
if o.CompanyID != nil {
|
||||||
|
qrCompanyID = *o.CompanyID
|
||||||
|
}
|
||||||
|
qCompanyID := qrCompanyID
|
||||||
|
if qCompanyID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("companyId", qCompanyID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package companies
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetCompaniesReader is a Reader for the GetCompanies structure.
|
||||||
|
type GetCompaniesReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetCompaniesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetCompaniesOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetCompaniesUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetCompaniesForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetCompaniesNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetCompaniesUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetCompaniesInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesOK creates a GetCompaniesOK with default headers values
|
||||||
|
func NewGetCompaniesOK() *GetCompaniesOK {
|
||||||
|
return &GetCompaniesOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Company objects
|
||||||
|
*/
|
||||||
|
type GetCompaniesOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.CompanyResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies][%d] getCompaniesOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesOK) GetPayload() *crm_models.CompanyResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.CompanyResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesUnauthorized creates a GetCompaniesUnauthorized with default headers values
|
||||||
|
func NewGetCompaniesUnauthorized() *GetCompaniesUnauthorized {
|
||||||
|
return &GetCompaniesUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetCompaniesUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies][%d] getCompaniesUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesForbidden creates a GetCompaniesForbidden with default headers values
|
||||||
|
func NewGetCompaniesForbidden() *GetCompaniesForbidden {
|
||||||
|
return &GetCompaniesForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetCompaniesForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies][%d] getCompaniesForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesNotFound creates a GetCompaniesNotFound with default headers values
|
||||||
|
func NewGetCompaniesNotFound() *GetCompaniesNotFound {
|
||||||
|
return &GetCompaniesNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetCompaniesNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies][%d] getCompaniesNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesUnprocessableEntity creates a GetCompaniesUnprocessableEntity with default headers values
|
||||||
|
func NewGetCompaniesUnprocessableEntity() *GetCompaniesUnprocessableEntity {
|
||||||
|
return &GetCompaniesUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetCompaniesUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies][%d] getCompaniesUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetCompaniesInternalServerError creates a GetCompaniesInternalServerError with default headers values
|
||||||
|
func NewGetCompaniesInternalServerError() *GetCompaniesInternalServerError {
|
||||||
|
return &GetCompaniesInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetCompaniesInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetCompaniesInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /companies][%d] getCompaniesInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetCompaniesInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetCompaniesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package companies
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPostCompaniesParams creates a new PostCompaniesParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPostCompaniesParams() *PostCompaniesParams {
|
||||||
|
return &PostCompaniesParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesParamsWithTimeout creates a new PostCompaniesParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPostCompaniesParamsWithTimeout(timeout time.Duration) *PostCompaniesParams {
|
||||||
|
return &PostCompaniesParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesParamsWithContext creates a new PostCompaniesParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPostCompaniesParamsWithContext(ctx context.Context) *PostCompaniesParams {
|
||||||
|
return &PostCompaniesParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesParamsWithHTTPClient creates a new PostCompaniesParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPostCompaniesParamsWithHTTPClient(client *http.Client) *PostCompaniesParams {
|
||||||
|
return &PostCompaniesParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostCompaniesParams contains all the parameters to send to the API endpoint
|
||||||
|
for the post companies operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PostCompaniesParams struct {
|
||||||
|
|
||||||
|
/* CompaniesRequest.
|
||||||
|
|
||||||
|
An array of new Contact records
|
||||||
|
*/
|
||||||
|
CompaniesRequest *crm_models.CompanyRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the post companies params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostCompaniesParams) WithDefaults() *PostCompaniesParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the post companies params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostCompaniesParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the post companies params
|
||||||
|
func (o *PostCompaniesParams) WithTimeout(timeout time.Duration) *PostCompaniesParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the post companies params
|
||||||
|
func (o *PostCompaniesParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the post companies params
|
||||||
|
func (o *PostCompaniesParams) WithContext(ctx context.Context) *PostCompaniesParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the post companies params
|
||||||
|
func (o *PostCompaniesParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the post companies params
|
||||||
|
func (o *PostCompaniesParams) WithHTTPClient(client *http.Client) *PostCompaniesParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the post companies params
|
||||||
|
func (o *PostCompaniesParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithCompaniesRequest adds the companiesRequest to the post companies params
|
||||||
|
func (o *PostCompaniesParams) WithCompaniesRequest(companiesRequest *crm_models.CompanyRequest) *PostCompaniesParams {
|
||||||
|
o.SetCompaniesRequest(companiesRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCompaniesRequest adds the companiesRequest to the post companies params
|
||||||
|
func (o *PostCompaniesParams) SetCompaniesRequest(companiesRequest *crm_models.CompanyRequest) {
|
||||||
|
o.CompaniesRequest = companiesRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PostCompaniesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.CompaniesRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.CompaniesRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package companies
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PostCompaniesReader is a Reader for the PostCompanies structure.
|
||||||
|
type PostCompaniesReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PostCompaniesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPostCompaniesOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPostCompaniesUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPostCompaniesForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPostCompaniesNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPostCompaniesUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPostCompaniesInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesOK creates a PostCompaniesOK with default headers values
|
||||||
|
func NewPostCompaniesOK() *PostCompaniesOK {
|
||||||
|
return &PostCompaniesOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostCompaniesOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Company objects
|
||||||
|
*/
|
||||||
|
type PostCompaniesOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.CompanyResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesOK) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /companies][%d] postCompaniesOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostCompaniesOK) GetPayload() *crm_models.CompanyResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.CompanyResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesUnauthorized creates a PostCompaniesUnauthorized with default headers values
|
||||||
|
func NewPostCompaniesUnauthorized() *PostCompaniesUnauthorized {
|
||||||
|
return &PostCompaniesUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostCompaniesUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PostCompaniesUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /companies][%d] postCompaniesUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostCompaniesUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesForbidden creates a PostCompaniesForbidden with default headers values
|
||||||
|
func NewPostCompaniesForbidden() *PostCompaniesForbidden {
|
||||||
|
return &PostCompaniesForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostCompaniesForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PostCompaniesForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /companies][%d] postCompaniesForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostCompaniesForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesNotFound creates a PostCompaniesNotFound with default headers values
|
||||||
|
func NewPostCompaniesNotFound() *PostCompaniesNotFound {
|
||||||
|
return &PostCompaniesNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostCompaniesNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PostCompaniesNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /companies][%d] postCompaniesNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostCompaniesNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesUnprocessableEntity creates a PostCompaniesUnprocessableEntity with default headers values
|
||||||
|
func NewPostCompaniesUnprocessableEntity() *PostCompaniesUnprocessableEntity {
|
||||||
|
return &PostCompaniesUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostCompaniesUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PostCompaniesUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /companies][%d] postCompaniesUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostCompaniesUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostCompaniesInternalServerError creates a PostCompaniesInternalServerError with default headers values
|
||||||
|
func NewPostCompaniesInternalServerError() *PostCompaniesInternalServerError {
|
||||||
|
return &PostCompaniesInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostCompaniesInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PostCompaniesInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /companies][%d] postCompaniesInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostCompaniesInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostCompaniesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,258 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// 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 contacts API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for contacts API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error)
|
||||||
|
|
||||||
|
GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error)
|
||||||
|
|
||||||
|
GetContactsObservable(params *GetContactsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsObservableOK, error)
|
||||||
|
|
||||||
|
PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error)
|
||||||
|
|
||||||
|
PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DeleteContact deletes a contact
|
||||||
|
|
||||||
|
Delete Telnexus Contact record
|
||||||
|
*/
|
||||||
|
func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewDeleteContactParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "deleteContact",
|
||||||
|
Method: "DELETE",
|
||||||
|
PathPattern: "/contacts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &DeleteContactReader{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.(*DeleteContactOK)
|
||||||
|
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 deleteContact: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetContacts gets a list of contacts
|
||||||
|
|
||||||
|
Return a list of all available Contacts
|
||||||
|
*/
|
||||||
|
func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetContactsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getContacts",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/contacts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetContactsReader{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.(*GetContactsOK)
|
||||||
|
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 getContacts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetContactsObservable gets telnexus contacts in an observable array
|
||||||
|
|
||||||
|
A list of contacts in a simple JSON array
|
||||||
|
*/
|
||||||
|
func (a *Client) GetContactsObservable(params *GetContactsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsObservableOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetContactsObservableParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getContactsObservable",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/contacts/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetContactsObservableReader{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.(*GetContactsObservableOK)
|
||||||
|
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 getContactsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PostContacts adds new contacts
|
||||||
|
|
||||||
|
Contact record to be added
|
||||||
|
*/
|
||||||
|
func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPostContactsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "postContacts",
|
||||||
|
Method: "POST",
|
||||||
|
PathPattern: "/contacts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PostContactsReader{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.(*PostContactsOK)
|
||||||
|
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 postContacts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PutContacts updates contact
|
||||||
|
|
||||||
|
Update Contact records
|
||||||
|
*/
|
||||||
|
func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPutContactsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "putContacts",
|
||||||
|
Method: "PUT",
|
||||||
|
PathPattern: "/contacts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PutContactsReader{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.(*PutContactsOK)
|
||||||
|
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 putContacts: 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
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewDeleteContactParams creates a new DeleteContactParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewDeleteContactParams() *DeleteContactParams {
|
||||||
|
return &DeleteContactParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactParamsWithTimeout creates a new DeleteContactParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewDeleteContactParamsWithTimeout(timeout time.Duration) *DeleteContactParams {
|
||||||
|
return &DeleteContactParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactParamsWithContext creates a new DeleteContactParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewDeleteContactParamsWithContext(ctx context.Context) *DeleteContactParams {
|
||||||
|
return &DeleteContactParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactParamsWithHTTPClient creates a new DeleteContactParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewDeleteContactParamsWithHTTPClient(client *http.Client) *DeleteContactParams {
|
||||||
|
return &DeleteContactParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteContactParams contains all the parameters to send to the API endpoint
|
||||||
|
for the delete contact operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type DeleteContactParams struct {
|
||||||
|
|
||||||
|
/* ContactID.
|
||||||
|
|
||||||
|
Telnexus Contact record ID
|
||||||
|
*/
|
||||||
|
ContactID *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the delete contact params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteContactParams) WithDefaults() *DeleteContactParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the delete contact params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteContactParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the delete contact params
|
||||||
|
func (o *DeleteContactParams) WithTimeout(timeout time.Duration) *DeleteContactParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the delete contact params
|
||||||
|
func (o *DeleteContactParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the delete contact params
|
||||||
|
func (o *DeleteContactParams) WithContext(ctx context.Context) *DeleteContactParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the delete contact params
|
||||||
|
func (o *DeleteContactParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the delete contact params
|
||||||
|
func (o *DeleteContactParams) WithHTTPClient(client *http.Client) *DeleteContactParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the delete contact params
|
||||||
|
func (o *DeleteContactParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContactID adds the contactID to the delete contact params
|
||||||
|
func (o *DeleteContactParams) WithContactID(contactID *string) *DeleteContactParams {
|
||||||
|
o.SetContactID(contactID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContactID adds the contactId to the delete contact params
|
||||||
|
func (o *DeleteContactParams) SetContactID(contactID *string) {
|
||||||
|
o.ContactID = contactID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *DeleteContactParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.ContactID != nil {
|
||||||
|
|
||||||
|
// query param contactId
|
||||||
|
var qrContactID string
|
||||||
|
|
||||||
|
if o.ContactID != nil {
|
||||||
|
qrContactID = *o.ContactID
|
||||||
|
}
|
||||||
|
qContactID := qrContactID
|
||||||
|
if qContactID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("contactId", qContactID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,315 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteContactReader is a Reader for the DeleteContact structure.
|
||||||
|
type DeleteContactReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewDeleteContactOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewDeleteContactUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewDeleteContactForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewDeleteContactNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewDeleteContactUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewDeleteContactInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactOK creates a DeleteContactOK with default headers values
|
||||||
|
func NewDeleteContactOK() *DeleteContactOK {
|
||||||
|
return &DeleteContactOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteContactOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Message Objects with Delete Status
|
||||||
|
*/
|
||||||
|
type DeleteContactOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.DeleteResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactOK) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteContactOK) GetPayload() *crm_models.DeleteResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.DeleteResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactUnauthorized creates a DeleteContactUnauthorized with default headers values
|
||||||
|
func NewDeleteContactUnauthorized() *DeleteContactUnauthorized {
|
||||||
|
return &DeleteContactUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteContactUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type DeleteContactUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteContactUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactForbidden creates a DeleteContactForbidden with default headers values
|
||||||
|
func NewDeleteContactForbidden() *DeleteContactForbidden {
|
||||||
|
return &DeleteContactForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteContactForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type DeleteContactForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteContactForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactNotFound creates a DeleteContactNotFound with default headers values
|
||||||
|
func NewDeleteContactNotFound() *DeleteContactNotFound {
|
||||||
|
return &DeleteContactNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteContactNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type DeleteContactNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteContactNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactUnprocessableEntity creates a DeleteContactUnprocessableEntity with default headers values
|
||||||
|
func NewDeleteContactUnprocessableEntity() *DeleteContactUnprocessableEntity {
|
||||||
|
return &DeleteContactUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteContactUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type DeleteContactUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteContactUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteContactInternalServerError creates a DeleteContactInternalServerError with default headers values
|
||||||
|
func NewDeleteContactInternalServerError() *DeleteContactInternalServerError {
|
||||||
|
return &DeleteContactInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteContactInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type DeleteContactInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteContactInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteContactInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,268 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetContactsObservableParams creates a new GetContactsObservableParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetContactsObservableParams() *GetContactsObservableParams {
|
||||||
|
return &GetContactsObservableParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableParamsWithTimeout creates a new GetContactsObservableParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetContactsObservableParamsWithTimeout(timeout time.Duration) *GetContactsObservableParams {
|
||||||
|
return &GetContactsObservableParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableParamsWithContext creates a new GetContactsObservableParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetContactsObservableParamsWithContext(ctx context.Context) *GetContactsObservableParams {
|
||||||
|
return &GetContactsObservableParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableParamsWithHTTPClient creates a new GetContactsObservableParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetContactsObservableParamsWithHTTPClient(client *http.Client) *GetContactsObservableParams {
|
||||||
|
return &GetContactsObservableParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsObservableParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get contacts observable operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetContactsObservableParams struct {
|
||||||
|
|
||||||
|
/* Active.
|
||||||
|
|
||||||
|
Only retrieve active records?
|
||||||
|
*/
|
||||||
|
Active *bool
|
||||||
|
|
||||||
|
/* ContactID.
|
||||||
|
|
||||||
|
Telnexus Contact record ID
|
||||||
|
*/
|
||||||
|
ContactID *string
|
||||||
|
|
||||||
|
/* Email.
|
||||||
|
|
||||||
|
Email address used for identity lookup
|
||||||
|
*/
|
||||||
|
Email *string
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
The Name of this Object
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get contacts observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetContactsObservableParams) WithDefaults() *GetContactsObservableParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get contacts observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetContactsObservableParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) WithTimeout(timeout time.Duration) *GetContactsObservableParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) WithContext(ctx context.Context) *GetContactsObservableParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) WithHTTPClient(client *http.Client) *GetContactsObservableParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithActive adds the active to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) WithActive(active *bool) *GetContactsObservableParams {
|
||||||
|
o.SetActive(active)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetActive adds the active to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) SetActive(active *bool) {
|
||||||
|
o.Active = active
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContactID adds the contactID to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) WithContactID(contactID *string) *GetContactsObservableParams {
|
||||||
|
o.SetContactID(contactID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContactID adds the contactId to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) SetContactID(contactID *string) {
|
||||||
|
o.ContactID = contactID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithEmail adds the email to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) WithEmail(email *string) *GetContactsObservableParams {
|
||||||
|
o.SetEmail(email)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEmail adds the email to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) SetEmail(email *string) {
|
||||||
|
o.Email = email
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) WithName(name *string) *GetContactsObservableParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the get contacts observable params
|
||||||
|
func (o *GetContactsObservableParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetContactsObservableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
|
||||||
|
// query param active
|
||||||
|
var qrActive bool
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
qrActive = *o.Active
|
||||||
|
}
|
||||||
|
qActive := swag.FormatBool(qrActive)
|
||||||
|
if qActive != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("active", qActive); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.ContactID != nil {
|
||||||
|
|
||||||
|
// query param contactId
|
||||||
|
var qrContactID string
|
||||||
|
|
||||||
|
if o.ContactID != nil {
|
||||||
|
qrContactID = *o.ContactID
|
||||||
|
}
|
||||||
|
qContactID := qrContactID
|
||||||
|
if qContactID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("contactId", qContactID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
|
||||||
|
// query param email
|
||||||
|
var qrEmail string
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
qrEmail = *o.Email
|
||||||
|
}
|
||||||
|
qEmail := qrEmail
|
||||||
|
if qEmail != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("email", qEmail); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,321 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetContactsObservableReader is a Reader for the GetContactsObservable structure.
|
||||||
|
type GetContactsObservableReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetContactsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetContactsObservableOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetContactsObservableUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetContactsObservableForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetContactsObservableNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetContactsObservableUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetContactsObservableInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableOK creates a GetContactsObservableOK with default headers values
|
||||||
|
func NewGetContactsObservableOK() *GetContactsObservableOK {
|
||||||
|
return &GetContactsObservableOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsObservableOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Contact objects
|
||||||
|
*/
|
||||||
|
type GetContactsObservableOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload []*crm_models.Contact
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsObservableOK) GetPayload() []*crm_models.Contact {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableUnauthorized creates a GetContactsObservableUnauthorized with default headers values
|
||||||
|
func NewGetContactsObservableUnauthorized() *GetContactsObservableUnauthorized {
|
||||||
|
return &GetContactsObservableUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsObservableUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetContactsObservableUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsObservableUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableForbidden creates a GetContactsObservableForbidden with default headers values
|
||||||
|
func NewGetContactsObservableForbidden() *GetContactsObservableForbidden {
|
||||||
|
return &GetContactsObservableForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsObservableForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetContactsObservableForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsObservableForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableNotFound creates a GetContactsObservableNotFound with default headers values
|
||||||
|
func NewGetContactsObservableNotFound() *GetContactsObservableNotFound {
|
||||||
|
return &GetContactsObservableNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsObservableNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetContactsObservableNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsObservableNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableUnprocessableEntity creates a GetContactsObservableUnprocessableEntity with default headers values
|
||||||
|
func NewGetContactsObservableUnprocessableEntity() *GetContactsObservableUnprocessableEntity {
|
||||||
|
return &GetContactsObservableUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsObservableUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetContactsObservableUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsObservableUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsObservableInternalServerError creates a GetContactsObservableInternalServerError with default headers values
|
||||||
|
func NewGetContactsObservableInternalServerError() *GetContactsObservableInternalServerError {
|
||||||
|
return &GetContactsObservableInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsObservableInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetContactsObservableInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsObservableInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,340 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetContactsParams creates a new GetContactsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetContactsParams() *GetContactsParams {
|
||||||
|
return &GetContactsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsParamsWithTimeout creates a new GetContactsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetContactsParamsWithTimeout(timeout time.Duration) *GetContactsParams {
|
||||||
|
return &GetContactsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsParamsWithContext creates a new GetContactsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetContactsParamsWithContext(ctx context.Context) *GetContactsParams {
|
||||||
|
return &GetContactsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsParamsWithHTTPClient creates a new GetContactsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetContactsParamsWithHTTPClient(client *http.Client) *GetContactsParams {
|
||||||
|
return &GetContactsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get contacts operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetContactsParams struct {
|
||||||
|
|
||||||
|
/* Active.
|
||||||
|
|
||||||
|
Only retrieve active records?
|
||||||
|
*/
|
||||||
|
Active *bool
|
||||||
|
|
||||||
|
/* ContactID.
|
||||||
|
|
||||||
|
Telnexus Contact record ID
|
||||||
|
*/
|
||||||
|
ContactID *string
|
||||||
|
|
||||||
|
/* Email.
|
||||||
|
|
||||||
|
Email address used for identity lookup
|
||||||
|
*/
|
||||||
|
Email *string
|
||||||
|
|
||||||
|
/* Limit.
|
||||||
|
|
||||||
|
How many objects to return at one time
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Limit *int64
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
The Name of this Object
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
/* Offset.
|
||||||
|
|
||||||
|
How many objects to skip?
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Offset *int64
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get contacts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetContactsParams) WithDefaults() *GetContactsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get contacts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetContactsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithTimeout(timeout time.Duration) *GetContactsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithContext(ctx context.Context) *GetContactsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithHTTPClient(client *http.Client) *GetContactsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithActive adds the active to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithActive(active *bool) *GetContactsParams {
|
||||||
|
o.SetActive(active)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetActive adds the active to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetActive(active *bool) {
|
||||||
|
o.Active = active
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContactID adds the contactID to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithContactID(contactID *string) *GetContactsParams {
|
||||||
|
o.SetContactID(contactID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContactID adds the contactId to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetContactID(contactID *string) {
|
||||||
|
o.ContactID = contactID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithEmail adds the email to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithEmail(email *string) *GetContactsParams {
|
||||||
|
o.SetEmail(email)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEmail adds the email to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetEmail(email *string) {
|
||||||
|
o.Email = email
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithLimit(limit *int64) *GetContactsParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithName(name *string) *GetContactsParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOffset adds the offset to the get contacts params
|
||||||
|
func (o *GetContactsParams) WithOffset(offset *int64) *GetContactsParams {
|
||||||
|
o.SetOffset(offset)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOffset adds the offset to the get contacts params
|
||||||
|
func (o *GetContactsParams) SetOffset(offset *int64) {
|
||||||
|
o.Offset = offset
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
|
||||||
|
// query param active
|
||||||
|
var qrActive bool
|
||||||
|
|
||||||
|
if o.Active != nil {
|
||||||
|
qrActive = *o.Active
|
||||||
|
}
|
||||||
|
qActive := swag.FormatBool(qrActive)
|
||||||
|
if qActive != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("active", qActive); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.ContactID != nil {
|
||||||
|
|
||||||
|
// query param contactId
|
||||||
|
var qrContactID string
|
||||||
|
|
||||||
|
if o.ContactID != nil {
|
||||||
|
qrContactID = *o.ContactID
|
||||||
|
}
|
||||||
|
qContactID := qrContactID
|
||||||
|
if qContactID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("contactId", qContactID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
|
||||||
|
// query param email
|
||||||
|
var qrEmail string
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
qrEmail = *o.Email
|
||||||
|
}
|
||||||
|
qEmail := qrEmail
|
||||||
|
if qEmail != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("email", qEmail); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
|
||||||
|
// query param limit
|
||||||
|
var qrLimit int64
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
qrLimit = *o.Limit
|
||||||
|
}
|
||||||
|
qLimit := swag.FormatInt64(qrLimit)
|
||||||
|
if qLimit != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
|
||||||
|
// query param offset
|
||||||
|
var qrOffset int64
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
qrOffset = *o.Offset
|
||||||
|
}
|
||||||
|
qOffset := swag.FormatInt64(qrOffset)
|
||||||
|
if qOffset != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetContactsReader is a Reader for the GetContacts structure.
|
||||||
|
type GetContactsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetContactsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetContactsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetContactsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetContactsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetContactsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetContactsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsOK creates a GetContactsOK with default headers values
|
||||||
|
func NewGetContactsOK() *GetContactsOK {
|
||||||
|
return &GetContactsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Contact objects
|
||||||
|
*/
|
||||||
|
type GetContactsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.ContactResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts][%d] getContactsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsOK) GetPayload() *crm_models.ContactResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.ContactResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsUnauthorized creates a GetContactsUnauthorized with default headers values
|
||||||
|
func NewGetContactsUnauthorized() *GetContactsUnauthorized {
|
||||||
|
return &GetContactsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetContactsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsForbidden creates a GetContactsForbidden with default headers values
|
||||||
|
func NewGetContactsForbidden() *GetContactsForbidden {
|
||||||
|
return &GetContactsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetContactsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsNotFound creates a GetContactsNotFound with default headers values
|
||||||
|
func NewGetContactsNotFound() *GetContactsNotFound {
|
||||||
|
return &GetContactsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetContactsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsUnprocessableEntity creates a GetContactsUnprocessableEntity with default headers values
|
||||||
|
func NewGetContactsUnprocessableEntity() *GetContactsUnprocessableEntity {
|
||||||
|
return &GetContactsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetContactsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetContactsInternalServerError creates a GetContactsInternalServerError with default headers values
|
||||||
|
func NewGetContactsInternalServerError() *GetContactsInternalServerError {
|
||||||
|
return &GetContactsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetContactsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetContactsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetContactsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetContactsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPostContactsParams creates a new PostContactsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPostContactsParams() *PostContactsParams {
|
||||||
|
return &PostContactsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsParamsWithTimeout creates a new PostContactsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPostContactsParamsWithTimeout(timeout time.Duration) *PostContactsParams {
|
||||||
|
return &PostContactsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsParamsWithContext creates a new PostContactsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPostContactsParamsWithContext(ctx context.Context) *PostContactsParams {
|
||||||
|
return &PostContactsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsParamsWithHTTPClient creates a new PostContactsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPostContactsParamsWithHTTPClient(client *http.Client) *PostContactsParams {
|
||||||
|
return &PostContactsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostContactsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the post contacts operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PostContactsParams struct {
|
||||||
|
|
||||||
|
/* ContactsRequest.
|
||||||
|
|
||||||
|
An array of new Contact records
|
||||||
|
*/
|
||||||
|
ContactsRequest *crm_models.ContactRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the post contacts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostContactsParams) WithDefaults() *PostContactsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the post contacts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostContactsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the post contacts params
|
||||||
|
func (o *PostContactsParams) WithTimeout(timeout time.Duration) *PostContactsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the post contacts params
|
||||||
|
func (o *PostContactsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the post contacts params
|
||||||
|
func (o *PostContactsParams) WithContext(ctx context.Context) *PostContactsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the post contacts params
|
||||||
|
func (o *PostContactsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the post contacts params
|
||||||
|
func (o *PostContactsParams) WithHTTPClient(client *http.Client) *PostContactsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the post contacts params
|
||||||
|
func (o *PostContactsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContactsRequest adds the contactsRequest to the post contacts params
|
||||||
|
func (o *PostContactsParams) WithContactsRequest(contactsRequest *crm_models.ContactRequest) *PostContactsParams {
|
||||||
|
o.SetContactsRequest(contactsRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContactsRequest adds the contactsRequest to the post contacts params
|
||||||
|
func (o *PostContactsParams) SetContactsRequest(contactsRequest *crm_models.ContactRequest) {
|
||||||
|
o.ContactsRequest = contactsRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PostContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.ContactsRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.ContactsRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PostContactsReader is a Reader for the PostContacts structure.
|
||||||
|
type PostContactsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPostContactsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPostContactsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPostContactsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPostContactsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPostContactsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPostContactsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsOK creates a PostContactsOK with default headers values
|
||||||
|
func NewPostContactsOK() *PostContactsOK {
|
||||||
|
return &PostContactsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostContactsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Contact objects
|
||||||
|
*/
|
||||||
|
type PostContactsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.ContactResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /contacts][%d] postContactsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostContactsOK) GetPayload() *crm_models.ContactResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.ContactResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsUnauthorized creates a PostContactsUnauthorized with default headers values
|
||||||
|
func NewPostContactsUnauthorized() *PostContactsUnauthorized {
|
||||||
|
return &PostContactsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostContactsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PostContactsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostContactsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsForbidden creates a PostContactsForbidden with default headers values
|
||||||
|
func NewPostContactsForbidden() *PostContactsForbidden {
|
||||||
|
return &PostContactsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostContactsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PostContactsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostContactsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsNotFound creates a PostContactsNotFound with default headers values
|
||||||
|
func NewPostContactsNotFound() *PostContactsNotFound {
|
||||||
|
return &PostContactsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostContactsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PostContactsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostContactsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsUnprocessableEntity creates a PostContactsUnprocessableEntity with default headers values
|
||||||
|
func NewPostContactsUnprocessableEntity() *PostContactsUnprocessableEntity {
|
||||||
|
return &PostContactsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostContactsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PostContactsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostContactsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostContactsInternalServerError creates a PostContactsInternalServerError with default headers values
|
||||||
|
func NewPostContactsInternalServerError() *PostContactsInternalServerError {
|
||||||
|
return &PostContactsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostContactsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PostContactsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostContactsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostContactsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPutContactsParams creates a new PutContactsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPutContactsParams() *PutContactsParams {
|
||||||
|
return &PutContactsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsParamsWithTimeout creates a new PutContactsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPutContactsParamsWithTimeout(timeout time.Duration) *PutContactsParams {
|
||||||
|
return &PutContactsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsParamsWithContext creates a new PutContactsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPutContactsParamsWithContext(ctx context.Context) *PutContactsParams {
|
||||||
|
return &PutContactsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsParamsWithHTTPClient creates a new PutContactsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPutContactsParamsWithHTTPClient(client *http.Client) *PutContactsParams {
|
||||||
|
return &PutContactsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutContactsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the put contacts operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PutContactsParams struct {
|
||||||
|
|
||||||
|
/* ContactsRequest.
|
||||||
|
|
||||||
|
An array of new Contact records
|
||||||
|
*/
|
||||||
|
ContactsRequest *crm_models.ContactRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the put contacts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutContactsParams) WithDefaults() *PutContactsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the put contacts params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutContactsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the put contacts params
|
||||||
|
func (o *PutContactsParams) WithTimeout(timeout time.Duration) *PutContactsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the put contacts params
|
||||||
|
func (o *PutContactsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the put contacts params
|
||||||
|
func (o *PutContactsParams) WithContext(ctx context.Context) *PutContactsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the put contacts params
|
||||||
|
func (o *PutContactsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the put contacts params
|
||||||
|
func (o *PutContactsParams) WithHTTPClient(client *http.Client) *PutContactsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the put contacts params
|
||||||
|
func (o *PutContactsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContactsRequest adds the contactsRequest to the put contacts params
|
||||||
|
func (o *PutContactsParams) WithContactsRequest(contactsRequest *crm_models.ContactRequest) *PutContactsParams {
|
||||||
|
o.SetContactsRequest(contactsRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContactsRequest adds the contactsRequest to the put contacts params
|
||||||
|
func (o *PutContactsParams) SetContactsRequest(contactsRequest *crm_models.ContactRequest) {
|
||||||
|
o.ContactsRequest = contactsRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PutContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.ContactsRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.ContactsRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package contacts
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PutContactsReader is a Reader for the PutContacts structure.
|
||||||
|
type PutContactsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPutContactsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPutContactsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPutContactsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPutContactsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPutContactsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPutContactsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsOK creates a PutContactsOK with default headers values
|
||||||
|
func NewPutContactsOK() *PutContactsOK {
|
||||||
|
return &PutContactsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutContactsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Contact objects
|
||||||
|
*/
|
||||||
|
type PutContactsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.ContactResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutContactsOK) GetPayload() *crm_models.ContactResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.ContactResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsUnauthorized creates a PutContactsUnauthorized with default headers values
|
||||||
|
func NewPutContactsUnauthorized() *PutContactsUnauthorized {
|
||||||
|
return &PutContactsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutContactsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PutContactsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutContactsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsForbidden creates a PutContactsForbidden with default headers values
|
||||||
|
func NewPutContactsForbidden() *PutContactsForbidden {
|
||||||
|
return &PutContactsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutContactsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PutContactsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutContactsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsNotFound creates a PutContactsNotFound with default headers values
|
||||||
|
func NewPutContactsNotFound() *PutContactsNotFound {
|
||||||
|
return &PutContactsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutContactsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PutContactsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutContactsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsUnprocessableEntity creates a PutContactsUnprocessableEntity with default headers values
|
||||||
|
func NewPutContactsUnprocessableEntity() *PutContactsUnprocessableEntity {
|
||||||
|
return &PutContactsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutContactsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PutContactsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutContactsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutContactsInternalServerError creates a PutContactsInternalServerError with default headers values
|
||||||
|
func NewPutContactsInternalServerError() *PutContactsInternalServerError {
|
||||||
|
return &PutContactsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutContactsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PutContactsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutContactsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutContactsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAccountOptionsObservableParams creates a new AccountOptionsObservableParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewAccountOptionsObservableParams() *AccountOptionsObservableParams {
|
||||||
|
return &AccountOptionsObservableParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsObservableParamsWithTimeout creates a new AccountOptionsObservableParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAccountOptionsObservableParamsWithTimeout(timeout time.Duration) *AccountOptionsObservableParams {
|
||||||
|
return &AccountOptionsObservableParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsObservableParamsWithContext creates a new AccountOptionsObservableParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAccountOptionsObservableParamsWithContext(ctx context.Context) *AccountOptionsObservableParams {
|
||||||
|
return &AccountOptionsObservableParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsObservableParamsWithHTTPClient creates a new AccountOptionsObservableParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAccountOptionsObservableParamsWithHTTPClient(client *http.Client) *AccountOptionsObservableParams {
|
||||||
|
return &AccountOptionsObservableParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AccountOptionsObservableParams contains all the parameters to send to the API endpoint
|
||||||
|
for the account options observable operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AccountOptionsObservableParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the account options observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AccountOptionsObservableParams) WithDefaults() *AccountOptionsObservableParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the account options observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AccountOptionsObservableParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the account options observable params
|
||||||
|
func (o *AccountOptionsObservableParams) WithTimeout(timeout time.Duration) *AccountOptionsObservableParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the account options observable params
|
||||||
|
func (o *AccountOptionsObservableParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the account options observable params
|
||||||
|
func (o *AccountOptionsObservableParams) WithContext(ctx context.Context) *AccountOptionsObservableParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the account options observable params
|
||||||
|
func (o *AccountOptionsObservableParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the account options observable params
|
||||||
|
func (o *AccountOptionsObservableParams) WithHTTPClient(client *http.Client) *AccountOptionsObservableParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the account options observable params
|
||||||
|
func (o *AccountOptionsObservableParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AccountOptionsObservableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccountOptionsObservableReader is a Reader for the AccountOptionsObservable structure.
|
||||||
|
type AccountOptionsObservableReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AccountOptionsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAccountOptionsObservableOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsObservableOK creates a AccountOptionsObservableOK with default headers values
|
||||||
|
func NewAccountOptionsObservableOK() *AccountOptionsObservableOK {
|
||||||
|
return &AccountOptionsObservableOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AccountOptionsObservableOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type AccountOptionsObservableOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AccountOptionsObservableOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /accounts/observable][%d] accountOptionsObservableOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AccountOptionsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAccountOptionsParams creates a new AccountOptionsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewAccountOptionsParams() *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsParamsWithTimeout creates a new AccountOptionsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAccountOptionsParamsWithTimeout(timeout time.Duration) *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsParamsWithContext creates a new AccountOptionsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAccountOptionsParamsWithContext(ctx context.Context) *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsParamsWithHTTPClient creates a new AccountOptionsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAccountOptionsParamsWithHTTPClient(client *http.Client) *AccountOptionsParams {
|
||||||
|
return &AccountOptionsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AccountOptionsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the account options operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AccountOptionsParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the account options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AccountOptionsParams) WithDefaults() *AccountOptionsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the account options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AccountOptionsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the account options params
|
||||||
|
func (o *AccountOptionsParams) WithTimeout(timeout time.Duration) *AccountOptionsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the account options params
|
||||||
|
func (o *AccountOptionsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the account options params
|
||||||
|
func (o *AccountOptionsParams) WithContext(ctx context.Context) *AccountOptionsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the account options params
|
||||||
|
func (o *AccountOptionsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the account options params
|
||||||
|
func (o *AccountOptionsParams) WithHTTPClient(client *http.Client) *AccountOptionsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the account options params
|
||||||
|
func (o *AccountOptionsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AccountOptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccountOptionsReader is a Reader for the AccountOptions structure.
|
||||||
|
type AccountOptionsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AccountOptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAccountOptionsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccountOptionsOK creates a AccountOptionsOK with default headers values
|
||||||
|
func NewAccountOptionsOK() *AccountOptionsOK {
|
||||||
|
return &AccountOptionsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AccountOptionsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type AccountOptionsOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AccountOptionsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /accounts][%d] accountOptionsOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AccountOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewCompanyObservableOptionsParams creates a new CompanyObservableOptionsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewCompanyObservableOptionsParams() *CompanyObservableOptionsParams {
|
||||||
|
return &CompanyObservableOptionsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyObservableOptionsParamsWithTimeout creates a new CompanyObservableOptionsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewCompanyObservableOptionsParamsWithTimeout(timeout time.Duration) *CompanyObservableOptionsParams {
|
||||||
|
return &CompanyObservableOptionsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyObservableOptionsParamsWithContext creates a new CompanyObservableOptionsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewCompanyObservableOptionsParamsWithContext(ctx context.Context) *CompanyObservableOptionsParams {
|
||||||
|
return &CompanyObservableOptionsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyObservableOptionsParamsWithHTTPClient creates a new CompanyObservableOptionsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewCompanyObservableOptionsParamsWithHTTPClient(client *http.Client) *CompanyObservableOptionsParams {
|
||||||
|
return &CompanyObservableOptionsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CompanyObservableOptionsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the company observable options operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type CompanyObservableOptionsParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the company observable options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *CompanyObservableOptionsParams) WithDefaults() *CompanyObservableOptionsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the company observable options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *CompanyObservableOptionsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the company observable options params
|
||||||
|
func (o *CompanyObservableOptionsParams) WithTimeout(timeout time.Duration) *CompanyObservableOptionsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the company observable options params
|
||||||
|
func (o *CompanyObservableOptionsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the company observable options params
|
||||||
|
func (o *CompanyObservableOptionsParams) WithContext(ctx context.Context) *CompanyObservableOptionsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the company observable options params
|
||||||
|
func (o *CompanyObservableOptionsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the company observable options params
|
||||||
|
func (o *CompanyObservableOptionsParams) WithHTTPClient(client *http.Client) *CompanyObservableOptionsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the company observable options params
|
||||||
|
func (o *CompanyObservableOptionsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *CompanyObservableOptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CompanyObservableOptionsReader is a Reader for the CompanyObservableOptions structure.
|
||||||
|
type CompanyObservableOptionsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *CompanyObservableOptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewCompanyObservableOptionsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyObservableOptionsOK creates a CompanyObservableOptionsOK with default headers values
|
||||||
|
func NewCompanyObservableOptionsOK() *CompanyObservableOptionsOK {
|
||||||
|
return &CompanyObservableOptionsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CompanyObservableOptionsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type CompanyObservableOptionsOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CompanyObservableOptionsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /companies/observable][%d] companyObservableOptionsOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CompanyObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewCompanyOptionsParams creates a new CompanyOptionsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewCompanyOptionsParams() *CompanyOptionsParams {
|
||||||
|
return &CompanyOptionsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyOptionsParamsWithTimeout creates a new CompanyOptionsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewCompanyOptionsParamsWithTimeout(timeout time.Duration) *CompanyOptionsParams {
|
||||||
|
return &CompanyOptionsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyOptionsParamsWithContext creates a new CompanyOptionsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewCompanyOptionsParamsWithContext(ctx context.Context) *CompanyOptionsParams {
|
||||||
|
return &CompanyOptionsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyOptionsParamsWithHTTPClient creates a new CompanyOptionsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewCompanyOptionsParamsWithHTTPClient(client *http.Client) *CompanyOptionsParams {
|
||||||
|
return &CompanyOptionsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CompanyOptionsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the company options operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type CompanyOptionsParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the company options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *CompanyOptionsParams) WithDefaults() *CompanyOptionsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the company options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *CompanyOptionsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the company options params
|
||||||
|
func (o *CompanyOptionsParams) WithTimeout(timeout time.Duration) *CompanyOptionsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the company options params
|
||||||
|
func (o *CompanyOptionsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the company options params
|
||||||
|
func (o *CompanyOptionsParams) WithContext(ctx context.Context) *CompanyOptionsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the company options params
|
||||||
|
func (o *CompanyOptionsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the company options params
|
||||||
|
func (o *CompanyOptionsParams) WithHTTPClient(client *http.Client) *CompanyOptionsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the company options params
|
||||||
|
func (o *CompanyOptionsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *CompanyOptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CompanyOptionsReader is a Reader for the CompanyOptions structure.
|
||||||
|
type CompanyOptionsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *CompanyOptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewCompanyOptionsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCompanyOptionsOK creates a CompanyOptionsOK with default headers values
|
||||||
|
func NewCompanyOptionsOK() *CompanyOptionsOK {
|
||||||
|
return &CompanyOptionsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CompanyOptionsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type CompanyOptionsOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CompanyOptionsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /companies][%d] companyOptionsOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *CompanyOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewContactOptionsObservableParams creates a new ContactOptionsObservableParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewContactOptionsObservableParams() *ContactOptionsObservableParams {
|
||||||
|
return &ContactOptionsObservableParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsObservableParamsWithTimeout creates a new ContactOptionsObservableParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewContactOptionsObservableParamsWithTimeout(timeout time.Duration) *ContactOptionsObservableParams {
|
||||||
|
return &ContactOptionsObservableParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsObservableParamsWithContext creates a new ContactOptionsObservableParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewContactOptionsObservableParamsWithContext(ctx context.Context) *ContactOptionsObservableParams {
|
||||||
|
return &ContactOptionsObservableParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsObservableParamsWithHTTPClient creates a new ContactOptionsObservableParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewContactOptionsObservableParamsWithHTTPClient(client *http.Client) *ContactOptionsObservableParams {
|
||||||
|
return &ContactOptionsObservableParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ContactOptionsObservableParams contains all the parameters to send to the API endpoint
|
||||||
|
for the contact options observable operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type ContactOptionsObservableParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the contact options observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *ContactOptionsObservableParams) WithDefaults() *ContactOptionsObservableParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the contact options observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *ContactOptionsObservableParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the contact options observable params
|
||||||
|
func (o *ContactOptionsObservableParams) WithTimeout(timeout time.Duration) *ContactOptionsObservableParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the contact options observable params
|
||||||
|
func (o *ContactOptionsObservableParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the contact options observable params
|
||||||
|
func (o *ContactOptionsObservableParams) WithContext(ctx context.Context) *ContactOptionsObservableParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the contact options observable params
|
||||||
|
func (o *ContactOptionsObservableParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the contact options observable params
|
||||||
|
func (o *ContactOptionsObservableParams) WithHTTPClient(client *http.Client) *ContactOptionsObservableParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the contact options observable params
|
||||||
|
func (o *ContactOptionsObservableParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *ContactOptionsObservableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ContactOptionsObservableReader is a Reader for the ContactOptionsObservable structure.
|
||||||
|
type ContactOptionsObservableReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *ContactOptionsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewContactOptionsObservableOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsObservableOK creates a ContactOptionsObservableOK with default headers values
|
||||||
|
func NewContactOptionsObservableOK() *ContactOptionsObservableOK {
|
||||||
|
return &ContactOptionsObservableOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ContactOptionsObservableOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type ContactOptionsObservableOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *ContactOptionsObservableOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /contacts/observable][%d] contactOptionsObservableOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *ContactOptionsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewContactOptionsParams creates a new ContactOptionsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewContactOptionsParams() *ContactOptionsParams {
|
||||||
|
return &ContactOptionsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsParamsWithTimeout creates a new ContactOptionsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewContactOptionsParamsWithTimeout(timeout time.Duration) *ContactOptionsParams {
|
||||||
|
return &ContactOptionsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsParamsWithContext creates a new ContactOptionsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewContactOptionsParamsWithContext(ctx context.Context) *ContactOptionsParams {
|
||||||
|
return &ContactOptionsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsParamsWithHTTPClient creates a new ContactOptionsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewContactOptionsParamsWithHTTPClient(client *http.Client) *ContactOptionsParams {
|
||||||
|
return &ContactOptionsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ContactOptionsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the contact options operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type ContactOptionsParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the contact options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *ContactOptionsParams) WithDefaults() *ContactOptionsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the contact options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *ContactOptionsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the contact options params
|
||||||
|
func (o *ContactOptionsParams) WithTimeout(timeout time.Duration) *ContactOptionsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the contact options params
|
||||||
|
func (o *ContactOptionsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the contact options params
|
||||||
|
func (o *ContactOptionsParams) WithContext(ctx context.Context) *ContactOptionsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the contact options params
|
||||||
|
func (o *ContactOptionsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the contact options params
|
||||||
|
func (o *ContactOptionsParams) WithHTTPClient(client *http.Client) *ContactOptionsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the contact options params
|
||||||
|
func (o *ContactOptionsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *ContactOptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ContactOptionsReader is a Reader for the ContactOptions structure.
|
||||||
|
type ContactOptionsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *ContactOptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewContactOptionsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContactOptionsOK creates a ContactOptionsOK with default headers values
|
||||||
|
func NewContactOptionsOK() *ContactOptionsOK {
|
||||||
|
return &ContactOptionsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ContactOptionsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type ContactOptionsOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *ContactOptionsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /contacts][%d] contactOptionsOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *ContactOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,363 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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 cors API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for cors API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
AccountOptions(params *AccountOptionsParams, opts ...ClientOption) (*AccountOptionsOK, error)
|
||||||
|
|
||||||
|
AccountOptionsObservable(params *AccountOptionsObservableParams, opts ...ClientOption) (*AccountOptionsObservableOK, error)
|
||||||
|
|
||||||
|
CompanyObservableOptions(params *CompanyObservableOptionsParams, opts ...ClientOption) (*CompanyObservableOptionsOK, error)
|
||||||
|
|
||||||
|
CompanyOptions(params *CompanyOptionsParams, opts ...ClientOption) (*CompanyOptionsOK, error)
|
||||||
|
|
||||||
|
ContactOptions(params *ContactOptionsParams, opts ...ClientOption) (*ContactOptionsOK, error)
|
||||||
|
|
||||||
|
ContactOptionsObservable(params *ContactOptionsObservableParams, opts ...ClientOption) (*ContactOptionsObservableOK, error)
|
||||||
|
|
||||||
|
LeadOptions(params *LeadOptionsParams, opts ...ClientOption) (*LeadOptionsOK, error)
|
||||||
|
|
||||||
|
LeadOptionsObservable(params *LeadOptionsObservableParams, opts ...ClientOption) (*LeadOptionsObservableOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AccountOptions CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) AccountOptions(params *AccountOptionsParams, opts ...ClientOption) (*AccountOptionsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewAccountOptionsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "accountOptions",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/accounts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &AccountOptionsReader{formats: a.formats},
|
||||||
|
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.(*AccountOptionsOK)
|
||||||
|
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 accountOptions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AccountOptionsObservable CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) AccountOptionsObservable(params *AccountOptionsObservableParams, opts ...ClientOption) (*AccountOptionsObservableOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewAccountOptionsObservableParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "accountOptionsObservable",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/accounts/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &AccountOptionsObservableReader{formats: a.formats},
|
||||||
|
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.(*AccountOptionsObservableOK)
|
||||||
|
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 accountOptionsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CompanyObservableOptions CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) CompanyObservableOptions(params *CompanyObservableOptionsParams, opts ...ClientOption) (*CompanyObservableOptionsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewCompanyObservableOptionsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "companyObservableOptions",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/companies/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &CompanyObservableOptionsReader{formats: a.formats},
|
||||||
|
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.(*CompanyObservableOptionsOK)
|
||||||
|
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 companyObservableOptions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CompanyOptions CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) CompanyOptions(params *CompanyOptionsParams, opts ...ClientOption) (*CompanyOptionsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewCompanyOptionsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "companyOptions",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/companies",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &CompanyOptionsReader{formats: a.formats},
|
||||||
|
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.(*CompanyOptionsOK)
|
||||||
|
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 companyOptions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ContactOptions CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) ContactOptions(params *ContactOptionsParams, opts ...ClientOption) (*ContactOptionsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewContactOptionsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "contactOptions",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/contacts",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &ContactOptionsReader{formats: a.formats},
|
||||||
|
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.(*ContactOptionsOK)
|
||||||
|
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 contactOptions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ContactOptionsObservable CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) ContactOptionsObservable(params *ContactOptionsObservableParams, opts ...ClientOption) (*ContactOptionsObservableOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewContactOptionsObservableParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "contactOptionsObservable",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/contacts/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &ContactOptionsObservableReader{formats: a.formats},
|
||||||
|
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.(*ContactOptionsObservableOK)
|
||||||
|
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 contactOptionsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
LeadOptions CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) LeadOptions(params *LeadOptionsParams, opts ...ClientOption) (*LeadOptionsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewLeadOptionsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "leadOptions",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/leads",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &LeadOptionsReader{formats: a.formats},
|
||||||
|
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.(*LeadOptionsOK)
|
||||||
|
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 leadOptions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
LeadOptionsObservable CORS support
|
||||||
|
*/
|
||||||
|
func (a *Client) LeadOptionsObservable(params *LeadOptionsObservableParams, opts ...ClientOption) (*LeadOptionsObservableOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewLeadOptionsObservableParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "leadOptionsObservable",
|
||||||
|
Method: "OPTIONS",
|
||||||
|
PathPattern: "/leads/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &LeadOptionsObservableReader{formats: a.formats},
|
||||||
|
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.(*LeadOptionsObservableOK)
|
||||||
|
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 leadOptionsObservable: 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
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewLeadOptionsObservableParams creates a new LeadOptionsObservableParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewLeadOptionsObservableParams() *LeadOptionsObservableParams {
|
||||||
|
return &LeadOptionsObservableParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsObservableParamsWithTimeout creates a new LeadOptionsObservableParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewLeadOptionsObservableParamsWithTimeout(timeout time.Duration) *LeadOptionsObservableParams {
|
||||||
|
return &LeadOptionsObservableParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsObservableParamsWithContext creates a new LeadOptionsObservableParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewLeadOptionsObservableParamsWithContext(ctx context.Context) *LeadOptionsObservableParams {
|
||||||
|
return &LeadOptionsObservableParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsObservableParamsWithHTTPClient creates a new LeadOptionsObservableParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewLeadOptionsObservableParamsWithHTTPClient(client *http.Client) *LeadOptionsObservableParams {
|
||||||
|
return &LeadOptionsObservableParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LeadOptionsObservableParams contains all the parameters to send to the API endpoint
|
||||||
|
for the lead options observable operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type LeadOptionsObservableParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the lead options observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *LeadOptionsObservableParams) WithDefaults() *LeadOptionsObservableParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the lead options observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *LeadOptionsObservableParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the lead options observable params
|
||||||
|
func (o *LeadOptionsObservableParams) WithTimeout(timeout time.Duration) *LeadOptionsObservableParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the lead options observable params
|
||||||
|
func (o *LeadOptionsObservableParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the lead options observable params
|
||||||
|
func (o *LeadOptionsObservableParams) WithContext(ctx context.Context) *LeadOptionsObservableParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the lead options observable params
|
||||||
|
func (o *LeadOptionsObservableParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the lead options observable params
|
||||||
|
func (o *LeadOptionsObservableParams) WithHTTPClient(client *http.Client) *LeadOptionsObservableParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the lead options observable params
|
||||||
|
func (o *LeadOptionsObservableParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *LeadOptionsObservableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LeadOptionsObservableReader is a Reader for the LeadOptionsObservable structure.
|
||||||
|
type LeadOptionsObservableReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *LeadOptionsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewLeadOptionsObservableOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsObservableOK creates a LeadOptionsObservableOK with default headers values
|
||||||
|
func NewLeadOptionsObservableOK() *LeadOptionsObservableOK {
|
||||||
|
return &LeadOptionsObservableOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LeadOptionsObservableOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type LeadOptionsObservableOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *LeadOptionsObservableOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /leads/observable][%d] leadOptionsObservableOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *LeadOptionsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewLeadOptionsParams creates a new LeadOptionsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewLeadOptionsParams() *LeadOptionsParams {
|
||||||
|
return &LeadOptionsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsParamsWithTimeout creates a new LeadOptionsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewLeadOptionsParamsWithTimeout(timeout time.Duration) *LeadOptionsParams {
|
||||||
|
return &LeadOptionsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsParamsWithContext creates a new LeadOptionsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewLeadOptionsParamsWithContext(ctx context.Context) *LeadOptionsParams {
|
||||||
|
return &LeadOptionsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsParamsWithHTTPClient creates a new LeadOptionsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewLeadOptionsParamsWithHTTPClient(client *http.Client) *LeadOptionsParams {
|
||||||
|
return &LeadOptionsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LeadOptionsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the lead options operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type LeadOptionsParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the lead options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *LeadOptionsParams) WithDefaults() *LeadOptionsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the lead options params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *LeadOptionsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the lead options params
|
||||||
|
func (o *LeadOptionsParams) WithTimeout(timeout time.Duration) *LeadOptionsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the lead options params
|
||||||
|
func (o *LeadOptionsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the lead options params
|
||||||
|
func (o *LeadOptionsParams) WithContext(ctx context.Context) *LeadOptionsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the lead options params
|
||||||
|
func (o *LeadOptionsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the lead options params
|
||||||
|
func (o *LeadOptionsParams) WithHTTPClient(client *http.Client) *LeadOptionsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the lead options params
|
||||||
|
func (o *LeadOptionsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *LeadOptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package cors
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LeadOptionsReader is a Reader for the LeadOptions structure.
|
||||||
|
type LeadOptionsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *LeadOptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewLeadOptionsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLeadOptionsOK creates a LeadOptionsOK with default headers values
|
||||||
|
func NewLeadOptionsOK() *LeadOptionsOK {
|
||||||
|
return &LeadOptionsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LeadOptionsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
CORS OPTIONS response
|
||||||
|
*/
|
||||||
|
type LeadOptionsOK struct {
|
||||||
|
AccessControlAllowCredentials string
|
||||||
|
AccessControlAllowHeaders string
|
||||||
|
AccessControlAllowMethods string
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
AccessControlExposeHeaders string
|
||||||
|
AccessControlMaxAge string
|
||||||
|
CacheControl string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *LeadOptionsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[OPTIONS /leads][%d] leadOptionsOK ", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *LeadOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Credentials
|
||||||
|
hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowCredentials != "" {
|
||||||
|
o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Headers
|
||||||
|
hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowHeaders != "" {
|
||||||
|
o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Methods
|
||||||
|
hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowMethods != "" {
|
||||||
|
o.AccessControlAllowMethods = hdrAccessControlAllowMethods
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Expose-Headers
|
||||||
|
hdrAccessControlExposeHeaders := response.GetHeader("Access-Control-Expose-Headers")
|
||||||
|
|
||||||
|
if hdrAccessControlExposeHeaders != "" {
|
||||||
|
o.AccessControlExposeHeaders = hdrAccessControlExposeHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Max-Age
|
||||||
|
hdrAccessControlMaxAge := response.GetHeader("Access-Control-Max-Age")
|
||||||
|
|
||||||
|
if hdrAccessControlMaxAge != "" {
|
||||||
|
o.AccessControlMaxAge = hdrAccessControlMaxAge
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,136 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package crm_client
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_client/accounts"
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_client/companies"
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_client/contacts"
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_client/cors"
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_client/leads"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Default crm HTTP client.
|
||||||
|
var Default = NewHTTPClient(nil)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// DefaultHost is the default Host
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultHost string = "crm.infra.tnxs.net:8080"
|
||||||
|
// DefaultBasePath is the default BasePath
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultBasePath string = "/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
|
||||||
|
var DefaultSchemes = []string{"http"}
|
||||||
|
|
||||||
|
// NewHTTPClient creates a new crm HTTP client.
|
||||||
|
func NewHTTPClient(formats strfmt.Registry) *Crm {
|
||||||
|
return NewHTTPClientWithConfig(formats, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHTTPClientWithConfig creates a new crm HTTP client,
|
||||||
|
// using a customizable transport config.
|
||||||
|
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Crm {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if cfg == nil {
|
||||||
|
cfg = DefaultTransportConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
// create transport and client
|
||||||
|
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
|
||||||
|
return New(transport, formats)
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new crm client
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Crm {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if formats == nil {
|
||||||
|
formats = strfmt.Default
|
||||||
|
}
|
||||||
|
|
||||||
|
cli := new(Crm)
|
||||||
|
cli.Transport = transport
|
||||||
|
cli.Accounts = accounts.New(transport, formats)
|
||||||
|
cli.Companies = companies.New(transport, formats)
|
||||||
|
cli.Contacts = contacts.New(transport, formats)
|
||||||
|
cli.Cors = cors.New(transport, formats)
|
||||||
|
cli.Leads = leads.New(transport, formats)
|
||||||
|
return cli
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultTransportConfig creates a TransportConfig with the
|
||||||
|
// default settings taken from the meta section of the spec file.
|
||||||
|
func DefaultTransportConfig() *TransportConfig {
|
||||||
|
return &TransportConfig{
|
||||||
|
Host: DefaultHost,
|
||||||
|
BasePath: DefaultBasePath,
|
||||||
|
Schemes: DefaultSchemes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TransportConfig contains the transport related info,
|
||||||
|
// found in the meta section of the spec file.
|
||||||
|
type TransportConfig struct {
|
||||||
|
Host string
|
||||||
|
BasePath string
|
||||||
|
Schemes []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHost overrides the default host,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
|
||||||
|
cfg.Host = host
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBasePath overrides the default basePath,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
|
||||||
|
cfg.BasePath = basePath
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSchemes overrides the default schemes,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
||||||
|
cfg.Schemes = schemes
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crm is a client for crm
|
||||||
|
type Crm struct {
|
||||||
|
Accounts accounts.ClientService
|
||||||
|
|
||||||
|
Companies companies.ClientService
|
||||||
|
|
||||||
|
Contacts contacts.ClientService
|
||||||
|
|
||||||
|
Cors cors.ClientService
|
||||||
|
|
||||||
|
Leads leads.ClientService
|
||||||
|
|
||||||
|
Transport runtime.ClientTransport
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransport changes the transport on the client and all its subresources
|
||||||
|
func (c *Crm) SetTransport(transport runtime.ClientTransport) {
|
||||||
|
c.Transport = transport
|
||||||
|
c.Accounts.SetTransport(transport)
|
||||||
|
c.Companies.SetTransport(transport)
|
||||||
|
c.Contacts.SetTransport(transport)
|
||||||
|
c.Cors.SetTransport(transport)
|
||||||
|
c.Leads.SetTransport(transport)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewDeleteLeadParams creates a new DeleteLeadParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewDeleteLeadParams() *DeleteLeadParams {
|
||||||
|
return &DeleteLeadParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadParamsWithTimeout creates a new DeleteLeadParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewDeleteLeadParamsWithTimeout(timeout time.Duration) *DeleteLeadParams {
|
||||||
|
return &DeleteLeadParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadParamsWithContext creates a new DeleteLeadParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewDeleteLeadParamsWithContext(ctx context.Context) *DeleteLeadParams {
|
||||||
|
return &DeleteLeadParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadParamsWithHTTPClient creates a new DeleteLeadParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewDeleteLeadParamsWithHTTPClient(client *http.Client) *DeleteLeadParams {
|
||||||
|
return &DeleteLeadParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteLeadParams contains all the parameters to send to the API endpoint
|
||||||
|
for the delete lead operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type DeleteLeadParams struct {
|
||||||
|
|
||||||
|
/* LeadID.
|
||||||
|
|
||||||
|
Telnexus Lead record ID
|
||||||
|
*/
|
||||||
|
LeadID *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the delete lead params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteLeadParams) WithDefaults() *DeleteLeadParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the delete lead params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *DeleteLeadParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) WithTimeout(timeout time.Duration) *DeleteLeadParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) WithContext(ctx context.Context) *DeleteLeadParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) WithHTTPClient(client *http.Client) *DeleteLeadParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLeadID adds the leadID to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) WithLeadID(leadID *string) *DeleteLeadParams {
|
||||||
|
o.SetLeadID(leadID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLeadID adds the leadId to the delete lead params
|
||||||
|
func (o *DeleteLeadParams) SetLeadID(leadID *string) {
|
||||||
|
o.LeadID = leadID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *DeleteLeadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.LeadID != nil {
|
||||||
|
|
||||||
|
// query param leadId
|
||||||
|
var qrLeadID string
|
||||||
|
|
||||||
|
if o.LeadID != nil {
|
||||||
|
qrLeadID = *o.LeadID
|
||||||
|
}
|
||||||
|
qLeadID := qrLeadID
|
||||||
|
if qLeadID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("leadId", qLeadID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,315 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteLeadReader is a Reader for the DeleteLead structure.
|
||||||
|
type DeleteLeadReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewDeleteLeadOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewDeleteLeadUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewDeleteLeadForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewDeleteLeadNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewDeleteLeadUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewDeleteLeadInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadOK creates a DeleteLeadOK with default headers values
|
||||||
|
func NewDeleteLeadOK() *DeleteLeadOK {
|
||||||
|
return &DeleteLeadOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteLeadOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with Message Objects with Delete Status
|
||||||
|
*/
|
||||||
|
type DeleteLeadOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.DeleteResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadOK) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteLeadOK) GetPayload() *crm_models.DeleteResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.DeleteResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadUnauthorized creates a DeleteLeadUnauthorized with default headers values
|
||||||
|
func NewDeleteLeadUnauthorized() *DeleteLeadUnauthorized {
|
||||||
|
return &DeleteLeadUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteLeadUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type DeleteLeadUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteLeadUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadForbidden creates a DeleteLeadForbidden with default headers values
|
||||||
|
func NewDeleteLeadForbidden() *DeleteLeadForbidden {
|
||||||
|
return &DeleteLeadForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteLeadForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type DeleteLeadForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteLeadForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadNotFound creates a DeleteLeadNotFound with default headers values
|
||||||
|
func NewDeleteLeadNotFound() *DeleteLeadNotFound {
|
||||||
|
return &DeleteLeadNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteLeadNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type DeleteLeadNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteLeadNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadUnprocessableEntity creates a DeleteLeadUnprocessableEntity with default headers values
|
||||||
|
func NewDeleteLeadUnprocessableEntity() *DeleteLeadUnprocessableEntity {
|
||||||
|
return &DeleteLeadUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteLeadUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type DeleteLeadUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteLeadUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDeleteLeadInternalServerError creates a DeleteLeadInternalServerError with default headers values
|
||||||
|
func NewDeleteLeadInternalServerError() *DeleteLeadInternalServerError {
|
||||||
|
return &DeleteLeadInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeleteLeadInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type DeleteLeadInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *DeleteLeadInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *DeleteLeadInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetLeadsObservableParams creates a new GetLeadsObservableParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetLeadsObservableParams() *GetLeadsObservableParams {
|
||||||
|
return &GetLeadsObservableParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableParamsWithTimeout creates a new GetLeadsObservableParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetLeadsObservableParamsWithTimeout(timeout time.Duration) *GetLeadsObservableParams {
|
||||||
|
return &GetLeadsObservableParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableParamsWithContext creates a new GetLeadsObservableParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetLeadsObservableParamsWithContext(ctx context.Context) *GetLeadsObservableParams {
|
||||||
|
return &GetLeadsObservableParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableParamsWithHTTPClient creates a new GetLeadsObservableParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetLeadsObservableParamsWithHTTPClient(client *http.Client) *GetLeadsObservableParams {
|
||||||
|
return &GetLeadsObservableParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsObservableParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get leads observable operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetLeadsObservableParams struct {
|
||||||
|
|
||||||
|
/* Email.
|
||||||
|
|
||||||
|
Email address used for identity lookup
|
||||||
|
*/
|
||||||
|
Email *string
|
||||||
|
|
||||||
|
/* LeadID.
|
||||||
|
|
||||||
|
Telnexus Lead record ID
|
||||||
|
*/
|
||||||
|
LeadID *string
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
The Name of this Object
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get leads observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetLeadsObservableParams) WithDefaults() *GetLeadsObservableParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get leads observable params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetLeadsObservableParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) WithTimeout(timeout time.Duration) *GetLeadsObservableParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) WithContext(ctx context.Context) *GetLeadsObservableParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) WithHTTPClient(client *http.Client) *GetLeadsObservableParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithEmail adds the email to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) WithEmail(email *string) *GetLeadsObservableParams {
|
||||||
|
o.SetEmail(email)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEmail adds the email to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) SetEmail(email *string) {
|
||||||
|
o.Email = email
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLeadID adds the leadID to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) WithLeadID(leadID *string) *GetLeadsObservableParams {
|
||||||
|
o.SetLeadID(leadID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLeadID adds the leadId to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) SetLeadID(leadID *string) {
|
||||||
|
o.LeadID = leadID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) WithName(name *string) *GetLeadsObservableParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the get leads observable params
|
||||||
|
func (o *GetLeadsObservableParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetLeadsObservableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
|
||||||
|
// query param email
|
||||||
|
var qrEmail string
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
qrEmail = *o.Email
|
||||||
|
}
|
||||||
|
qEmail := qrEmail
|
||||||
|
if qEmail != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("email", qEmail); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.LeadID != nil {
|
||||||
|
|
||||||
|
// query param leadId
|
||||||
|
var qrLeadID string
|
||||||
|
|
||||||
|
if o.LeadID != nil {
|
||||||
|
qrLeadID = *o.LeadID
|
||||||
|
}
|
||||||
|
qLeadID := qrLeadID
|
||||||
|
if qLeadID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("leadId", qLeadID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,321 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetLeadsObservableReader is a Reader for the GetLeadsObservable structure.
|
||||||
|
type GetLeadsObservableReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetLeadsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetLeadsObservableOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetLeadsObservableUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetLeadsObservableForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetLeadsObservableNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetLeadsObservableUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetLeadsObservableInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableOK creates a GetLeadsObservableOK with default headers values
|
||||||
|
func NewGetLeadsObservableOK() *GetLeadsObservableOK {
|
||||||
|
return &GetLeadsObservableOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsObservableOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Lead objects
|
||||||
|
*/
|
||||||
|
type GetLeadsObservableOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload []*crm_models.Lead
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsObservableOK) GetPayload() []*crm_models.Lead {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableUnauthorized creates a GetLeadsObservableUnauthorized with default headers values
|
||||||
|
func NewGetLeadsObservableUnauthorized() *GetLeadsObservableUnauthorized {
|
||||||
|
return &GetLeadsObservableUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsObservableUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetLeadsObservableUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsObservableUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableForbidden creates a GetLeadsObservableForbidden with default headers values
|
||||||
|
func NewGetLeadsObservableForbidden() *GetLeadsObservableForbidden {
|
||||||
|
return &GetLeadsObservableForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsObservableForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetLeadsObservableForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsObservableForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableNotFound creates a GetLeadsObservableNotFound with default headers values
|
||||||
|
func NewGetLeadsObservableNotFound() *GetLeadsObservableNotFound {
|
||||||
|
return &GetLeadsObservableNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsObservableNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetLeadsObservableNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsObservableNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableUnprocessableEntity creates a GetLeadsObservableUnprocessableEntity with default headers values
|
||||||
|
func NewGetLeadsObservableUnprocessableEntity() *GetLeadsObservableUnprocessableEntity {
|
||||||
|
return &GetLeadsObservableUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsObservableUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetLeadsObservableUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsObservableUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsObservableInternalServerError creates a GetLeadsObservableInternalServerError with default headers values
|
||||||
|
func NewGetLeadsObservableInternalServerError() *GetLeadsObservableInternalServerError {
|
||||||
|
return &GetLeadsObservableInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsObservableInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetLeadsObservableInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsObservableInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,306 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGetLeadsParams creates a new GetLeadsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewGetLeadsParams() *GetLeadsParams {
|
||||||
|
return &GetLeadsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsParamsWithTimeout creates a new GetLeadsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewGetLeadsParamsWithTimeout(timeout time.Duration) *GetLeadsParams {
|
||||||
|
return &GetLeadsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsParamsWithContext creates a new GetLeadsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewGetLeadsParamsWithContext(ctx context.Context) *GetLeadsParams {
|
||||||
|
return &GetLeadsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsParamsWithHTTPClient creates a new GetLeadsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewGetLeadsParamsWithHTTPClient(client *http.Client) *GetLeadsParams {
|
||||||
|
return &GetLeadsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the get leads operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type GetLeadsParams struct {
|
||||||
|
|
||||||
|
/* Email.
|
||||||
|
|
||||||
|
Email address used for identity lookup
|
||||||
|
*/
|
||||||
|
Email *string
|
||||||
|
|
||||||
|
/* LeadID.
|
||||||
|
|
||||||
|
Telnexus Lead record ID
|
||||||
|
*/
|
||||||
|
LeadID *string
|
||||||
|
|
||||||
|
/* Limit.
|
||||||
|
|
||||||
|
How many objects to return at one time
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Limit *int64
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
The Name of this Object
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
/* Offset.
|
||||||
|
|
||||||
|
How many objects to skip?
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Offset *int64
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the get leads params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetLeadsParams) WithDefaults() *GetLeadsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the get leads params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *GetLeadsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithTimeout(timeout time.Duration) *GetLeadsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithContext(ctx context.Context) *GetLeadsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithHTTPClient(client *http.Client) *GetLeadsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithEmail adds the email to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithEmail(email *string) *GetLeadsParams {
|
||||||
|
o.SetEmail(email)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEmail adds the email to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetEmail(email *string) {
|
||||||
|
o.Email = email
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLeadID adds the leadID to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithLeadID(leadID *string) *GetLeadsParams {
|
||||||
|
o.SetLeadID(leadID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLeadID adds the leadId to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetLeadID(leadID *string) {
|
||||||
|
o.LeadID = leadID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithLimit(limit *int64) *GetLeadsParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithName(name *string) *GetLeadsParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOffset adds the offset to the get leads params
|
||||||
|
func (o *GetLeadsParams) WithOffset(offset *int64) *GetLeadsParams {
|
||||||
|
o.SetOffset(offset)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOffset adds the offset to the get leads params
|
||||||
|
func (o *GetLeadsParams) SetOffset(offset *int64) {
|
||||||
|
o.Offset = offset
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
|
||||||
|
// query param email
|
||||||
|
var qrEmail string
|
||||||
|
|
||||||
|
if o.Email != nil {
|
||||||
|
qrEmail = *o.Email
|
||||||
|
}
|
||||||
|
qEmail := qrEmail
|
||||||
|
if qEmail != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("email", qEmail); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.LeadID != nil {
|
||||||
|
|
||||||
|
// query param leadId
|
||||||
|
var qrLeadID string
|
||||||
|
|
||||||
|
if o.LeadID != nil {
|
||||||
|
qrLeadID = *o.LeadID
|
||||||
|
}
|
||||||
|
qLeadID := qrLeadID
|
||||||
|
if qLeadID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("leadId", qLeadID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
|
||||||
|
// query param limit
|
||||||
|
var qrLimit int64
|
||||||
|
|
||||||
|
if o.Limit != nil {
|
||||||
|
qrLimit = *o.Limit
|
||||||
|
}
|
||||||
|
qLimit := swag.FormatInt64(qrLimit)
|
||||||
|
if qLimit != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
|
||||||
|
// query param offset
|
||||||
|
var qrOffset int64
|
||||||
|
|
||||||
|
if o.Offset != nil {
|
||||||
|
qrOffset = *o.Offset
|
||||||
|
}
|
||||||
|
qOffset := swag.FormatInt64(qrOffset)
|
||||||
|
if qOffset != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("offset", qOffset); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetLeadsReader is a Reader for the GetLeads structure.
|
||||||
|
type GetLeadsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewGetLeadsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewGetLeadsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewGetLeadsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewGetLeadsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewGetLeadsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewGetLeadsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsOK creates a GetLeadsOK with default headers values
|
||||||
|
func NewGetLeadsOK() *GetLeadsOK {
|
||||||
|
return &GetLeadsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Lead objects
|
||||||
|
*/
|
||||||
|
type GetLeadsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.LeadResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads][%d] getLeadsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsOK) GetPayload() *crm_models.LeadResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.LeadResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsUnauthorized creates a GetLeadsUnauthorized with default headers values
|
||||||
|
func NewGetLeadsUnauthorized() *GetLeadsUnauthorized {
|
||||||
|
return &GetLeadsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type GetLeadsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsForbidden creates a GetLeadsForbidden with default headers values
|
||||||
|
func NewGetLeadsForbidden() *GetLeadsForbidden {
|
||||||
|
return &GetLeadsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type GetLeadsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsNotFound creates a GetLeadsNotFound with default headers values
|
||||||
|
func NewGetLeadsNotFound() *GetLeadsNotFound {
|
||||||
|
return &GetLeadsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type GetLeadsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsUnprocessableEntity creates a GetLeadsUnprocessableEntity with default headers values
|
||||||
|
func NewGetLeadsUnprocessableEntity() *GetLeadsUnprocessableEntity {
|
||||||
|
return &GetLeadsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type GetLeadsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGetLeadsInternalServerError creates a GetLeadsInternalServerError with default headers values
|
||||||
|
func NewGetLeadsInternalServerError() *GetLeadsInternalServerError {
|
||||||
|
return &GetLeadsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GetLeadsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type GetLeadsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *GetLeadsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *GetLeadsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,258 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// 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 leads API client.
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||||
|
return &Client{transport: transport, formats: formats}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Client for leads API
|
||||||
|
*/
|
||||||
|
type Client struct {
|
||||||
|
transport runtime.ClientTransport
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientOption is the option for Client methods
|
||||||
|
type ClientOption func(*runtime.ClientOperation)
|
||||||
|
|
||||||
|
// ClientService is the interface for Client methods
|
||||||
|
type ClientService interface {
|
||||||
|
DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error)
|
||||||
|
|
||||||
|
GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error)
|
||||||
|
|
||||||
|
GetLeadsObservable(params *GetLeadsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsObservableOK, error)
|
||||||
|
|
||||||
|
PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error)
|
||||||
|
|
||||||
|
PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error)
|
||||||
|
|
||||||
|
SetTransport(transport runtime.ClientTransport)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DeleteLead deletes a contact
|
||||||
|
|
||||||
|
Delete Telnexus Lead record
|
||||||
|
*/
|
||||||
|
func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewDeleteLeadParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "deleteLead",
|
||||||
|
Method: "DELETE",
|
||||||
|
PathPattern: "/leads",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &DeleteLeadReader{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.(*DeleteLeadOK)
|
||||||
|
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 deleteLead: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetLeads gets a list of contacts
|
||||||
|
|
||||||
|
Return a list of all available Leads
|
||||||
|
*/
|
||||||
|
func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetLeadsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getLeads",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/leads",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetLeadsReader{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.(*GetLeadsOK)
|
||||||
|
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 getLeads: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
GetLeadsObservable gets telnexus leads in an observable array
|
||||||
|
|
||||||
|
A list of leads in a simple JSON array
|
||||||
|
*/
|
||||||
|
func (a *Client) GetLeadsObservable(params *GetLeadsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsObservableOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewGetLeadsObservableParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "getLeadsObservable",
|
||||||
|
Method: "GET",
|
||||||
|
PathPattern: "/leads/observable",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &GetLeadsObservableReader{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.(*GetLeadsObservableOK)
|
||||||
|
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 getLeadsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PostLeads adds new leads
|
||||||
|
|
||||||
|
Lead records to be added
|
||||||
|
*/
|
||||||
|
func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPostLeadsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "postLeads",
|
||||||
|
Method: "POST",
|
||||||
|
PathPattern: "/leads",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PostLeadsReader{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.(*PostLeadsOK)
|
||||||
|
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 postLeads: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PutLeads updates leads
|
||||||
|
|
||||||
|
Update Lead records
|
||||||
|
*/
|
||||||
|
func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) {
|
||||||
|
// TODO: Validate the params before sending
|
||||||
|
if params == nil {
|
||||||
|
params = NewPutLeadsParams()
|
||||||
|
}
|
||||||
|
op := &runtime.ClientOperation{
|
||||||
|
ID: "putLeads",
|
||||||
|
Method: "PUT",
|
||||||
|
PathPattern: "/leads",
|
||||||
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
|
Schemes: []string{"http"},
|
||||||
|
Params: params,
|
||||||
|
Reader: &PutLeadsReader{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.(*PutLeadsOK)
|
||||||
|
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 putLeads: 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
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPostLeadsParams creates a new PostLeadsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPostLeadsParams() *PostLeadsParams {
|
||||||
|
return &PostLeadsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsParamsWithTimeout creates a new PostLeadsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPostLeadsParamsWithTimeout(timeout time.Duration) *PostLeadsParams {
|
||||||
|
return &PostLeadsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsParamsWithContext creates a new PostLeadsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPostLeadsParamsWithContext(ctx context.Context) *PostLeadsParams {
|
||||||
|
return &PostLeadsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsParamsWithHTTPClient creates a new PostLeadsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPostLeadsParamsWithHTTPClient(client *http.Client) *PostLeadsParams {
|
||||||
|
return &PostLeadsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostLeadsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the post leads operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PostLeadsParams struct {
|
||||||
|
|
||||||
|
/* LeadRequest.
|
||||||
|
|
||||||
|
An array of new Lead records
|
||||||
|
*/
|
||||||
|
LeadRequest *crm_models.LeadRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the post leads params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostLeadsParams) WithDefaults() *PostLeadsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the post leads params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PostLeadsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the post leads params
|
||||||
|
func (o *PostLeadsParams) WithTimeout(timeout time.Duration) *PostLeadsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the post leads params
|
||||||
|
func (o *PostLeadsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the post leads params
|
||||||
|
func (o *PostLeadsParams) WithContext(ctx context.Context) *PostLeadsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the post leads params
|
||||||
|
func (o *PostLeadsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the post leads params
|
||||||
|
func (o *PostLeadsParams) WithHTTPClient(client *http.Client) *PostLeadsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the post leads params
|
||||||
|
func (o *PostLeadsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLeadRequest adds the leadRequest to the post leads params
|
||||||
|
func (o *PostLeadsParams) WithLeadRequest(leadRequest *crm_models.LeadRequest) *PostLeadsParams {
|
||||||
|
o.SetLeadRequest(leadRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLeadRequest adds the leadRequest to the post leads params
|
||||||
|
func (o *PostLeadsParams) SetLeadRequest(leadRequest *crm_models.LeadRequest) {
|
||||||
|
o.LeadRequest = leadRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PostLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.LeadRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.LeadRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PostLeadsReader is a Reader for the PostLeads structure.
|
||||||
|
type PostLeadsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPostLeadsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPostLeadsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPostLeadsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPostLeadsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPostLeadsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPostLeadsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsOK creates a PostLeadsOK with default headers values
|
||||||
|
func NewPostLeadsOK() *PostLeadsOK {
|
||||||
|
return &PostLeadsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostLeadsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Lead objects
|
||||||
|
*/
|
||||||
|
type PostLeadsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.LeadResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /leads][%d] postLeadsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostLeadsOK) GetPayload() *crm_models.LeadResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.LeadResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsUnauthorized creates a PostLeadsUnauthorized with default headers values
|
||||||
|
func NewPostLeadsUnauthorized() *PostLeadsUnauthorized {
|
||||||
|
return &PostLeadsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostLeadsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PostLeadsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostLeadsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsForbidden creates a PostLeadsForbidden with default headers values
|
||||||
|
func NewPostLeadsForbidden() *PostLeadsForbidden {
|
||||||
|
return &PostLeadsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostLeadsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PostLeadsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostLeadsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsNotFound creates a PostLeadsNotFound with default headers values
|
||||||
|
func NewPostLeadsNotFound() *PostLeadsNotFound {
|
||||||
|
return &PostLeadsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostLeadsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PostLeadsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostLeadsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsUnprocessableEntity creates a PostLeadsUnprocessableEntity with default headers values
|
||||||
|
func NewPostLeadsUnprocessableEntity() *PostLeadsUnprocessableEntity {
|
||||||
|
return &PostLeadsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostLeadsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PostLeadsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPostLeadsInternalServerError creates a PostLeadsInternalServerError with default headers values
|
||||||
|
func NewPostLeadsInternalServerError() *PostLeadsInternalServerError {
|
||||||
|
return &PostLeadsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PostLeadsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PostLeadsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PostLeadsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PostLeadsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
cr "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPutLeadsParams creates a new PutLeadsParams object,
|
||||||
|
// with the default timeout for this client.
|
||||||
|
//
|
||||||
|
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||||
|
//
|
||||||
|
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||||
|
func NewPutLeadsParams() *PutLeadsParams {
|
||||||
|
return &PutLeadsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsParamsWithTimeout creates a new PutLeadsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewPutLeadsParamsWithTimeout(timeout time.Duration) *PutLeadsParams {
|
||||||
|
return &PutLeadsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsParamsWithContext creates a new PutLeadsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewPutLeadsParamsWithContext(ctx context.Context) *PutLeadsParams {
|
||||||
|
return &PutLeadsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsParamsWithHTTPClient creates a new PutLeadsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewPutLeadsParamsWithHTTPClient(client *http.Client) *PutLeadsParams {
|
||||||
|
return &PutLeadsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutLeadsParams contains all the parameters to send to the API endpoint
|
||||||
|
for the put leads operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type PutLeadsParams struct {
|
||||||
|
|
||||||
|
/* LeadRequest.
|
||||||
|
|
||||||
|
An array of new Lead records
|
||||||
|
*/
|
||||||
|
LeadRequest *crm_models.LeadRequest
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the put leads params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutLeadsParams) WithDefaults() *PutLeadsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the put leads params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *PutLeadsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the put leads params
|
||||||
|
func (o *PutLeadsParams) WithTimeout(timeout time.Duration) *PutLeadsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the put leads params
|
||||||
|
func (o *PutLeadsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the put leads params
|
||||||
|
func (o *PutLeadsParams) WithContext(ctx context.Context) *PutLeadsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the put leads params
|
||||||
|
func (o *PutLeadsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the put leads params
|
||||||
|
func (o *PutLeadsParams) WithHTTPClient(client *http.Client) *PutLeadsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the put leads params
|
||||||
|
func (o *PutLeadsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLeadRequest adds the leadRequest to the put leads params
|
||||||
|
func (o *PutLeadsParams) WithLeadRequest(leadRequest *crm_models.LeadRequest) *PutLeadsParams {
|
||||||
|
o.SetLeadRequest(leadRequest)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLeadRequest adds the leadRequest to the put leads params
|
||||||
|
func (o *PutLeadsParams) SetLeadRequest(leadRequest *crm_models.LeadRequest) {
|
||||||
|
o.LeadRequest = leadRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *PutLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.LeadRequest != nil {
|
||||||
|
if err := r.SetBodyParam(o.LeadRequest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// (c) 2012-2020 by Telnexus LLC
|
||||||
|
// All rights reserved worldwide.
|
||||||
|
// Proprietary product; unlicensed use is not allowed
|
||||||
|
|
||||||
|
package leads
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"code.tnxs.net/telnexus/lib/api/crm/crm_models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PutLeadsReader is a Reader for the PutLeads structure.
|
||||||
|
type PutLeadsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewPutLeadsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 401:
|
||||||
|
result := NewPutLeadsUnauthorized()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewPutLeadsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewPutLeadsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewPutLeadsUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 500:
|
||||||
|
result := NewPutLeadsInternalServerError()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsOK creates a PutLeadsOK with default headers values
|
||||||
|
func NewPutLeadsOK() *PutLeadsOK {
|
||||||
|
return &PutLeadsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutLeadsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Telnexus Response with an array of Lead objects
|
||||||
|
*/
|
||||||
|
type PutLeadsOK struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
CacheControl string
|
||||||
|
|
||||||
|
Payload *crm_models.LeadResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsOK) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %+v", 200, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutLeadsOK) GetPayload() *crm_models.LeadResponse {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
// hydrates response header Cache-Control
|
||||||
|
hdrCacheControl := response.GetHeader("Cache-Control")
|
||||||
|
|
||||||
|
if hdrCacheControl != "" {
|
||||||
|
o.CacheControl = hdrCacheControl
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.LeadResponse)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsUnauthorized creates a PutLeadsUnauthorized with default headers values
|
||||||
|
func NewPutLeadsUnauthorized() *PutLeadsUnauthorized {
|
||||||
|
return &PutLeadsUnauthorized{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutLeadsUnauthorized describes a response with status code 401, with default header values.
|
||||||
|
|
||||||
|
Access unauthorized, invalid API-KEY was used
|
||||||
|
*/
|
||||||
|
type PutLeadsUnauthorized struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsUnauthorized) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %+v", 401, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutLeadsUnauthorized) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsForbidden creates a PutLeadsForbidden with default headers values
|
||||||
|
func NewPutLeadsForbidden() *PutLeadsForbidden {
|
||||||
|
return &PutLeadsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutLeadsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
Access forbidden, account lacks access
|
||||||
|
*/
|
||||||
|
type PutLeadsForbidden struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %+v", 403, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutLeadsForbidden) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsNotFound creates a PutLeadsNotFound with default headers values
|
||||||
|
func NewPutLeadsNotFound() *PutLeadsNotFound {
|
||||||
|
return &PutLeadsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutLeadsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
Resource was not found
|
||||||
|
*/
|
||||||
|
type PutLeadsNotFound struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %+v", 404, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutLeadsNotFound) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsUnprocessableEntity creates a PutLeadsUnprocessableEntity with default headers values
|
||||||
|
func NewPutLeadsUnprocessableEntity() *PutLeadsUnprocessableEntity {
|
||||||
|
return &PutLeadsUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutLeadsUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
Unprocessable Entity, likely a bad parameter
|
||||||
|
*/
|
||||||
|
type PutLeadsUnprocessableEntity struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %+v", 422, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutLeadsUnprocessableEntity) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPutLeadsInternalServerError creates a PutLeadsInternalServerError with default headers values
|
||||||
|
func NewPutLeadsInternalServerError() *PutLeadsInternalServerError {
|
||||||
|
return &PutLeadsInternalServerError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PutLeadsInternalServerError describes a response with status code 500, with default header values.
|
||||||
|
|
||||||
|
Server Internal Error
|
||||||
|
*/
|
||||||
|
type PutLeadsInternalServerError struct {
|
||||||
|
AccessControlAllowOrigin string
|
||||||
|
|
||||||
|
Payload *crm_models.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsInternalServerError) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %+v", 500, o.Payload)
|
||||||
|
}
|
||||||
|
func (o *PutLeadsInternalServerError) GetPayload() *crm_models.Error {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *PutLeadsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header Access-Control-Allow-Origin
|
||||||
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
||||||
|
|
||||||
|
if hdrAccessControlAllowOrigin != "" {
|
||||||
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Payload = new(crm_models.Error)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue