testing assets

0.1.6 v0.1.6
Vernon Keenan 2022-09-02 20:34:04 -07:00
parent 400b81060a
commit 93256c9add
21 changed files with 4243 additions and 0 deletions

View File

@ -0,0 +1,258 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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 assets API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for assets 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 {
DeleteAsset(params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error)
GetAssets(params *GetAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsOK, error)
GetAssetsObservable(params *GetAssetsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsObservableOK, error)
PostAssets(params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error)
PutAsset(params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAsset deletes an asset
Delete Taxnexus Asset record
*/
func (a *Client) DeleteAsset(params *DeleteAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAssetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAssetParams()
}
op := &runtime.ClientOperation{
ID: "deleteAsset",
Method: "DELETE",
PathPattern: "/assets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAssetReader{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.(*DeleteAssetOK)
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 deleteAsset: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAssets gets a list of assets
Return a list of all available Assets
*/
func (a *Client) GetAssets(params *GetAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAssetsParams()
}
op := &runtime.ClientOperation{
ID: "getAssets",
Method: "GET",
PathPattern: "/assets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAssetsReader{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.(*GetAssetsOK)
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 getAssets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAssetsObservable gets taxnexus assets in an observable array
A list of assets in a simple JSON array
*/
func (a *Client) GetAssetsObservable(params *GetAssetsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAssetsObservableOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAssetsObservableParams()
}
op := &runtime.ClientOperation{
ID: "getAssetsObservable",
Method: "GET",
PathPattern: "/assets/observable",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAssetsObservableReader{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.(*GetAssetsObservableOK)
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 getAssetsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAssets adds a new asset to taxnexus
Asset record to be added
*/
func (a *Client) PostAssets(params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAssetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAssetsParams()
}
op := &runtime.ClientOperation{
ID: "postAssets",
Method: "POST",
PathPattern: "/assets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAssetsReader{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.(*PostAssetsOK)
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 postAssets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PutAsset updates a single asset
Update a single asset specified by assetId
*/
func (a *Client) PutAsset(params *PutAssetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAssetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPutAssetParams()
}
op := &runtime.ClientOperation{
ID: "putAsset",
Method: "PUT",
PathPattern: "/assets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PutAssetReader{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.(*PutAssetOK)
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 putAsset: 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
}

View File

@ -0,0 +1,165 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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"
)
// NewDeleteAssetParams creates a new DeleteAssetParams 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 NewDeleteAssetParams() *DeleteAssetParams {
return &DeleteAssetParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAssetParamsWithTimeout creates a new DeleteAssetParams object
// with the ability to set a timeout on a request.
func NewDeleteAssetParamsWithTimeout(timeout time.Duration) *DeleteAssetParams {
return &DeleteAssetParams{
timeout: timeout,
}
}
// NewDeleteAssetParamsWithContext creates a new DeleteAssetParams object
// with the ability to set a context for a request.
func NewDeleteAssetParamsWithContext(ctx context.Context) *DeleteAssetParams {
return &DeleteAssetParams{
Context: ctx,
}
}
// NewDeleteAssetParamsWithHTTPClient creates a new DeleteAssetParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteAssetParamsWithHTTPClient(client *http.Client) *DeleteAssetParams {
return &DeleteAssetParams{
HTTPClient: client,
}
}
/* DeleteAssetParams contains all the parameters to send to the API endpoint
for the delete asset operation.
Typically these are written to a http.Request.
*/
type DeleteAssetParams struct {
/* AssetID.
Taxnexus Record Id of an Asset
*/
AssetID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete asset params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAssetParams) WithDefaults() *DeleteAssetParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete asset params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAssetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete asset params
func (o *DeleteAssetParams) WithTimeout(timeout time.Duration) *DeleteAssetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete asset params
func (o *DeleteAssetParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete asset params
func (o *DeleteAssetParams) WithContext(ctx context.Context) *DeleteAssetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete asset params
func (o *DeleteAssetParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete asset params
func (o *DeleteAssetParams) WithHTTPClient(client *http.Client) *DeleteAssetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete asset params
func (o *DeleteAssetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAssetID adds the assetID to the delete asset params
func (o *DeleteAssetParams) WithAssetID(assetID *string) *DeleteAssetParams {
o.SetAssetID(assetID)
return o
}
// SetAssetID adds the assetId to the delete asset params
func (o *DeleteAssetParams) SetAssetID(assetID *string) {
o.AssetID = assetID
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAssetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.AssetID != nil {
// query param assetId
var qrAssetID string
if o.AssetID != nil {
qrAssetID = *o.AssetID
}
qAssetID := qrAssetID
if qAssetID != "" {
if err := r.SetQueryParam("assetId", qAssetID); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,315 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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/vernonkeenan/lib/api/crm/crm_models"
)
// DeleteAssetReader is a Reader for the DeleteAsset structure.
type DeleteAssetReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewDeleteAssetOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewDeleteAssetUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewDeleteAssetForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewDeleteAssetNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewDeleteAssetUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewDeleteAssetInternalServerError()
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())
}
}
// NewDeleteAssetOK creates a DeleteAssetOK with default headers values
func NewDeleteAssetOK() *DeleteAssetOK {
return &DeleteAssetOK{}
}
/* DeleteAssetOK describes a response with status code 200, with default header values.
Taxnexus Response with Message Objects with Delete Status
*/
type DeleteAssetOK struct {
AccessControlAllowOrigin string
Payload *crm_models.DeleteResponse
}
func (o *DeleteAssetOK) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetOK %+v", 200, o.Payload)
}
func (o *DeleteAssetOK) GetPayload() *crm_models.DeleteResponse {
return o.Payload
}
func (o *DeleteAssetOK) 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
}
// NewDeleteAssetUnauthorized creates a DeleteAssetUnauthorized with default headers values
func NewDeleteAssetUnauthorized() *DeleteAssetUnauthorized {
return &DeleteAssetUnauthorized{}
}
/* DeleteAssetUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type DeleteAssetUnauthorized struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *DeleteAssetUnauthorized) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnauthorized %+v", 401, o.Payload)
}
func (o *DeleteAssetUnauthorized) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *DeleteAssetUnauthorized) 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
}
// NewDeleteAssetForbidden creates a DeleteAssetForbidden with default headers values
func NewDeleteAssetForbidden() *DeleteAssetForbidden {
return &DeleteAssetForbidden{}
}
/* DeleteAssetForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type DeleteAssetForbidden struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *DeleteAssetForbidden) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetForbidden %+v", 403, o.Payload)
}
func (o *DeleteAssetForbidden) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *DeleteAssetForbidden) 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
}
// NewDeleteAssetNotFound creates a DeleteAssetNotFound with default headers values
func NewDeleteAssetNotFound() *DeleteAssetNotFound {
return &DeleteAssetNotFound{}
}
/* DeleteAssetNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type DeleteAssetNotFound struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *DeleteAssetNotFound) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetNotFound %+v", 404, o.Payload)
}
func (o *DeleteAssetNotFound) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *DeleteAssetNotFound) 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
}
// NewDeleteAssetUnprocessableEntity creates a DeleteAssetUnprocessableEntity with default headers values
func NewDeleteAssetUnprocessableEntity() *DeleteAssetUnprocessableEntity {
return &DeleteAssetUnprocessableEntity{}
}
/* DeleteAssetUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type DeleteAssetUnprocessableEntity struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *DeleteAssetUnprocessableEntity) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetUnprocessableEntity %+v", 422, o.Payload)
}
func (o *DeleteAssetUnprocessableEntity) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *DeleteAssetUnprocessableEntity) 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
}
// NewDeleteAssetInternalServerError creates a DeleteAssetInternalServerError with default headers values
func NewDeleteAssetInternalServerError() *DeleteAssetInternalServerError {
return &DeleteAssetInternalServerError{}
}
/* DeleteAssetInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type DeleteAssetInternalServerError struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *DeleteAssetInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /assets][%d] deleteAssetInternalServerError %+v", 500, o.Payload)
}
func (o *DeleteAssetInternalServerError) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *DeleteAssetInternalServerError) 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
}

View File

@ -0,0 +1,199 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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"
)
// NewGetAssetsObservableParams creates a new GetAssetsObservableParams 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 NewGetAssetsObservableParams() *GetAssetsObservableParams {
return &GetAssetsObservableParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAssetsObservableParamsWithTimeout creates a new GetAssetsObservableParams object
// with the ability to set a timeout on a request.
func NewGetAssetsObservableParamsWithTimeout(timeout time.Duration) *GetAssetsObservableParams {
return &GetAssetsObservableParams{
timeout: timeout,
}
}
// NewGetAssetsObservableParamsWithContext creates a new GetAssetsObservableParams object
// with the ability to set a context for a request.
func NewGetAssetsObservableParamsWithContext(ctx context.Context) *GetAssetsObservableParams {
return &GetAssetsObservableParams{
Context: ctx,
}
}
// NewGetAssetsObservableParamsWithHTTPClient creates a new GetAssetsObservableParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAssetsObservableParamsWithHTTPClient(client *http.Client) *GetAssetsObservableParams {
return &GetAssetsObservableParams{
HTTPClient: client,
}
}
/* GetAssetsObservableParams contains all the parameters to send to the API endpoint
for the get assets observable operation.
Typically these are written to a http.Request.
*/
type GetAssetsObservableParams struct {
/* AccountID.
Taxnexus Record Id of an Account
*/
AccountID *string
/* AssetID.
Taxnexus Record Id of an Asset
*/
AssetID *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get assets observable params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAssetsObservableParams) WithDefaults() *GetAssetsObservableParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get assets observable params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAssetsObservableParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get assets observable params
func (o *GetAssetsObservableParams) WithTimeout(timeout time.Duration) *GetAssetsObservableParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get assets observable params
func (o *GetAssetsObservableParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get assets observable params
func (o *GetAssetsObservableParams) WithContext(ctx context.Context) *GetAssetsObservableParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get assets observable params
func (o *GetAssetsObservableParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get assets observable params
func (o *GetAssetsObservableParams) WithHTTPClient(client *http.Client) *GetAssetsObservableParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get assets observable params
func (o *GetAssetsObservableParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAccountID adds the accountID to the get assets observable params
func (o *GetAssetsObservableParams) WithAccountID(accountID *string) *GetAssetsObservableParams {
o.SetAccountID(accountID)
return o
}
// SetAccountID adds the accountId to the get assets observable params
func (o *GetAssetsObservableParams) SetAccountID(accountID *string) {
o.AccountID = accountID
}
// WithAssetID adds the assetID to the get assets observable params
func (o *GetAssetsObservableParams) WithAssetID(assetID *string) *GetAssetsObservableParams {
o.SetAssetID(assetID)
return o
}
// SetAssetID adds the assetId to the get assets observable params
func (o *GetAssetsObservableParams) SetAssetID(assetID *string) {
o.AssetID = assetID
}
// WriteToRequest writes these params to a swagger request
func (o *GetAssetsObservableParams) 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.AssetID != nil {
// query param assetId
var qrAssetID string
if o.AssetID != nil {
qrAssetID = *o.AssetID
}
qAssetID := qrAssetID
if qAssetID != "" {
if err := r.SetQueryParam("assetId", qAssetID); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,321 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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/vernonkeenan/lib/api/crm/crm_models"
)
// GetAssetsObservableReader is a Reader for the GetAssetsObservable structure.
type GetAssetsObservableReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAssetsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAssetsObservableOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetAssetsObservableUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewGetAssetsObservableForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetAssetsObservableNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewGetAssetsObservableUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetAssetsObservableInternalServerError()
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())
}
}
// NewGetAssetsObservableOK creates a GetAssetsObservableOK with default headers values
func NewGetAssetsObservableOK() *GetAssetsObservableOK {
return &GetAssetsObservableOK{}
}
/* GetAssetsObservableOK describes a response with status code 200, with default header values.
Taxnexus Response with an array of Asset objects
*/
type GetAssetsObservableOK struct {
AccessControlAllowOrigin string
CacheControl string
Payload []*crm_models.Asset
}
func (o *GetAssetsObservableOK) Error() string {
return fmt.Sprintf("[GET /assets/observable][%d] getAssetsObservableOK %+v", 200, o.Payload)
}
func (o *GetAssetsObservableOK) GetPayload() []*crm_models.Asset {
return o.Payload
}
func (o *GetAssetsObservableOK) 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
}
// NewGetAssetsObservableUnauthorized creates a GetAssetsObservableUnauthorized with default headers values
func NewGetAssetsObservableUnauthorized() *GetAssetsObservableUnauthorized {
return &GetAssetsObservableUnauthorized{}
}
/* GetAssetsObservableUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type GetAssetsObservableUnauthorized struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsObservableUnauthorized) Error() string {
return fmt.Sprintf("[GET /assets/observable][%d] getAssetsObservableUnauthorized %+v", 401, o.Payload)
}
func (o *GetAssetsObservableUnauthorized) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsObservableUnauthorized) 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
}
// NewGetAssetsObservableForbidden creates a GetAssetsObservableForbidden with default headers values
func NewGetAssetsObservableForbidden() *GetAssetsObservableForbidden {
return &GetAssetsObservableForbidden{}
}
/* GetAssetsObservableForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetAssetsObservableForbidden struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsObservableForbidden) Error() string {
return fmt.Sprintf("[GET /assets/observable][%d] getAssetsObservableForbidden %+v", 403, o.Payload)
}
func (o *GetAssetsObservableForbidden) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsObservableForbidden) 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
}
// NewGetAssetsObservableNotFound creates a GetAssetsObservableNotFound with default headers values
func NewGetAssetsObservableNotFound() *GetAssetsObservableNotFound {
return &GetAssetsObservableNotFound{}
}
/* GetAssetsObservableNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetAssetsObservableNotFound struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsObservableNotFound) Error() string {
return fmt.Sprintf("[GET /assets/observable][%d] getAssetsObservableNotFound %+v", 404, o.Payload)
}
func (o *GetAssetsObservableNotFound) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsObservableNotFound) 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
}
// NewGetAssetsObservableUnprocessableEntity creates a GetAssetsObservableUnprocessableEntity with default headers values
func NewGetAssetsObservableUnprocessableEntity() *GetAssetsObservableUnprocessableEntity {
return &GetAssetsObservableUnprocessableEntity{}
}
/* GetAssetsObservableUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetAssetsObservableUnprocessableEntity struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsObservableUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /assets/observable][%d] getAssetsObservableUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAssetsObservableUnprocessableEntity) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsObservableUnprocessableEntity) 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
}
// NewGetAssetsObservableInternalServerError creates a GetAssetsObservableInternalServerError with default headers values
func NewGetAssetsObservableInternalServerError() *GetAssetsObservableInternalServerError {
return &GetAssetsObservableInternalServerError{}
}
/* GetAssetsObservableInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetAssetsObservableInternalServerError struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsObservableInternalServerError) Error() string {
return fmt.Sprintf("[GET /assets/observable][%d] getAssetsObservableInternalServerError %+v", 500, o.Payload)
}
func (o *GetAssetsObservableInternalServerError) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsObservableInternalServerError) 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
}

View File

@ -0,0 +1,272 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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"
)
// NewGetAssetsParams creates a new GetAssetsParams 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 NewGetAssetsParams() *GetAssetsParams {
return &GetAssetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAssetsParamsWithTimeout creates a new GetAssetsParams object
// with the ability to set a timeout on a request.
func NewGetAssetsParamsWithTimeout(timeout time.Duration) *GetAssetsParams {
return &GetAssetsParams{
timeout: timeout,
}
}
// NewGetAssetsParamsWithContext creates a new GetAssetsParams object
// with the ability to set a context for a request.
func NewGetAssetsParamsWithContext(ctx context.Context) *GetAssetsParams {
return &GetAssetsParams{
Context: ctx,
}
}
// NewGetAssetsParamsWithHTTPClient creates a new GetAssetsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAssetsParamsWithHTTPClient(client *http.Client) *GetAssetsParams {
return &GetAssetsParams{
HTTPClient: client,
}
}
/* GetAssetsParams contains all the parameters to send to the API endpoint
for the get assets operation.
Typically these are written to a http.Request.
*/
type GetAssetsParams struct {
/* AccountID.
Taxnexus Record Id of an Account
*/
AccountID *string
/* AssetID.
Taxnexus Record Id of an Asset
*/
AssetID *string
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
/* 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 assets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAssetsParams) WithDefaults() *GetAssetsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get assets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAssetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get assets params
func (o *GetAssetsParams) WithTimeout(timeout time.Duration) *GetAssetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get assets params
func (o *GetAssetsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get assets params
func (o *GetAssetsParams) WithContext(ctx context.Context) *GetAssetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get assets params
func (o *GetAssetsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get assets params
func (o *GetAssetsParams) WithHTTPClient(client *http.Client) *GetAssetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get assets params
func (o *GetAssetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAccountID adds the accountID to the get assets params
func (o *GetAssetsParams) WithAccountID(accountID *string) *GetAssetsParams {
o.SetAccountID(accountID)
return o
}
// SetAccountID adds the accountId to the get assets params
func (o *GetAssetsParams) SetAccountID(accountID *string) {
o.AccountID = accountID
}
// WithAssetID adds the assetID to the get assets params
func (o *GetAssetsParams) WithAssetID(assetID *string) *GetAssetsParams {
o.SetAssetID(assetID)
return o
}
// SetAssetID adds the assetId to the get assets params
func (o *GetAssetsParams) SetAssetID(assetID *string) {
o.AssetID = assetID
}
// WithLimit adds the limit to the get assets params
func (o *GetAssetsParams) WithLimit(limit *int64) *GetAssetsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get assets params
func (o *GetAssetsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get assets params
func (o *GetAssetsParams) WithOffset(offset *int64) *GetAssetsParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get assets params
func (o *GetAssetsParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a swagger request
func (o *GetAssetsParams) 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.AssetID != nil {
// query param assetId
var qrAssetID string
if o.AssetID != nil {
qrAssetID = *o.AssetID
}
qAssetID := qrAssetID
if qAssetID != "" {
if err := r.SetQueryParam("assetId", qAssetID); 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.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
}

View File

@ -0,0 +1,323 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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/vernonkeenan/lib/api/crm/crm_models"
)
// GetAssetsReader is a Reader for the GetAssets structure.
type GetAssetsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAssetsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetAssetsUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewGetAssetsForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetAssetsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewGetAssetsUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetAssetsInternalServerError()
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())
}
}
// NewGetAssetsOK creates a GetAssetsOK with default headers values
func NewGetAssetsOK() *GetAssetsOK {
return &GetAssetsOK{}
}
/* GetAssetsOK describes a response with status code 200, with default header values.
Taxnexus Response with Asset objects with Contacts
*/
type GetAssetsOK struct {
AccessControlAllowOrigin string
CacheControl string
Payload *crm_models.AssetResponse
}
func (o *GetAssetsOK) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsOK %+v", 200, o.Payload)
}
func (o *GetAssetsOK) GetPayload() *crm_models.AssetResponse {
return o.Payload
}
func (o *GetAssetsOK) 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.AssetResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetAssetsUnauthorized creates a GetAssetsUnauthorized with default headers values
func NewGetAssetsUnauthorized() *GetAssetsUnauthorized {
return &GetAssetsUnauthorized{}
}
/* GetAssetsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type GetAssetsUnauthorized struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsUnauthorized) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsUnauthorized %+v", 401, o.Payload)
}
func (o *GetAssetsUnauthorized) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsUnauthorized) 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
}
// NewGetAssetsForbidden creates a GetAssetsForbidden with default headers values
func NewGetAssetsForbidden() *GetAssetsForbidden {
return &GetAssetsForbidden{}
}
/* GetAssetsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetAssetsForbidden struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsForbidden) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsForbidden %+v", 403, o.Payload)
}
func (o *GetAssetsForbidden) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsForbidden) 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
}
// NewGetAssetsNotFound creates a GetAssetsNotFound with default headers values
func NewGetAssetsNotFound() *GetAssetsNotFound {
return &GetAssetsNotFound{}
}
/* GetAssetsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetAssetsNotFound struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsNotFound) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsNotFound %+v", 404, o.Payload)
}
func (o *GetAssetsNotFound) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsNotFound) 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
}
// NewGetAssetsUnprocessableEntity creates a GetAssetsUnprocessableEntity with default headers values
func NewGetAssetsUnprocessableEntity() *GetAssetsUnprocessableEntity {
return &GetAssetsUnprocessableEntity{}
}
/* GetAssetsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetAssetsUnprocessableEntity struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetAssetsUnprocessableEntity) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsUnprocessableEntity) 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
}
// NewGetAssetsInternalServerError creates a GetAssetsInternalServerError with default headers values
func NewGetAssetsInternalServerError() *GetAssetsInternalServerError {
return &GetAssetsInternalServerError{}
}
/* GetAssetsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetAssetsInternalServerError struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *GetAssetsInternalServerError) Error() string {
return fmt.Sprintf("[GET /assets][%d] getAssetsInternalServerError %+v", 500, o.Payload)
}
func (o *GetAssetsInternalServerError) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetAssetsInternalServerError) 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
}

View File

@ -0,0 +1,155 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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/vernonkeenan/lib/api/crm/crm_models"
)
// NewPostAssetsParams creates a new PostAssetsParams 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 NewPostAssetsParams() *PostAssetsParams {
return &PostAssetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAssetsParamsWithTimeout creates a new PostAssetsParams object
// with the ability to set a timeout on a request.
func NewPostAssetsParamsWithTimeout(timeout time.Duration) *PostAssetsParams {
return &PostAssetsParams{
timeout: timeout,
}
}
// NewPostAssetsParamsWithContext creates a new PostAssetsParams object
// with the ability to set a context for a request.
func NewPostAssetsParamsWithContext(ctx context.Context) *PostAssetsParams {
return &PostAssetsParams{
Context: ctx,
}
}
// NewPostAssetsParamsWithHTTPClient creates a new PostAssetsParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostAssetsParamsWithHTTPClient(client *http.Client) *PostAssetsParams {
return &PostAssetsParams{
HTTPClient: client,
}
}
/* PostAssetsParams contains all the parameters to send to the API endpoint
for the post assets operation.
Typically these are written to a http.Request.
*/
type PostAssetsParams struct {
/* AssetRequest.
An array of new Asset records
*/
AssetRequest *crm_models.AssetRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post assets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAssetsParams) WithDefaults() *PostAssetsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post assets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAssetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post assets params
func (o *PostAssetsParams) WithTimeout(timeout time.Duration) *PostAssetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post assets params
func (o *PostAssetsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post assets params
func (o *PostAssetsParams) WithContext(ctx context.Context) *PostAssetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post assets params
func (o *PostAssetsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post assets params
func (o *PostAssetsParams) WithHTTPClient(client *http.Client) *PostAssetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post assets params
func (o *PostAssetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAssetRequest adds the assetRequest to the post assets params
func (o *PostAssetsParams) WithAssetRequest(assetRequest *crm_models.AssetRequest) *PostAssetsParams {
o.SetAssetRequest(assetRequest)
return o
}
// SetAssetRequest adds the assetRequest to the post assets params
func (o *PostAssetsParams) SetAssetRequest(assetRequest *crm_models.AssetRequest) {
o.AssetRequest = assetRequest
}
// WriteToRequest writes these params to a swagger request
func (o *PostAssetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.AssetRequest != nil {
if err := r.SetBodyParam(o.AssetRequest); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,323 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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/vernonkeenan/lib/api/crm/crm_models"
)
// PostAssetsReader is a Reader for the PostAssets structure.
type PostAssetsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAssetsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewPostAssetsUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewPostAssetsForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPostAssetsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewPostAssetsUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPostAssetsInternalServerError()
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())
}
}
// NewPostAssetsOK creates a PostAssetsOK with default headers values
func NewPostAssetsOK() *PostAssetsOK {
return &PostAssetsOK{}
}
/* PostAssetsOK describes a response with status code 200, with default header values.
Taxnexus Response with Asset objects with Contacts
*/
type PostAssetsOK struct {
AccessControlAllowOrigin string
CacheControl string
Payload *crm_models.AssetResponse
}
func (o *PostAssetsOK) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsOK %+v", 200, o.Payload)
}
func (o *PostAssetsOK) GetPayload() *crm_models.AssetResponse {
return o.Payload
}
func (o *PostAssetsOK) 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.AssetResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostAssetsUnauthorized creates a PostAssetsUnauthorized with default headers values
func NewPostAssetsUnauthorized() *PostAssetsUnauthorized {
return &PostAssetsUnauthorized{}
}
/* PostAssetsUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PostAssetsUnauthorized struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PostAssetsUnauthorized) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %+v", 401, o.Payload)
}
func (o *PostAssetsUnauthorized) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PostAssetsUnauthorized) 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
}
// NewPostAssetsForbidden creates a PostAssetsForbidden with default headers values
func NewPostAssetsForbidden() *PostAssetsForbidden {
return &PostAssetsForbidden{}
}
/* PostAssetsForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostAssetsForbidden struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PostAssetsForbidden) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %+v", 403, o.Payload)
}
func (o *PostAssetsForbidden) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PostAssetsForbidden) 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
}
// NewPostAssetsNotFound creates a PostAssetsNotFound with default headers values
func NewPostAssetsNotFound() *PostAssetsNotFound {
return &PostAssetsNotFound{}
}
/* PostAssetsNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostAssetsNotFound struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PostAssetsNotFound) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %+v", 404, o.Payload)
}
func (o *PostAssetsNotFound) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PostAssetsNotFound) 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
}
// NewPostAssetsUnprocessableEntity creates a PostAssetsUnprocessableEntity with default headers values
func NewPostAssetsUnprocessableEntity() *PostAssetsUnprocessableEntity {
return &PostAssetsUnprocessableEntity{}
}
/* PostAssetsUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostAssetsUnprocessableEntity struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PostAssetsUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostAssetsUnprocessableEntity) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PostAssetsUnprocessableEntity) 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
}
// NewPostAssetsInternalServerError creates a PostAssetsInternalServerError with default headers values
func NewPostAssetsInternalServerError() *PostAssetsInternalServerError {
return &PostAssetsInternalServerError{}
}
/* PostAssetsInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostAssetsInternalServerError struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PostAssetsInternalServerError) Error() string {
return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %+v", 500, o.Payload)
}
func (o *PostAssetsInternalServerError) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PostAssetsInternalServerError) 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
}

View File

@ -0,0 +1,155 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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/vernonkeenan/lib/api/crm/crm_models"
)
// NewPutAssetParams creates a new PutAssetParams 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 NewPutAssetParams() *PutAssetParams {
return &PutAssetParams{
timeout: cr.DefaultTimeout,
}
}
// NewPutAssetParamsWithTimeout creates a new PutAssetParams object
// with the ability to set a timeout on a request.
func NewPutAssetParamsWithTimeout(timeout time.Duration) *PutAssetParams {
return &PutAssetParams{
timeout: timeout,
}
}
// NewPutAssetParamsWithContext creates a new PutAssetParams object
// with the ability to set a context for a request.
func NewPutAssetParamsWithContext(ctx context.Context) *PutAssetParams {
return &PutAssetParams{
Context: ctx,
}
}
// NewPutAssetParamsWithHTTPClient creates a new PutAssetParams object
// with the ability to set a custom HTTPClient for a request.
func NewPutAssetParamsWithHTTPClient(client *http.Client) *PutAssetParams {
return &PutAssetParams{
HTTPClient: client,
}
}
/* PutAssetParams contains all the parameters to send to the API endpoint
for the put asset operation.
Typically these are written to a http.Request.
*/
type PutAssetParams struct {
/* AssetRequest.
An array of new Asset records
*/
AssetRequest *crm_models.AssetRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the put asset params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PutAssetParams) WithDefaults() *PutAssetParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the put asset params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PutAssetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the put asset params
func (o *PutAssetParams) WithTimeout(timeout time.Duration) *PutAssetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the put asset params
func (o *PutAssetParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the put asset params
func (o *PutAssetParams) WithContext(ctx context.Context) *PutAssetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the put asset params
func (o *PutAssetParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the put asset params
func (o *PutAssetParams) WithHTTPClient(client *http.Client) *PutAssetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the put asset params
func (o *PutAssetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithAssetRequest adds the assetRequest to the put asset params
func (o *PutAssetParams) WithAssetRequest(assetRequest *crm_models.AssetRequest) *PutAssetParams {
o.SetAssetRequest(assetRequest)
return o
}
// SetAssetRequest adds the assetRequest to the put asset params
func (o *PutAssetParams) SetAssetRequest(assetRequest *crm_models.AssetRequest) {
o.AssetRequest = assetRequest
}
// WriteToRequest writes these params to a swagger request
func (o *PutAssetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.AssetRequest != nil {
if err := r.SetBodyParam(o.AssetRequest); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,323 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package assets
// 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/vernonkeenan/lib/api/crm/crm_models"
)
// PutAssetReader is a Reader for the PutAsset structure.
type PutAssetReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutAssetOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewPutAssetUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewPutAssetForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPutAssetNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewPutAssetUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPutAssetInternalServerError()
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())
}
}
// NewPutAssetOK creates a PutAssetOK with default headers values
func NewPutAssetOK() *PutAssetOK {
return &PutAssetOK{}
}
/* PutAssetOK describes a response with status code 200, with default header values.
Taxnexus Response with Asset objects with Contacts
*/
type PutAssetOK struct {
AccessControlAllowOrigin string
CacheControl string
Payload *crm_models.AssetResponse
}
func (o *PutAssetOK) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetOK %+v", 200, o.Payload)
}
func (o *PutAssetOK) GetPayload() *crm_models.AssetResponse {
return o.Payload
}
func (o *PutAssetOK) 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.AssetResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPutAssetUnauthorized creates a PutAssetUnauthorized with default headers values
func NewPutAssetUnauthorized() *PutAssetUnauthorized {
return &PutAssetUnauthorized{}
}
/* PutAssetUnauthorized describes a response with status code 401, with default header values.
Access unauthorized, invalid API-KEY was used
*/
type PutAssetUnauthorized struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PutAssetUnauthorized) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetUnauthorized %+v", 401, o.Payload)
}
func (o *PutAssetUnauthorized) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutAssetUnauthorized) 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
}
// NewPutAssetForbidden creates a PutAssetForbidden with default headers values
func NewPutAssetForbidden() *PutAssetForbidden {
return &PutAssetForbidden{}
}
/* PutAssetForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PutAssetForbidden struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PutAssetForbidden) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %+v", 403, o.Payload)
}
func (o *PutAssetForbidden) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutAssetForbidden) 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
}
// NewPutAssetNotFound creates a PutAssetNotFound with default headers values
func NewPutAssetNotFound() *PutAssetNotFound {
return &PutAssetNotFound{}
}
/* PutAssetNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PutAssetNotFound struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PutAssetNotFound) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %+v", 404, o.Payload)
}
func (o *PutAssetNotFound) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutAssetNotFound) 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
}
// NewPutAssetUnprocessableEntity creates a PutAssetUnprocessableEntity with default headers values
func NewPutAssetUnprocessableEntity() *PutAssetUnprocessableEntity {
return &PutAssetUnprocessableEntity{}
}
/* PutAssetUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PutAssetUnprocessableEntity struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PutAssetUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PutAssetUnprocessableEntity) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutAssetUnprocessableEntity) 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
}
// NewPutAssetInternalServerError creates a PutAssetInternalServerError with default headers values
func NewPutAssetInternalServerError() *PutAssetInternalServerError {
return &PutAssetInternalServerError{}
}
/* PutAssetInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PutAssetInternalServerError struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
func (o *PutAssetInternalServerError) Error() string {
return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %+v", 500, o.Payload)
}
func (o *PutAssetInternalServerError) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutAssetInternalServerError) 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
}

View File

@ -0,0 +1,130 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package 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"
)
// NewAssetOptionsObservableParams creates a new AssetOptionsObservableParams 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 NewAssetOptionsObservableParams() *AssetOptionsObservableParams {
return &AssetOptionsObservableParams{
timeout: cr.DefaultTimeout,
}
}
// NewAssetOptionsObservableParamsWithTimeout creates a new AssetOptionsObservableParams object
// with the ability to set a timeout on a request.
func NewAssetOptionsObservableParamsWithTimeout(timeout time.Duration) *AssetOptionsObservableParams {
return &AssetOptionsObservableParams{
timeout: timeout,
}
}
// NewAssetOptionsObservableParamsWithContext creates a new AssetOptionsObservableParams object
// with the ability to set a context for a request.
func NewAssetOptionsObservableParamsWithContext(ctx context.Context) *AssetOptionsObservableParams {
return &AssetOptionsObservableParams{
Context: ctx,
}
}
// NewAssetOptionsObservableParamsWithHTTPClient creates a new AssetOptionsObservableParams object
// with the ability to set a custom HTTPClient for a request.
func NewAssetOptionsObservableParamsWithHTTPClient(client *http.Client) *AssetOptionsObservableParams {
return &AssetOptionsObservableParams{
HTTPClient: client,
}
}
/* AssetOptionsObservableParams contains all the parameters to send to the API endpoint
for the asset options observable operation.
Typically these are written to a http.Request.
*/
type AssetOptionsObservableParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the asset options observable params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AssetOptionsObservableParams) WithDefaults() *AssetOptionsObservableParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the asset options observable params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AssetOptionsObservableParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the asset options observable params
func (o *AssetOptionsObservableParams) WithTimeout(timeout time.Duration) *AssetOptionsObservableParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the asset options observable params
func (o *AssetOptionsObservableParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the asset options observable params
func (o *AssetOptionsObservableParams) WithContext(ctx context.Context) *AssetOptionsObservableParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the asset options observable params
func (o *AssetOptionsObservableParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the asset options observable params
func (o *AssetOptionsObservableParams) WithHTTPClient(client *http.Client) *AssetOptionsObservableParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the asset options observable params
func (o *AssetOptionsObservableParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *AssetOptionsObservableParams) 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
}

View File

@ -0,0 +1,113 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package 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"
)
// AssetOptionsObservableReader is a Reader for the AssetOptionsObservable structure.
type AssetOptionsObservableReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *AssetOptionsObservableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewAssetOptionsObservableOK()
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())
}
}
// NewAssetOptionsObservableOK creates a AssetOptionsObservableOK with default headers values
func NewAssetOptionsObservableOK() *AssetOptionsObservableOK {
return &AssetOptionsObservableOK{}
}
/* AssetOptionsObservableOK describes a response with status code 200, with default header values.
CORS OPTIONS response
*/
type AssetOptionsObservableOK struct {
AccessControlAllowCredentials string
AccessControlAllowHeaders string
AccessControlAllowMethods string
AccessControlAllowOrigin string
AccessControlExposeHeaders string
AccessControlMaxAge string
CacheControl string
}
func (o *AssetOptionsObservableOK) Error() string {
return fmt.Sprintf("[OPTIONS /assets/observable][%d] assetOptionsObservableOK ", 200)
}
func (o *AssetOptionsObservableOK) 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
}

View File

@ -0,0 +1,130 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package 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"
)
// NewAssetOptionsParams creates a new AssetOptionsParams 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 NewAssetOptionsParams() *AssetOptionsParams {
return &AssetOptionsParams{
timeout: cr.DefaultTimeout,
}
}
// NewAssetOptionsParamsWithTimeout creates a new AssetOptionsParams object
// with the ability to set a timeout on a request.
func NewAssetOptionsParamsWithTimeout(timeout time.Duration) *AssetOptionsParams {
return &AssetOptionsParams{
timeout: timeout,
}
}
// NewAssetOptionsParamsWithContext creates a new AssetOptionsParams object
// with the ability to set a context for a request.
func NewAssetOptionsParamsWithContext(ctx context.Context) *AssetOptionsParams {
return &AssetOptionsParams{
Context: ctx,
}
}
// NewAssetOptionsParamsWithHTTPClient creates a new AssetOptionsParams object
// with the ability to set a custom HTTPClient for a request.
func NewAssetOptionsParamsWithHTTPClient(client *http.Client) *AssetOptionsParams {
return &AssetOptionsParams{
HTTPClient: client,
}
}
/* AssetOptionsParams contains all the parameters to send to the API endpoint
for the asset options operation.
Typically these are written to a http.Request.
*/
type AssetOptionsParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the asset options params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AssetOptionsParams) WithDefaults() *AssetOptionsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the asset options params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AssetOptionsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the asset options params
func (o *AssetOptionsParams) WithTimeout(timeout time.Duration) *AssetOptionsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the asset options params
func (o *AssetOptionsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the asset options params
func (o *AssetOptionsParams) WithContext(ctx context.Context) *AssetOptionsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the asset options params
func (o *AssetOptionsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the asset options params
func (o *AssetOptionsParams) WithHTTPClient(client *http.Client) *AssetOptionsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the asset options params
func (o *AssetOptionsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *AssetOptionsParams) 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
}

View File

@ -0,0 +1,113 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package 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"
)
// AssetOptionsReader is a Reader for the AssetOptions structure.
type AssetOptionsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *AssetOptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewAssetOptionsOK()
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())
}
}
// NewAssetOptionsOK creates a AssetOptionsOK with default headers values
func NewAssetOptionsOK() *AssetOptionsOK {
return &AssetOptionsOK{}
}
/* AssetOptionsOK describes a response with status code 200, with default header values.
CORS OPTIONS response
*/
type AssetOptionsOK struct {
AccessControlAllowCredentials string
AccessControlAllowHeaders string
AccessControlAllowMethods string
AccessControlAllowOrigin string
AccessControlExposeHeaders string
AccessControlMaxAge string
CacheControl string
}
func (o *AssetOptionsOK) Error() string {
return fmt.Sprintf("[OPTIONS /assets][%d] assetOptionsOK ", 200)
}
func (o *AssetOptionsOK) 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
}

View File

@ -38,6 +38,10 @@ type ClientService interface {
AccountOptionsObservable(params *AccountOptionsObservableParams, opts ...ClientOption) (*AccountOptionsObservableOK, error)
AssetOptions(params *AssetOptionsParams, opts ...ClientOption) (*AssetOptionsOK, error)
AssetOptionsObservable(params *AssetOptionsObservableParams, opts ...ClientOption) (*AssetOptionsObservableOK, error)
ContactOptions(params *ContactOptionsParams, opts ...ClientOption) (*ContactOptionsOK, error)
ContactOptionsObservable(params *ContactOptionsObservableParams, opts ...ClientOption) (*ContactOptionsObservableOK, error)
@ -129,6 +133,82 @@ func (a *Client) AccountOptionsObservable(params *AccountOptionsObservableParams
panic(msg)
}
/*
AssetOptions CORS support
*/
func (a *Client) AssetOptions(params *AssetOptionsParams, opts ...ClientOption) (*AssetOptionsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewAssetOptionsParams()
}
op := &runtime.ClientOperation{
ID: "assetOptions",
Method: "OPTIONS",
PathPattern: "/assets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &AssetOptionsReader{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.(*AssetOptionsOK)
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 assetOptions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
AssetOptionsObservable CORS support
*/
func (a *Client) AssetOptionsObservable(params *AssetOptionsObservableParams, opts ...ClientOption) (*AssetOptionsObservableOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewAssetOptionsObservableParams()
}
op := &runtime.ClientOperation{
ID: "assetOptionsObservable",
Method: "OPTIONS",
PathPattern: "/assets/observable",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &AssetOptionsObservableReader{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.(*AssetOptionsObservableOK)
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 assetOptionsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ContactOptions CORS support
*/

View File

@ -15,6 +15,7 @@ import (
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/accounts"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/assets"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/contacts"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/contracts"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_client/cors"
@ -64,6 +65,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Crm {
cli := new(Crm)
cli.Transport = transport
cli.Accounts = accounts.New(transport, formats)
cli.Assets = assets.New(transport, formats)
cli.Contacts = contacts.New(transport, formats)
cli.Contracts = contracts.New(transport, formats)
cli.Cors = cors.New(transport, formats)
@ -114,6 +116,8 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
type Crm struct {
Accounts accounts.ClientService
Assets assets.ClientService
Contacts contacts.ClientService
Contracts contracts.ClientService
@ -129,6 +133,7 @@ type Crm struct {
func (c *Crm) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.Accounts.SetTransport(transport)
c.Assets.SetTransport(transport)
c.Contacts.SetTransport(transport)
c.Contracts.SetTransport(transport)
c.Cors.SetTransport(transport)

246
api/crm/crm_models/asset.go Normal file
View File

@ -0,0 +1,246 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package crm_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/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Asset asset
//
// swagger:model Asset
type Asset struct {
// Account
AccountID string `json:"AccountID,omitempty"`
// address
Address *Address `json:"Address,omitempty"`
// Asset Level
AssetLevel float64 `json:"AssetLevel,omitempty"`
// Asset Provided By
AssetProvidedByID string `json:"AssetProvidedByID,omitempty"`
// Asset Serviced By
AssetServicedByID string `json:"AssetServicedByID,omitempty"`
// Company Product
CompanyProductID string `json:"CompanyProductID,omitempty"`
// Consequence Of Failure
ConsequenceOfFailure string `json:"ConsequenceOfFailure,omitempty"`
// Contact
ContactID string `json:"ContactID,omitempty"`
// Created By
CreatedByID string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate string `json:"CreatedDate,omitempty"`
// Current Amount
CurrentAmount float64 `json:"CurrentAmount,omitempty"`
// Current Lifecycle End Date
CurrentLifecycleEndDate string `json:"CurrentLifecycleEndDate,omitempty"`
// Current Monthly Recurring Revenue
CurrentMrr float64 `json:"CurrentMrr,omitempty"`
// Current Quantity
CurrentQuantity float64 `json:"CurrentQuantity,omitempty"`
// Description
Description string `json:"Description,omitempty"`
// Digital Asset Status
DigitalAssetStatus string `json:"DigitalAssetStatus,omitempty"`
// External Id
ExternalIdentifier string `json:"ExternalIdentifier,omitempty"`
// Has Lifecycle Management
HasLifecycleManagement bool `json:"HasLifecycleManagement,omitempty"`
// Taxnexus Record Id
ID string `json:"ID,omitempty"`
// Install Date
InstallDate string `json:"InstallDate,omitempty"`
// Competitor Asset
IsCompetitorProduct bool `json:"IsCompetitorProduct,omitempty"`
// Internal Asset
IsInternal bool `json:"IsInternal,omitempty"`
// Last Modified By
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Location
LocationID string `json:"LocationID,omitempty"`
// MIME Type
MIMEType string `json:"MIMEType,omitempty"`
// Manufacture Date
ManufactureDate string `json:"ManufactureDate,omitempty"`
// Asset Name
Name string `json:"Name,omitempty"`
// Parent Asset
ParentID string `json:"ParentID,omitempty"`
// Price
Price float64 `json:"Price,omitempty"`
// Product
Product2ID string `json:"Product2ID,omitempty"`
// Product Code
ProductCode string `json:"ProductCode,omitempty"`
// Product Description
ProductDescription string `json:"ProductDescription,omitempty"`
// Product Family
ProductFamily string `json:"ProductFamily,omitempty"`
// Purchase Date
PurchaseDate string `json:"PurchaseDate,omitempty"`
// Quantity
Quantity float64 `json:"Quantity,omitempty"`
// Root Asset
RootAssetID string `json:"RootAssetID,omitempty"`
// Serial Number
SerialNumber string `json:"SerialNumber,omitempty"`
// Status
Status string `json:"Status,omitempty"`
// Status Reason
StatusReason string `json:"StatusReason,omitempty"`
// Product SKU
StockKeepingUnit string `json:"StockKeepingUnit,omitempty"`
// Tenant ID
TenantID string `json:"TenantID,omitempty"`
// Total Lifecycle Amount
TotalLifecycleAmount float64 `json:"TotalLifecycleAmount,omitempty"`
// Type
Type string `json:"Type,omitempty"`
// URL
URL string `json:"URL,omitempty"`
// Unique Identifier
UUID string `json:"UUID,omitempty"`
// Usage End Date
UsageEndDate string `json:"UsageEndDate,omitempty"`
}
// Validate validates this asset
func (m *Asset) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAddress(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Asset) 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")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
return nil
}
// ContextValidate validate this asset based on the context it is used
func (m *Asset) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAddress(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Asset) 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")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Address")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Asset) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Asset) UnmarshalBinary(b []byte) error {
var res Asset
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,120 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package crm_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"
)
// AssetRequest An array of Asset objects with Contacts
//
// swagger:model AssetRequest
type AssetRequest struct {
// data
Data []*Asset `json:"Data"`
}
// Validate validates this asset request
func (m *AssetRequest) 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 *AssetRequest) 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))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this asset request based on the context it is used
func (m *AssetRequest) 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 *AssetRequest) 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))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *AssetRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AssetRequest) UnmarshalBinary(b []byte) error {
var res AssetRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,166 @@
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package crm_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"
)
// AssetResponse An array of Asset objects with Contacts
//
// swagger:model AssetResponse
type AssetResponse struct {
// data
Data []*Asset `json:"Data"`
// meta
Meta *ResponseMeta `json:"Meta,omitempty"`
}
// Validate validates this asset response
func (m *AssetResponse) 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 *AssetResponse) 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))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *AssetResponse) 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")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
return nil
}
// ContextValidate validate this asset response based on the context it is used
func (m *AssetResponse) 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 *AssetResponse) 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))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *AssetResponse) 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")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *AssetResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AssetResponse) UnmarshalBinary(b []byte) error {
var res AssetResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -28,6 +28,12 @@ parameters:
name: accountId
required: false
type: string
assetIdQuery:
description: Taxnexus Record Id of an Asset
in: query
name: assetId
required: false
type: string
accountRequest:
description: An array of new Account records
in: body
@ -35,6 +41,13 @@ parameters:
required: true
schema:
$ref: "#/definitions/AccountRequest"
assetRequest:
description: An array of new Asset records
in: body
name: assetRequest
required: true
schema:
$ref: "#/definitions/AssetRequest"
activeQuery:
description: Only retrieve active records?
in: query
@ -144,6 +157,26 @@ responses:
type: string
schema:
$ref: "#/definitions/AccountResponse"
AssetResponse:
description: Taxnexus Response with Asset objects with Contacts
headers:
Access-Control-Allow-Origin:
type: string
Cache-Control:
type: string
schema:
$ref: "#/definitions/AssetResponse"
AssetObservableResponse:
description: Taxnexus Response with an array of Asset objects
headers:
Access-Control-Allow-Origin:
type: string
Cache-Control:
type: string
schema:
items:
$ref: "#/definitions/Asset"
type: array
AccountObservableResponse:
description: Taxnexus Response with an array of Account objects
headers:
@ -423,6 +456,143 @@ paths:
$ref: "#/responses/CORSResponse"
tags:
- cors
/assets:
delete:
description: Delete Taxnexus Asset record
operationId: deleteAsset
parameters:
- $ref: "#/parameters/assetIdQuery"
responses:
"200":
$ref: "#/responses/DeleteResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
summary: Delete An Asset
tags:
- Assets
get:
description: Return a list of all available Assets
operationId: getAssets
parameters:
- $ref: "#/parameters/limitQuery"
- $ref: "#/parameters/offsetQuery"
- $ref: "#/parameters/accountIdQuery"
- $ref: "#/parameters/assetIdQuery"
responses:
"200":
$ref: "#/responses/AssetResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
summary: Get a list of assets
tags:
- Assets
options:
description: CORS support
operationId: assetOptions
responses:
"200":
$ref: "#/responses/CORSResponse"
tags:
- cors
post:
description: Asset record to be added
operationId: postAssets
parameters:
- $ref: "#/parameters/assetRequest"
responses:
"200":
$ref: "#/responses/AssetResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
summary: Add a new asset to Taxnexus
tags:
- Assets
put:
description: Update a single asset specified by assetId
operationId: putAsset
parameters:
- $ref: "#/parameters/assetRequest"
responses:
"200":
$ref: "#/responses/AssetResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
summary: Update a single asset
tags:
- Assets
/assets/observable:
get:
description: A list of assets in a simple JSON array
operationId: getAssetsObservable
parameters:
- $ref: "#/parameters/accountIdQuery"
- $ref: "#/parameters/assetIdQuery"
responses:
"200":
$ref: "#/responses/AssetObservableResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
security:
- ApiKeyAuth: []
summary: Get Taxnexus Assets in an observable array
tags:
- Assets
options:
description: CORS support
operationId: assetOptionsObservable
responses:
"200":
$ref: "#/responses/CORSResponse"
tags:
- cors
/contracts:
delete:
description: Delete Taxnexus Contract record
@ -841,6 +1011,167 @@ paths:
tags:
- cors
definitions:
Asset:
properties:
ID:
type: string
description: Taxnexus Record Id
AccountID:
type: string
description: Account
Address:
$ref: "#/definitions/Address"
AssetLevel:
type: number
description: Asset Level
Name:
type: string
description: Asset Name
AssetProvidedByID:
type: string
description: Asset Provided By
AssetServicedByID:
type: string
description: Asset Serviced By
CompanyProductID:
type: string
description: Company Product
IsCompetitorProduct:
type: boolean
description: Competitor Asset
ConsequenceOfFailure:
type: string
description: Consequence Of Failure
ContactID:
type: string
description: Contact
CreatedByID:
type: string
description: Created By
CreatedDate:
type: string
description: Created Date
CurrentAmount:
type: number
description: Current Amount
CurrentLifecycleEndDate:
type: string
description: Current Lifecycle End Date
CurrentMrr:
type: number
description: Current Monthly Recurring Revenue
CurrentQuantity:
type: number
description: Current Quantity
Description:
type: string
description: Description
DigitalAssetStatus:
type: string
description: Digital Asset Status
ExternalIdentifier:
type: string
description: External Id
HasLifecycleManagement:
type: boolean
description: Has Lifecycle Management
InstallDate:
type: string
description: Install Date
IsInternal:
type: boolean
description: Internal Asset
LastModifiedByID:
type: string
description: Last Modified By
LastModifiedDate:
type: string
description: Last Modified Date
LocationID:
type: string
description: Location
ManufactureDate:
type: string
description: Manufacture Date
MIMEType:
type: string
description: MIME Type
ParentID:
type: string
description: Parent Asset
Price:
type: number
description: Price
Product2ID:
type: string
description: Product
ProductCode:
type: string
description: Product Code
ProductDescription:
type: string
description: Product Description
ProductFamily:
type: string
description: Product Family
StockKeepingUnit:
type: string
description: Product SKU
PurchaseDate:
type: string
description: Purchase Date
Quantity:
type: number
description: Quantity
RootAssetID:
type: string
description: Root Asset
SerialNumber:
type: string
description: Serial Number
Status:
type: string
description: Status
StatusReason:
type: string
description: Status Reason
TenantID:
type: string
description: Tenant ID
TotalLifecycleAmount:
type: number
description: Total Lifecycle Amount
Type:
type: string
description: Type
UUID:
type: string
description: Unique Identifier
URL:
type: string
description: URL
UsageEndDate:
type: string
description: Usage End Date
type: object
AssetRequest:
description: An array of Asset objects with Contacts
properties:
Data:
items:
$ref: "#/definitions/Asset"
type: array
type: object
AssetResponse:
description: An array of Asset objects with Contacts
properties:
Data:
items:
$ref: "#/definitions/Asset"
type: array
Meta:
$ref: "#/definitions/ResponseMeta"
type: object
Account:
properties:
AccountNumber: