diff --git a/Makefile b/Makefile index 19145fe..511f2ce 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ swagger: # rm -rf ./api mkdir -p api/auth - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-auth-client.log \ --copyright-file=./build/COPYRIGHT \ --name=auth \ @@ -19,7 +19,7 @@ swagger: # generate auth0 # mkdir -p api/auth0 - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-auth0-client.log \ --copyright-file=./build/COPYRIGHT \ --name=auth0 \ @@ -32,7 +32,7 @@ swagger: # generate blaze # mkdir api/blaze - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-blaze-client.log \ --copyright-file=./build/COPYRIGHT \ --name=blaze \ @@ -45,7 +45,7 @@ swagger: # generate crm # mkdir api/crm - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-crm-client.log \ --copyright-file=./build/COPYRIGHT \ --name=crm \ @@ -58,7 +58,7 @@ swagger: # generate devops # mkdir api/devops - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-devops-client.log \ --copyright-file=./build/COPYRIGHT \ --name=devops \ @@ -71,7 +71,7 @@ swagger: # generate geo # mkdir api/geo - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-geo-client.log \ --copyright-file=./build/COPYRIGHT \ --name=geo \ @@ -84,7 +84,7 @@ swagger: # generate gov-gw # mkdir api/gov-gw - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-gov-gw-client.log \ --copyright-file=./build/COPYRIGHT \ --name=gov-gw \ @@ -97,7 +97,7 @@ swagger: # generate ledger # mkdir api/ledger - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-ledger-client.log \ --copyright-file=./build/COPYRIGHT \ --name=ledger \ @@ -110,7 +110,7 @@ swagger: # generate metrc-gw # mkdir api/metrc-gw - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-metrc-gw-client.log \ --copyright-file=./build/COPYRIGHT \ --name=metrc-gw \ @@ -123,7 +123,7 @@ swagger: # generate ops # mkdir api/ops - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-ops-client.log \ --copyright-file=./build/COPYRIGHT \ --name=ops \ @@ -136,7 +136,7 @@ swagger: # generate pdf # mkdir api/pdf - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-pdf-client.log \ --copyright-file=./build/COPYRIGHT \ --name=pdf \ @@ -149,7 +149,7 @@ swagger: # generate plex # mkdir api/plex - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-plex-client.log \ --copyright-file=./build/COPYRIGHT \ --name=plex \ @@ -162,7 +162,7 @@ swagger: # generate regs # mkdir api/regs - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-regs-client.log \ --copyright-file=./build/COPYRIGHT \ --name=regs \ @@ -175,7 +175,7 @@ swagger: # generate render # mkdir api/render - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-render-client.log \ --copyright-file=./build/COPYRIGHT \ --name=render \ @@ -188,7 +188,7 @@ swagger: # generate sf-gate # mkdir api/sf-gate - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-sf-gate-client.log \ --copyright-file=./build/COPYRIGHT \ --name=sf-gate \ @@ -201,7 +201,7 @@ swagger: # generate stash # mkdir api/stash - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-stash-client.log \ --copyright-file=./build/COPYRIGHT \ --name=stash \ @@ -214,7 +214,7 @@ swagger: # generate vendor-gw # mkdir api/vendor-gw - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-vendor-gw-client.log \ --copyright-file=./build/COPYRIGHT \ --name=vendor-gw \ @@ -227,7 +227,7 @@ swagger: # generate workflow # mkdir api/workflow - swagger generate client \ + swagger-new generate client \ --log-output=./swagger/logs/generate-workflow-client.log \ --copyright-file=./build/COPYRIGHT \ --name=workflow \ diff --git a/api/auth/auth_client/user/get_users_parameters.go b/api/auth/auth_client/user/get_users_parameters.go index 53f80e2..aa42f6d 100644 --- a/api/auth/auth_client/user/get_users_parameters.go +++ b/api/auth/auth_client/user/get_users_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetUsersParams creates a new GetUsersParams object -// with the default values initialized. +// NewGetUsersParams creates a new GetUsersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetUsersParams() *GetUsersParams { - var () return &GetUsersParams{ - timeout: cr.DefaultTimeout, } } // NewGetUsersParamsWithTimeout creates a new GetUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams { - var () return &GetUsersParams{ - timeout: timeout, } } // NewGetUsersParamsWithContext creates a new GetUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams { - var () return &GetUsersParams{ - Context: ctx, } } // NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams { - var () return &GetUsersParams{ HTTPClient: client, } } -/*GetUsersParams contains all the parameters to send to the API endpoint -for the get users operation typically these are written to a http.Request +/* GetUsersParams contains all the parameters to send to the API endpoint + for the get users operation. + + Typically these are written to a http.Request. */ type GetUsersParams struct { - /*Apikey - Service account or developer API key + /* Apikey. + Service account or developer API key */ Apikey *string @@ -75,6 +74,21 @@ type GetUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) WithDefaults() *GetUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get users params func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param apikey var qrApikey string + if o.Apikey != nil { qrApikey = *o.Apikey } qApikey := qrApikey if qApikey != "" { + if err := r.SetQueryParam("apikey", qApikey); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/auth/auth_client/user/get_users_responses.go b/api/auth/auth_client/user/get_users_responses.go index d3e1c19..642436b 100644 --- a/api/auth/auth_client/user/get_users_responses.go +++ b/api/auth/auth_client/user/get_users_responses.go @@ -63,9 +63,8 @@ func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetUsersOK() *GetUsersOK { return &GetUsersOK{} } -/*GetUsersOK handles this case with default header values. +/* GetUsersOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ @@ -85,7 +84,6 @@ type GetUsersOK struct { func (o *GetUsersOK) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload) } - func (o *GetUsersOK) GetPayload() *auth_models.UserResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetUsersUnauthorized() *GetUsersUnauthorized { return &GetUsersUnauthorized{} } -/*GetUsersUnauthorized handles this case with default header values. +/* GetUsersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetUsersUnauthorized struct { func (o *GetUsersUnauthorized) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload) } - func (o *GetUsersUnauthorized) GetPayload() *auth_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetUsersForbidden() *GetUsersForbidden { return &GetUsersForbidden{} } -/*GetUsersForbidden handles this case with default header values. +/* GetUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetUsersForbidden struct { func (o *GetUsersForbidden) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload) } - func (o *GetUsersForbidden) GetPayload() *auth_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetUsersNotFound() *GetUsersNotFound { return &GetUsersNotFound{} } -/*GetUsersNotFound handles this case with default header values. +/* GetUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetUsersNotFound struct { func (o *GetUsersNotFound) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload) } - func (o *GetUsersNotFound) GetPayload() *auth_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetUsersUnprocessableEntity() *GetUsersUnprocessableEntity { return &GetUsersUnprocessableEntity{} } -/*GetUsersUnprocessableEntity handles this case with default header values. +/* GetUsersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetUsersUnprocessableEntity struct { func (o *GetUsersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetUsersUnprocessableEntity) GetPayload() *auth_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetUsersInternalServerError() *GetUsersInternalServerError { return &GetUsersInternalServerError{} } -/*GetUsersInternalServerError handles this case with default header values. +/* GetUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetUsersInternalServerError struct { func (o *GetUsersInternalServerError) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload) } - func (o *GetUsersInternalServerError) GetPayload() *auth_models.Error { return o.Payload } diff --git a/api/auth/auth_client/user/user_client.go b/api/auth/auth_client/user/user_client.go index 915a563..18bb057 100644 --- a/api/auth/auth_client/user/user_client.go +++ b/api/auth/auth_client/user/user_client.go @@ -29,9 +29,12 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersOK, error) + GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Checks for a valid API key, and returns full user record */ -func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersOK, error) { +func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUsers", Method: "GET", PathPattern: "/users", @@ -59,7 +61,12 @@ func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/auth/auth_models/address.go b/api/auth/auth_models/address.go index c381fb3..64b48ec 100644 --- a/api/auth/auth_models/address.go +++ b/api/auth/auth_models/address.go @@ -10,6 +10,8 @@ package auth_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *Address) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this address based on context it is used +func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Address) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth/auth_models/error.go b/api/auth/auth_models/error.go index a521b27..0e9b4a3 100644 --- a/api/auth/auth_models/error.go +++ b/api/auth/auth_models/error.go @@ -10,6 +10,8 @@ package auth_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth/auth_models/response_meta.go b/api/auth/auth_models/response_meta.go index b3f8bcf..378810f 100644 --- a/api/auth/auth_models/response_meta.go +++ b/api/auth/auth_models/response_meta.go @@ -10,6 +10,8 @@ package auth_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -58,6 +60,11 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this response meta based on context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth/auth_models/tenant_user.go b/api/auth/auth_models/tenant_user.go index 2d4b320..bf01d8f 100644 --- a/api/auth/auth_models/tenant_user.go +++ b/api/auth/auth_models/tenant_user.go @@ -10,6 +10,8 @@ package auth_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -73,6 +75,11 @@ func (m *TenantUser) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant user based on context it is used +func (m *TenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantUser) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth/auth_models/user.go b/api/auth/auth_models/user.go index 9e15e58..30e5e09 100644 --- a/api/auth/auth_models/user.go +++ b/api/auth/auth_models/user.go @@ -10,6 +10,7 @@ package auth_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -220,7 +221,6 @@ func (m *User) Validate(formats strfmt.Registry) error { } func (m *User) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -238,7 +238,6 @@ func (m *User) validateAddress(formats strfmt.Registry) error { } func (m *User) validateTenantUsers(formats strfmt.Registry) error { - if swag.IsZero(m.TenantUsers) { // not required return nil } @@ -263,7 +262,6 @@ func (m *User) validateTenantUsers(formats strfmt.Registry) error { } func (m *User) validateUserRoles(formats strfmt.Registry) error { - if swag.IsZero(m.UserRoles) { // not required return nil } @@ -287,6 +285,78 @@ func (m *User) validateUserRoles(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user based on the context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTenantUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserRoles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Address") + } + return err + } + } + + return nil +} + +func (m *User) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TenantUsers); i++ { + + if m.TenantUsers[i] != nil { + if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *User) contextValidateUserRoles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.UserRoles); i++ { + + if m.UserRoles[i] != nil { + if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *User) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth/auth_models/user_response.go b/api/auth/auth_models/user_response.go index 690804e..c41eccd 100644 --- a/api/auth/auth_models/user_response.go +++ b/api/auth/auth_models/user_response.go @@ -10,6 +10,7 @@ package auth_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *UserResponse) Validate(formats strfmt.Registry) error { } func (m *UserResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *UserResponse) validateData(formats strfmt.Registry) error { } func (m *UserResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *UserResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user response based on the context it is used +func (m *UserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *UserResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth/auth_models/user_role.go b/api/auth/auth_models/user_role.go index be09350..a23f695 100644 --- a/api/auth/auth_models/user_role.go +++ b/api/auth/auth_models/user_role.go @@ -10,6 +10,8 @@ package auth_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -64,6 +66,11 @@ func (m *UserRole) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user role based on context it is used +func (m *UserRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserRole) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_client/auth/auth_client.go b/api/auth0/auth0_client/auth/auth_client.go index ac25bf5..4854a69 100644 --- a/api/auth0/auth0_client/auth/auth_client.go +++ b/api/auth0/auth0_client/auth/auth_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - PostCredentials(params *PostCredentialsParams) (*PostCredentialsOK, error) + PostCredentials(params *PostCredentialsParams, opts ...ClientOption) (*PostCredentialsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Get credential token */ -func (a *Client) PostCredentials(params *PostCredentialsParams) (*PostCredentialsOK, error) { +func (a *Client) PostCredentials(params *PostCredentialsParams, opts ...ClientOption) (*PostCredentialsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCredentialsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCredentials", Method: "POST", PathPattern: "/oauth/token", @@ -58,7 +60,12 @@ func (a *Client) PostCredentials(params *PostCredentialsParams) (*PostCredential Reader: &PostCredentialsReader{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 } diff --git a/api/auth0/auth0_client/auth/post_credentials_parameters.go b/api/auth0/auth0_client/auth/post_credentials_parameters.go index 55f6d5c..452b88f 100644 --- a/api/auth0/auth0_client/auth/post_credentials_parameters.go +++ b/api/auth0/auth0_client/auth/post_credentials_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/auth0/auth0_models" ) -// NewPostCredentialsParams creates a new PostCredentialsParams object -// with the default values initialized. +// NewPostCredentialsParams creates a new PostCredentialsParams 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 NewPostCredentialsParams() *PostCredentialsParams { - var () return &PostCredentialsParams{ - timeout: cr.DefaultTimeout, } } // NewPostCredentialsParamsWithTimeout creates a new PostCredentialsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCredentialsParamsWithTimeout(timeout time.Duration) *PostCredentialsParams { - var () return &PostCredentialsParams{ - timeout: timeout, } } // NewPostCredentialsParamsWithContext creates a new PostCredentialsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCredentialsParamsWithContext(ctx context.Context) *PostCredentialsParams { - var () return &PostCredentialsParams{ - Context: ctx, } } // NewPostCredentialsParamsWithHTTPClient creates a new PostCredentialsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCredentialsParamsWithHTTPClient(client *http.Client) *PostCredentialsParams { - var () return &PostCredentialsParams{ HTTPClient: client, } } -/*PostCredentialsParams contains all the parameters to send to the API endpoint -for the post credentials operation typically these are written to a http.Request +/* PostCredentialsParams contains all the parameters to send to the API endpoint + for the post credentials operation. + + Typically these are written to a http.Request. */ type PostCredentialsParams struct { - /*CredentialsRequest - Get Authentation Token + /* CredentialsRequest. + Get Authentation Token */ CredentialsRequest *auth0_models.CredentialsRequest @@ -77,6 +76,21 @@ type PostCredentialsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post credentials params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCredentialsParams) WithDefaults() *PostCredentialsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post credentials params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCredentialsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post credentials params func (o *PostCredentialsParams) WithTimeout(timeout time.Duration) *PostCredentialsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.CredentialsRequest != nil { if err := r.SetBodyParam(o.CredentialsRequest); err != nil { return err diff --git a/api/auth0/auth0_client/auth/post_credentials_responses.go b/api/auth0/auth0_client/auth/post_credentials_responses.go index b2eb029..b323b4f 100644 --- a/api/auth0/auth0_client/auth/post_credentials_responses.go +++ b/api/auth0/auth0_client/auth/post_credentials_responses.go @@ -63,9 +63,8 @@ func (o *PostCredentialsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostCredentialsOK() *PostCredentialsOK { return &PostCredentialsOK{} } -/*PostCredentialsOK handles this case with default header values. +/* PostCredentialsOK describes a response with status code 200, with default header values. Credentials response from Auth0 */ @@ -85,7 +84,6 @@ type PostCredentialsOK struct { func (o *PostCredentialsOK) Error() string { return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsOK %+v", 200, o.Payload) } - func (o *PostCredentialsOK) GetPayload() *auth0_models.CredentialsResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostCredentialsUnauthorized() *PostCredentialsUnauthorized { return &PostCredentialsUnauthorized{} } -/*PostCredentialsUnauthorized handles this case with default header values. +/* PostCredentialsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostCredentialsUnauthorized struct { func (o *PostCredentialsUnauthorized) Error() string { return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsUnauthorized %+v", 401, o.Payload) } - func (o *PostCredentialsUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostCredentialsForbidden() *PostCredentialsForbidden { return &PostCredentialsForbidden{} } -/*PostCredentialsForbidden handles this case with default header values. +/* PostCredentialsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostCredentialsForbidden struct { func (o *PostCredentialsForbidden) Error() string { return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsForbidden %+v", 403, o.Payload) } - func (o *PostCredentialsForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostCredentialsNotFound() *PostCredentialsNotFound { return &PostCredentialsNotFound{} } -/*PostCredentialsNotFound handles this case with default header values. +/* PostCredentialsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostCredentialsNotFound struct { func (o *PostCredentialsNotFound) Error() string { return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsNotFound %+v", 404, o.Payload) } - func (o *PostCredentialsNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostCredentialsUnprocessableEntity() *PostCredentialsUnprocessableEntity return &PostCredentialsUnprocessableEntity{} } -/*PostCredentialsUnprocessableEntity handles this case with default header values. +/* PostCredentialsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostCredentialsUnprocessableEntity struct { func (o *PostCredentialsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostCredentialsUnprocessableEntity) GetPayload() *auth0_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostCredentialsInternalServerError() *PostCredentialsInternalServerError return &PostCredentialsInternalServerError{} } -/*PostCredentialsInternalServerError handles this case with default header values. +/* PostCredentialsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostCredentialsInternalServerError struct { func (o *PostCredentialsInternalServerError) Error() string { return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsInternalServerError %+v", 500, o.Payload) } - func (o *PostCredentialsInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/role/get_roles_parameters.go b/api/auth0/auth0_client/role/get_roles_parameters.go index f0d1ad3..f834be5 100644 --- a/api/auth0/auth0_client/role/get_roles_parameters.go +++ b/api/auth0/auth0_client/role/get_roles_parameters.go @@ -20,51 +20,50 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetRolesParams creates a new GetRolesParams object -// with the default values initialized. +// NewGetRolesParams creates a new GetRolesParams 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 NewGetRolesParams() *GetRolesParams { - var () return &GetRolesParams{ - timeout: cr.DefaultTimeout, } } // NewGetRolesParamsWithTimeout creates a new GetRolesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetRolesParamsWithTimeout(timeout time.Duration) *GetRolesParams { - var () return &GetRolesParams{ - timeout: timeout, } } // NewGetRolesParamsWithContext creates a new GetRolesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetRolesParamsWithContext(ctx context.Context) *GetRolesParams { - var () return &GetRolesParams{ - Context: ctx, } } // NewGetRolesParamsWithHTTPClient creates a new GetRolesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetRolesParamsWithHTTPClient(client *http.Client) *GetRolesParams { - var () return &GetRolesParams{ HTTPClient: client, } } -/*GetRolesParams contains all the parameters to send to the API endpoint -for the get roles operation typically these are written to a http.Request +/* GetRolesParams contains all the parameters to send to the API endpoint + for the get roles operation. + + Typically these are written to a http.Request. */ type GetRolesParams struct { - /*Authorization*/ + // Authorization. Authorization string timeout time.Duration @@ -72,6 +71,21 @@ type GetRolesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRolesParams) WithDefaults() *GetRolesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRolesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get roles params func (o *GetRolesParams) WithTimeout(timeout time.Duration) *GetRolesParams { o.SetTimeout(timeout) diff --git a/api/auth0/auth0_client/role/get_roles_responses.go b/api/auth0/auth0_client/role/get_roles_responses.go index 13d5549..e630639 100644 --- a/api/auth0/auth0_client/role/get_roles_responses.go +++ b/api/auth0/auth0_client/role/get_roles_responses.go @@ -63,9 +63,8 @@ func (o *GetRolesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetRolesOK() *GetRolesOK { return &GetRolesOK{} } -/*GetRolesOK handles this case with default header values. +/* GetRolesOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ @@ -85,7 +84,6 @@ type GetRolesOK struct { func (o *GetRolesOK) Error() string { return fmt.Sprintf("[GET /api/v2/roles][%d] getRolesOK %+v", 200, o.Payload) } - func (o *GetRolesOK) GetPayload() []*auth0_models.User { return o.Payload } @@ -105,7 +103,7 @@ func NewGetRolesUnauthorized() *GetRolesUnauthorized { return &GetRolesUnauthorized{} } -/*GetRolesUnauthorized handles this case with default header values. +/* GetRolesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -116,7 +114,6 @@ type GetRolesUnauthorized struct { func (o *GetRolesUnauthorized) Error() string { return fmt.Sprintf("[GET /api/v2/roles][%d] getRolesUnauthorized %+v", 401, o.Payload) } - func (o *GetRolesUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -138,7 +135,7 @@ func NewGetRolesForbidden() *GetRolesForbidden { return &GetRolesForbidden{} } -/*GetRolesForbidden handles this case with default header values. +/* GetRolesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -149,7 +146,6 @@ type GetRolesForbidden struct { func (o *GetRolesForbidden) Error() string { return fmt.Sprintf("[GET /api/v2/roles][%d] getRolesForbidden %+v", 403, o.Payload) } - func (o *GetRolesForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -171,7 +167,7 @@ func NewGetRolesNotFound() *GetRolesNotFound { return &GetRolesNotFound{} } -/*GetRolesNotFound handles this case with default header values. +/* GetRolesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -182,7 +178,6 @@ type GetRolesNotFound struct { func (o *GetRolesNotFound) Error() string { return fmt.Sprintf("[GET /api/v2/roles][%d] getRolesNotFound %+v", 404, o.Payload) } - func (o *GetRolesNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -204,7 +199,7 @@ func NewGetRolesUnprocessableEntity() *GetRolesUnprocessableEntity { return &GetRolesUnprocessableEntity{} } -/*GetRolesUnprocessableEntity handles this case with default header values. +/* GetRolesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -215,7 +210,6 @@ type GetRolesUnprocessableEntity struct { func (o *GetRolesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /api/v2/roles][%d] getRolesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetRolesUnprocessableEntity) GetPayload() *auth0_models.Error { return o.Payload } @@ -237,7 +231,7 @@ func NewGetRolesInternalServerError() *GetRolesInternalServerError { return &GetRolesInternalServerError{} } -/*GetRolesInternalServerError handles this case with default header values. +/* GetRolesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -248,7 +242,6 @@ type GetRolesInternalServerError struct { func (o *GetRolesInternalServerError) Error() string { return fmt.Sprintf("[GET /api/v2/roles][%d] getRolesInternalServerError %+v", 500, o.Payload) } - func (o *GetRolesInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/role/post_role_users_parameters.go b/api/auth0/auth0_client/role/post_role_users_parameters.go index 8170974..229d5fd 100644 --- a/api/auth0/auth0_client/role/post_role_users_parameters.go +++ b/api/auth0/auth0_client/role/post_role_users_parameters.go @@ -22,60 +22,61 @@ import ( "code.tnxs.net/taxnexus/lib/api/auth0/auth0_models" ) -// NewPostRoleUsersParams creates a new PostRoleUsersParams object -// with the default values initialized. +// NewPostRoleUsersParams creates a new PostRoleUsersParams 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 NewPostRoleUsersParams() *PostRoleUsersParams { - var () return &PostRoleUsersParams{ - timeout: cr.DefaultTimeout, } } // NewPostRoleUsersParamsWithTimeout creates a new PostRoleUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostRoleUsersParamsWithTimeout(timeout time.Duration) *PostRoleUsersParams { - var () return &PostRoleUsersParams{ - timeout: timeout, } } // NewPostRoleUsersParamsWithContext creates a new PostRoleUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostRoleUsersParamsWithContext(ctx context.Context) *PostRoleUsersParams { - var () return &PostRoleUsersParams{ - Context: ctx, } } // NewPostRoleUsersParamsWithHTTPClient creates a new PostRoleUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostRoleUsersParamsWithHTTPClient(client *http.Client) *PostRoleUsersParams { - var () return &PostRoleUsersParams{ HTTPClient: client, } } -/*PostRoleUsersParams contains all the parameters to send to the API endpoint -for the post role users operation typically these are written to a http.Request +/* PostRoleUsersParams contains all the parameters to send to the API endpoint + for the post role users operation. + + Typically these are written to a http.Request. */ type PostRoleUsersParams struct { - /*Authorization*/ + // Authorization. Authorization string - /*RoleUsersRequest - An array of User IDs to add to a Role + /* RoleUsersRequest. + + An array of User IDs to add to a Role */ RoleUsersRequest *auth0_models.RoleUsersRequest - /*RoleID - An Auth0 Role ID + /* RoleID. + + An Auth0 Role ID */ RoleID string @@ -84,6 +85,21 @@ type PostRoleUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post role users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostRoleUsersParams) WithDefaults() *PostRoleUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post role users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostRoleUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post role users params func (o *PostRoleUsersParams) WithTimeout(timeout time.Duration) *PostRoleUsersParams { o.SetTimeout(timeout) @@ -162,7 +178,6 @@ func (o *PostRoleUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt if err := r.SetHeaderParam("Authorization", o.Authorization); err != nil { return err } - if o.RoleUsersRequest != nil { if err := r.SetBodyParam(o.RoleUsersRequest); err != nil { return err diff --git a/api/auth0/auth0_client/role/post_role_users_responses.go b/api/auth0/auth0_client/role/post_role_users_responses.go index cf23678..9eb459e 100644 --- a/api/auth0/auth0_client/role/post_role_users_responses.go +++ b/api/auth0/auth0_client/role/post_role_users_responses.go @@ -57,9 +57,8 @@ func (o *PostRoleUsersReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostRoleUsersOK() *PostRoleUsersOK { return &PostRoleUsersOK{} } -/*PostRoleUsersOK handles this case with default header values. +/* PostRoleUsersOK describes a response with status code 200, with default header values. Role users successfully updated */ @@ -89,7 +88,7 @@ func NewPostRoleUsersUnauthorized() *PostRoleUsersUnauthorized { return &PostRoleUsersUnauthorized{} } -/*PostRoleUsersUnauthorized handles this case with default header values. +/* PostRoleUsersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -100,7 +99,6 @@ type PostRoleUsersUnauthorized struct { func (o *PostRoleUsersUnauthorized) Error() string { return fmt.Sprintf("[POST /api/v2/roles/{roleId}/users][%d] postRoleUsersUnauthorized %+v", 401, o.Payload) } - func (o *PostRoleUsersUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -122,7 +120,7 @@ func NewPostRoleUsersForbidden() *PostRoleUsersForbidden { return &PostRoleUsersForbidden{} } -/*PostRoleUsersForbidden handles this case with default header values. +/* PostRoleUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -133,7 +131,6 @@ type PostRoleUsersForbidden struct { func (o *PostRoleUsersForbidden) Error() string { return fmt.Sprintf("[POST /api/v2/roles/{roleId}/users][%d] postRoleUsersForbidden %+v", 403, o.Payload) } - func (o *PostRoleUsersForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -155,7 +152,7 @@ func NewPostRoleUsersNotFound() *PostRoleUsersNotFound { return &PostRoleUsersNotFound{} } -/*PostRoleUsersNotFound handles this case with default header values. +/* PostRoleUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -166,7 +163,6 @@ type PostRoleUsersNotFound struct { func (o *PostRoleUsersNotFound) Error() string { return fmt.Sprintf("[POST /api/v2/roles/{roleId}/users][%d] postRoleUsersNotFound %+v", 404, o.Payload) } - func (o *PostRoleUsersNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -188,7 +184,7 @@ func NewPostRoleUsersInternalServerError() *PostRoleUsersInternalServerError { return &PostRoleUsersInternalServerError{} } -/*PostRoleUsersInternalServerError handles this case with default header values. +/* PostRoleUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -199,7 +195,6 @@ type PostRoleUsersInternalServerError struct { func (o *PostRoleUsersInternalServerError) Error() string { return fmt.Sprintf("[POST /api/v2/roles/{roleId}/users][%d] postRoleUsersInternalServerError %+v", 500, o.Payload) } - func (o *PostRoleUsersInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/role/role_client.go b/api/auth0/auth0_client/role/role_client.go index 300eeb3..fa1b4d4 100644 --- a/api/auth0/auth0_client/role/role_client.go +++ b/api/auth0/auth0_client/role/role_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetRoles(params *GetRolesParams) (*GetRolesOK, error) + GetRoles(params *GetRolesParams, opts ...ClientOption) (*GetRolesOK, error) - PostRoleUsers(params *PostRoleUsersParams) (*PostRoleUsersOK, error) + PostRoleUsers(params *PostRoleUsersParams, opts ...ClientOption) (*PostRoleUsersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Get Roles from Auth0 */ -func (a *Client) GetRoles(params *GetRolesParams) (*GetRolesOK, error) { +func (a *Client) GetRoles(params *GetRolesParams, opts ...ClientOption) (*GetRolesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRolesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRoles", Method: "GET", PathPattern: "/api/v2/roles", @@ -60,7 +62,12 @@ func (a *Client) GetRoles(params *GetRolesParams) (*GetRolesOK, error) { Reader: &GetRolesReader{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 } @@ -79,13 +86,12 @@ func (a *Client) GetRoles(params *GetRolesParams) (*GetRolesOK, error) { Add users to role */ -func (a *Client) PostRoleUsers(params *PostRoleUsersParams) (*PostRoleUsersOK, error) { +func (a *Client) PostRoleUsers(params *PostRoleUsersParams, opts ...ClientOption) (*PostRoleUsersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostRoleUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postRoleUsers", Method: "POST", PathPattern: "/api/v2/roles/{roleId}/users", @@ -96,7 +102,12 @@ func (a *Client) PostRoleUsers(params *PostRoleUsersParams) (*PostRoleUsersOK, e Reader: &PostRoleUsersReader{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 } diff --git a/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_parameters.go b/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_parameters.go index 83b1f23..9e15539 100644 --- a/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_parameters.go +++ b/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_parameters.go @@ -22,60 +22,61 @@ import ( "code.tnxs.net/taxnexus/lib/api/auth0/auth0_models" ) -// NewDeleteAPIV2UsersUserIDRolesParams creates a new DeleteAPIV2UsersUserIDRolesParams object -// with the default values initialized. +// NewDeleteAPIV2UsersUserIDRolesParams creates a new DeleteAPIV2UsersUserIDRolesParams 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 NewDeleteAPIV2UsersUserIDRolesParams() *DeleteAPIV2UsersUserIDRolesParams { - var () return &DeleteAPIV2UsersUserIDRolesParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteAPIV2UsersUserIDRolesParamsWithTimeout creates a new DeleteAPIV2UsersUserIDRolesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteAPIV2UsersUserIDRolesParamsWithTimeout(timeout time.Duration) *DeleteAPIV2UsersUserIDRolesParams { - var () return &DeleteAPIV2UsersUserIDRolesParams{ - timeout: timeout, } } // NewDeleteAPIV2UsersUserIDRolesParamsWithContext creates a new DeleteAPIV2UsersUserIDRolesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteAPIV2UsersUserIDRolesParamsWithContext(ctx context.Context) *DeleteAPIV2UsersUserIDRolesParams { - var () return &DeleteAPIV2UsersUserIDRolesParams{ - Context: ctx, } } // NewDeleteAPIV2UsersUserIDRolesParamsWithHTTPClient creates a new DeleteAPIV2UsersUserIDRolesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteAPIV2UsersUserIDRolesParamsWithHTTPClient(client *http.Client) *DeleteAPIV2UsersUserIDRolesParams { - var () return &DeleteAPIV2UsersUserIDRolesParams{ HTTPClient: client, } } -/*DeleteAPIV2UsersUserIDRolesParams contains all the parameters to send to the API endpoint -for the delete API v2 users user ID roles operation typically these are written to a http.Request +/* DeleteAPIV2UsersUserIDRolesParams contains all the parameters to send to the API endpoint + for the delete API v2 users user ID roles operation. + + Typically these are written to a http.Request. */ type DeleteAPIV2UsersUserIDRolesParams struct { - /*Authorization*/ + // Authorization. Authorization string - /*UserRolesRequest - An array of User IDs to add to a Role + /* UserRolesRequest. + + An array of User IDs to add to a Role */ UserRolesRequest *auth0_models.UserRolesRequest - /*UserID - An Auth0 User ID + /* UserID. + + An Auth0 User ID */ UserID string @@ -84,6 +85,21 @@ type DeleteAPIV2UsersUserIDRolesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete API v2 users user ID roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2UsersUserIDRolesParams) WithDefaults() *DeleteAPIV2UsersUserIDRolesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API v2 users user ID roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIV2UsersUserIDRolesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete API v2 users user ID roles params func (o *DeleteAPIV2UsersUserIDRolesParams) WithTimeout(timeout time.Duration) *DeleteAPIV2UsersUserIDRolesParams { o.SetTimeout(timeout) @@ -162,7 +178,6 @@ func (o *DeleteAPIV2UsersUserIDRolesParams) WriteToRequest(r runtime.ClientReque if err := r.SetHeaderParam("Authorization", o.Authorization); err != nil { return err } - if o.UserRolesRequest != nil { if err := r.SetBodyParam(o.UserRolesRequest); err != nil { return err diff --git a/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_responses.go b/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_responses.go index 5adee75..54b90a0 100644 --- a/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_responses.go +++ b/api/auth0/auth0_client/user/delete_api_v2_users_user_id_roles_responses.go @@ -57,9 +57,8 @@ func (o *DeleteAPIV2UsersUserIDRolesReader) ReadResponse(response runtime.Client return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeleteAPIV2UsersUserIDRolesNoContent() *DeleteAPIV2UsersUserIDRolesNoCon return &DeleteAPIV2UsersUserIDRolesNoContent{} } -/*DeleteAPIV2UsersUserIDRolesNoContent handles this case with default header values. +/* DeleteAPIV2UsersUserIDRolesNoContent describes a response with status code 204, with default header values. User roles successfully removed */ @@ -89,7 +88,7 @@ func NewDeleteAPIV2UsersUserIDRolesUnauthorized() *DeleteAPIV2UsersUserIDRolesUn return &DeleteAPIV2UsersUserIDRolesUnauthorized{} } -/*DeleteAPIV2UsersUserIDRolesUnauthorized handles this case with default header values. +/* DeleteAPIV2UsersUserIDRolesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -100,7 +99,6 @@ type DeleteAPIV2UsersUserIDRolesUnauthorized struct { func (o *DeleteAPIV2UsersUserIDRolesUnauthorized) Error() string { return fmt.Sprintf("[DELETE /api/v2/users/{userId}/roles][%d] deleteApiV2UsersUserIdRolesUnauthorized %+v", 401, o.Payload) } - func (o *DeleteAPIV2UsersUserIDRolesUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -122,7 +120,7 @@ func NewDeleteAPIV2UsersUserIDRolesForbidden() *DeleteAPIV2UsersUserIDRolesForbi return &DeleteAPIV2UsersUserIDRolesForbidden{} } -/*DeleteAPIV2UsersUserIDRolesForbidden handles this case with default header values. +/* DeleteAPIV2UsersUserIDRolesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -133,7 +131,6 @@ type DeleteAPIV2UsersUserIDRolesForbidden struct { func (o *DeleteAPIV2UsersUserIDRolesForbidden) Error() string { return fmt.Sprintf("[DELETE /api/v2/users/{userId}/roles][%d] deleteApiV2UsersUserIdRolesForbidden %+v", 403, o.Payload) } - func (o *DeleteAPIV2UsersUserIDRolesForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -155,7 +152,7 @@ func NewDeleteAPIV2UsersUserIDRolesNotFound() *DeleteAPIV2UsersUserIDRolesNotFou return &DeleteAPIV2UsersUserIDRolesNotFound{} } -/*DeleteAPIV2UsersUserIDRolesNotFound handles this case with default header values. +/* DeleteAPIV2UsersUserIDRolesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -166,7 +163,6 @@ type DeleteAPIV2UsersUserIDRolesNotFound struct { func (o *DeleteAPIV2UsersUserIDRolesNotFound) Error() string { return fmt.Sprintf("[DELETE /api/v2/users/{userId}/roles][%d] deleteApiV2UsersUserIdRolesNotFound %+v", 404, o.Payload) } - func (o *DeleteAPIV2UsersUserIDRolesNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -188,7 +184,7 @@ func NewDeleteAPIV2UsersUserIDRolesInternalServerError() *DeleteAPIV2UsersUserID return &DeleteAPIV2UsersUserIDRolesInternalServerError{} } -/*DeleteAPIV2UsersUserIDRolesInternalServerError handles this case with default header values. +/* DeleteAPIV2UsersUserIDRolesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -199,7 +195,6 @@ type DeleteAPIV2UsersUserIDRolesInternalServerError struct { func (o *DeleteAPIV2UsersUserIDRolesInternalServerError) Error() string { return fmt.Sprintf("[DELETE /api/v2/users/{userId}/roles][%d] deleteApiV2UsersUserIdRolesInternalServerError %+v", 500, o.Payload) } - func (o *DeleteAPIV2UsersUserIDRolesInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/user/get_user_by_email_parameters.go b/api/auth0/auth0_client/user/get_user_by_email_parameters.go index 2ce2025..da5d9a0 100644 --- a/api/auth0/auth0_client/user/get_user_by_email_parameters.go +++ b/api/auth0/auth0_client/user/get_user_by_email_parameters.go @@ -20,53 +20,53 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetUserByEmailParams creates a new GetUserByEmailParams object -// with the default values initialized. +// NewGetUserByEmailParams creates a new GetUserByEmailParams 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 NewGetUserByEmailParams() *GetUserByEmailParams { - var () return &GetUserByEmailParams{ - timeout: cr.DefaultTimeout, } } // NewGetUserByEmailParamsWithTimeout creates a new GetUserByEmailParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUserByEmailParamsWithTimeout(timeout time.Duration) *GetUserByEmailParams { - var () return &GetUserByEmailParams{ - timeout: timeout, } } // NewGetUserByEmailParamsWithContext creates a new GetUserByEmailParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUserByEmailParamsWithContext(ctx context.Context) *GetUserByEmailParams { - var () return &GetUserByEmailParams{ - Context: ctx, } } // NewGetUserByEmailParamsWithHTTPClient creates a new GetUserByEmailParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUserByEmailParamsWithHTTPClient(client *http.Client) *GetUserByEmailParams { - var () return &GetUserByEmailParams{ HTTPClient: client, } } -/*GetUserByEmailParams contains all the parameters to send to the API endpoint -for the get user by email operation typically these are written to a http.Request +/* GetUserByEmailParams contains all the parameters to send to the API endpoint + for the get user by email operation. + + Typically these are written to a http.Request. */ type GetUserByEmailParams struct { - /*Authorization*/ + // Authorization. Authorization string - /*Email*/ + + // Email. Email string timeout time.Duration @@ -74,6 +74,21 @@ type GetUserByEmailParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get user by email params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserByEmailParams) WithDefaults() *GetUserByEmailParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get user by email params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserByEmailParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get user by email params func (o *GetUserByEmailParams) WithTimeout(timeout time.Duration) *GetUserByEmailParams { o.SetTimeout(timeout) @@ -146,6 +161,7 @@ func (o *GetUserByEmailParams) WriteToRequest(r runtime.ClientRequest, reg strfm qrEmail := o.Email qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } diff --git a/api/auth0/auth0_client/user/get_user_by_email_responses.go b/api/auth0/auth0_client/user/get_user_by_email_responses.go index cf2c947..7d29c0d 100644 --- a/api/auth0/auth0_client/user/get_user_by_email_responses.go +++ b/api/auth0/auth0_client/user/get_user_by_email_responses.go @@ -57,9 +57,8 @@ func (o *GetUserByEmailReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetUserByEmailOK() *GetUserByEmailOK { return &GetUserByEmailOK{} } -/*GetUserByEmailOK handles this case with default header values. +/* GetUserByEmailOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ @@ -79,7 +78,6 @@ type GetUserByEmailOK struct { func (o *GetUserByEmailOK) Error() string { return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailOK %+v", 200, o.Payload) } - func (o *GetUserByEmailOK) GetPayload() []*auth0_models.User { return o.Payload } @@ -99,7 +97,7 @@ func NewGetUserByEmailUnauthorized() *GetUserByEmailUnauthorized { return &GetUserByEmailUnauthorized{} } -/*GetUserByEmailUnauthorized handles this case with default header values. +/* GetUserByEmailUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -110,7 +108,6 @@ type GetUserByEmailUnauthorized struct { func (o *GetUserByEmailUnauthorized) Error() string { return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailUnauthorized %+v", 401, o.Payload) } - func (o *GetUserByEmailUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -132,7 +129,7 @@ func NewGetUserByEmailForbidden() *GetUserByEmailForbidden { return &GetUserByEmailForbidden{} } -/*GetUserByEmailForbidden handles this case with default header values. +/* GetUserByEmailForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -143,7 +140,6 @@ type GetUserByEmailForbidden struct { func (o *GetUserByEmailForbidden) Error() string { return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailForbidden %+v", 403, o.Payload) } - func (o *GetUserByEmailForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -165,7 +161,7 @@ func NewGetUserByEmailNotFound() *GetUserByEmailNotFound { return &GetUserByEmailNotFound{} } -/*GetUserByEmailNotFound handles this case with default header values. +/* GetUserByEmailNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -176,7 +172,6 @@ type GetUserByEmailNotFound struct { func (o *GetUserByEmailNotFound) Error() string { return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailNotFound %+v", 404, o.Payload) } - func (o *GetUserByEmailNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -198,7 +193,7 @@ func NewGetUserByEmailInternalServerError() *GetUserByEmailInternalServerError { return &GetUserByEmailInternalServerError{} } -/*GetUserByEmailInternalServerError handles this case with default header values. +/* GetUserByEmailInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -209,7 +204,6 @@ type GetUserByEmailInternalServerError struct { func (o *GetUserByEmailInternalServerError) Error() string { return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailInternalServerError %+v", 500, o.Payload) } - func (o *GetUserByEmailInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/user/get_user_roles_parameters.go b/api/auth0/auth0_client/user/get_user_roles_parameters.go index 7d0d2a6..301d1c5 100644 --- a/api/auth0/auth0_client/user/get_user_roles_parameters.go +++ b/api/auth0/auth0_client/user/get_user_roles_parameters.go @@ -20,55 +20,55 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetUserRolesParams creates a new GetUserRolesParams object -// with the default values initialized. +// NewGetUserRolesParams creates a new GetUserRolesParams 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 NewGetUserRolesParams() *GetUserRolesParams { - var () return &GetUserRolesParams{ - timeout: cr.DefaultTimeout, } } // NewGetUserRolesParamsWithTimeout creates a new GetUserRolesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUserRolesParamsWithTimeout(timeout time.Duration) *GetUserRolesParams { - var () return &GetUserRolesParams{ - timeout: timeout, } } // NewGetUserRolesParamsWithContext creates a new GetUserRolesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUserRolesParamsWithContext(ctx context.Context) *GetUserRolesParams { - var () return &GetUserRolesParams{ - Context: ctx, } } // NewGetUserRolesParamsWithHTTPClient creates a new GetUserRolesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUserRolesParamsWithHTTPClient(client *http.Client) *GetUserRolesParams { - var () return &GetUserRolesParams{ HTTPClient: client, } } -/*GetUserRolesParams contains all the parameters to send to the API endpoint -for the get user roles operation typically these are written to a http.Request +/* GetUserRolesParams contains all the parameters to send to the API endpoint + for the get user roles operation. + + Typically these are written to a http.Request. */ type GetUserRolesParams struct { - /*Authorization*/ + // Authorization. Authorization string - /*UserID - An Auth0 User ID + /* UserID. + + An Auth0 User ID */ UserID string @@ -77,6 +77,21 @@ type GetUserRolesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get user roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserRolesParams) WithDefaults() *GetUserRolesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get user roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserRolesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get user roles params func (o *GetUserRolesParams) WithTimeout(timeout time.Duration) *GetUserRolesParams { o.SetTimeout(timeout) diff --git a/api/auth0/auth0_client/user/get_user_roles_responses.go b/api/auth0/auth0_client/user/get_user_roles_responses.go index cad6a19..8d227e8 100644 --- a/api/auth0/auth0_client/user/get_user_roles_responses.go +++ b/api/auth0/auth0_client/user/get_user_roles_responses.go @@ -57,9 +57,8 @@ func (o *GetUserRolesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetUserRolesOK() *GetUserRolesOK { return &GetUserRolesOK{} } -/*GetUserRolesOK handles this case with default header values. +/* GetUserRolesOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ @@ -79,7 +78,6 @@ type GetUserRolesOK struct { func (o *GetUserRolesOK) Error() string { return fmt.Sprintf("[GET /api/v2/users/{userId}/roles][%d] getUserRolesOK %+v", 200, o.Payload) } - func (o *GetUserRolesOK) GetPayload() *auth0_models.RoleResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetUserRolesUnauthorized() *GetUserRolesUnauthorized { return &GetUserRolesUnauthorized{} } -/*GetUserRolesUnauthorized handles this case with default header values. +/* GetUserRolesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetUserRolesUnauthorized struct { func (o *GetUserRolesUnauthorized) Error() string { return fmt.Sprintf("[GET /api/v2/users/{userId}/roles][%d] getUserRolesUnauthorized %+v", 401, o.Payload) } - func (o *GetUserRolesUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetUserRolesForbidden() *GetUserRolesForbidden { return &GetUserRolesForbidden{} } -/*GetUserRolesForbidden handles this case with default header values. +/* GetUserRolesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetUserRolesForbidden struct { func (o *GetUserRolesForbidden) Error() string { return fmt.Sprintf("[GET /api/v2/users/{userId}/roles][%d] getUserRolesForbidden %+v", 403, o.Payload) } - func (o *GetUserRolesForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetUserRolesNotFound() *GetUserRolesNotFound { return &GetUserRolesNotFound{} } -/*GetUserRolesNotFound handles this case with default header values. +/* GetUserRolesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetUserRolesNotFound struct { func (o *GetUserRolesNotFound) Error() string { return fmt.Sprintf("[GET /api/v2/users/{userId}/roles][%d] getUserRolesNotFound %+v", 404, o.Payload) } - func (o *GetUserRolesNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetUserRolesInternalServerError() *GetUserRolesInternalServerError { return &GetUserRolesInternalServerError{} } -/*GetUserRolesInternalServerError handles this case with default header values. +/* GetUserRolesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetUserRolesInternalServerError struct { func (o *GetUserRolesInternalServerError) Error() string { return fmt.Sprintf("[GET /api/v2/users/{userId}/roles][%d] getUserRolesInternalServerError %+v", 500, o.Payload) } - func (o *GetUserRolesInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/user/get_users_parameters.go b/api/auth0/auth0_client/user/get_users_parameters.go index 8c71861..09bb135 100644 --- a/api/auth0/auth0_client/user/get_users_parameters.go +++ b/api/auth0/auth0_client/user/get_users_parameters.go @@ -20,51 +20,50 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetUsersParams creates a new GetUsersParams object -// with the default values initialized. +// NewGetUsersParams creates a new GetUsersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetUsersParams() *GetUsersParams { - var () return &GetUsersParams{ - timeout: cr.DefaultTimeout, } } // NewGetUsersParamsWithTimeout creates a new GetUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams { - var () return &GetUsersParams{ - timeout: timeout, } } // NewGetUsersParamsWithContext creates a new GetUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams { - var () return &GetUsersParams{ - Context: ctx, } } // NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams { - var () return &GetUsersParams{ HTTPClient: client, } } -/*GetUsersParams contains all the parameters to send to the API endpoint -for the get users operation typically these are written to a http.Request +/* GetUsersParams contains all the parameters to send to the API endpoint + for the get users operation. + + Typically these are written to a http.Request. */ type GetUsersParams struct { - /*Authorization*/ + // Authorization. Authorization string timeout time.Duration @@ -72,6 +71,21 @@ type GetUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) WithDefaults() *GetUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get users params func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams { o.SetTimeout(timeout) diff --git a/api/auth0/auth0_client/user/get_users_responses.go b/api/auth0/auth0_client/user/get_users_responses.go index 2e5a27f..a87c2d4 100644 --- a/api/auth0/auth0_client/user/get_users_responses.go +++ b/api/auth0/auth0_client/user/get_users_responses.go @@ -57,9 +57,8 @@ func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetUsersOK() *GetUsersOK { return &GetUsersOK{} } -/*GetUsersOK handles this case with default header values. +/* GetUsersOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ @@ -79,7 +78,6 @@ type GetUsersOK struct { func (o *GetUsersOK) Error() string { return fmt.Sprintf("[GET /api/v2/users][%d] getUsersOK %+v", 200, o.Payload) } - func (o *GetUsersOK) GetPayload() []*auth0_models.User { return o.Payload } @@ -99,7 +97,7 @@ func NewGetUsersUnauthorized() *GetUsersUnauthorized { return &GetUsersUnauthorized{} } -/*GetUsersUnauthorized handles this case with default header values. +/* GetUsersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -110,7 +108,6 @@ type GetUsersUnauthorized struct { func (o *GetUsersUnauthorized) Error() string { return fmt.Sprintf("[GET /api/v2/users][%d] getUsersUnauthorized %+v", 401, o.Payload) } - func (o *GetUsersUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -132,7 +129,7 @@ func NewGetUsersForbidden() *GetUsersForbidden { return &GetUsersForbidden{} } -/*GetUsersForbidden handles this case with default header values. +/* GetUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -143,7 +140,6 @@ type GetUsersForbidden struct { func (o *GetUsersForbidden) Error() string { return fmt.Sprintf("[GET /api/v2/users][%d] getUsersForbidden %+v", 403, o.Payload) } - func (o *GetUsersForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -165,7 +161,7 @@ func NewGetUsersNotFound() *GetUsersNotFound { return &GetUsersNotFound{} } -/*GetUsersNotFound handles this case with default header values. +/* GetUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -176,7 +172,6 @@ type GetUsersNotFound struct { func (o *GetUsersNotFound) Error() string { return fmt.Sprintf("[GET /api/v2/users][%d] getUsersNotFound %+v", 404, o.Payload) } - func (o *GetUsersNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -198,7 +193,7 @@ func NewGetUsersInternalServerError() *GetUsersInternalServerError { return &GetUsersInternalServerError{} } -/*GetUsersInternalServerError handles this case with default header values. +/* GetUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -209,7 +204,6 @@ type GetUsersInternalServerError struct { func (o *GetUsersInternalServerError) Error() string { return fmt.Sprintf("[GET /api/v2/users][%d] getUsersInternalServerError %+v", 500, o.Payload) } - func (o *GetUsersInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/user/post_users_parameters.go b/api/auth0/auth0_client/user/post_users_parameters.go index 56a7791..b40fe43 100644 --- a/api/auth0/auth0_client/user/post_users_parameters.go +++ b/api/auth0/auth0_client/user/post_users_parameters.go @@ -22,55 +22,55 @@ import ( "code.tnxs.net/taxnexus/lib/api/auth0/auth0_models" ) -// NewPostUsersParams creates a new PostUsersParams object -// with the default values initialized. +// NewPostUsersParams creates a new PostUsersParams 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 NewPostUsersParams() *PostUsersParams { - var () return &PostUsersParams{ - timeout: cr.DefaultTimeout, } } // NewPostUsersParamsWithTimeout creates a new PostUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostUsersParamsWithTimeout(timeout time.Duration) *PostUsersParams { - var () return &PostUsersParams{ - timeout: timeout, } } // NewPostUsersParamsWithContext creates a new PostUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostUsersParamsWithContext(ctx context.Context) *PostUsersParams { - var () return &PostUsersParams{ - Context: ctx, } } // NewPostUsersParamsWithHTTPClient creates a new PostUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostUsersParamsWithHTTPClient(client *http.Client) *PostUsersParams { - var () return &PostUsersParams{ HTTPClient: client, } } -/*PostUsersParams contains all the parameters to send to the API endpoint -for the post users operation typically these are written to a http.Request +/* PostUsersParams contains all the parameters to send to the API endpoint + for the post users operation. + + Typically these are written to a http.Request. */ type PostUsersParams struct { - /*Authorization*/ + // Authorization. Authorization string - /*UserRequest - An array of User records + /* UserRequest. + + An array of User records */ UserRequest *auth0_models.UserRequest @@ -79,6 +79,21 @@ type PostUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersParams) WithDefaults() *PostUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post users params func (o *PostUsersParams) WithTimeout(timeout time.Duration) *PostUsersParams { o.SetTimeout(timeout) @@ -146,7 +161,6 @@ func (o *PostUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg if err := r.SetHeaderParam("Authorization", o.Authorization); err != nil { return err } - if o.UserRequest != nil { if err := r.SetBodyParam(o.UserRequest); err != nil { return err diff --git a/api/auth0/auth0_client/user/post_users_responses.go b/api/auth0/auth0_client/user/post_users_responses.go index b413873..99c6e04 100644 --- a/api/auth0/auth0_client/user/post_users_responses.go +++ b/api/auth0/auth0_client/user/post_users_responses.go @@ -63,9 +63,8 @@ func (o *PostUsersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostUsersCreated() *PostUsersCreated { return &PostUsersCreated{} } -/*PostUsersCreated handles this case with default header values. +/* PostUsersCreated describes a response with status code 201, with default header values. New user created */ @@ -95,7 +94,7 @@ func NewPostUsersUnauthorized() *PostUsersUnauthorized { return &PostUsersUnauthorized{} } -/*PostUsersUnauthorized handles this case with default header values. +/* PostUsersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -106,7 +105,6 @@ type PostUsersUnauthorized struct { func (o *PostUsersUnauthorized) Error() string { return fmt.Sprintf("[POST /api/v2/users-by-email][%d] postUsersUnauthorized %+v", 401, o.Payload) } - func (o *PostUsersUnauthorized) GetPayload() *auth0_models.Error { return o.Payload } @@ -128,7 +126,7 @@ func NewPostUsersForbidden() *PostUsersForbidden { return &PostUsersForbidden{} } -/*PostUsersForbidden handles this case with default header values. +/* PostUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -139,7 +137,6 @@ type PostUsersForbidden struct { func (o *PostUsersForbidden) Error() string { return fmt.Sprintf("[POST /api/v2/users-by-email][%d] postUsersForbidden %+v", 403, o.Payload) } - func (o *PostUsersForbidden) GetPayload() *auth0_models.Error { return o.Payload } @@ -161,7 +158,7 @@ func NewPostUsersNotFound() *PostUsersNotFound { return &PostUsersNotFound{} } -/*PostUsersNotFound handles this case with default header values. +/* PostUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -172,7 +169,6 @@ type PostUsersNotFound struct { func (o *PostUsersNotFound) Error() string { return fmt.Sprintf("[POST /api/v2/users-by-email][%d] postUsersNotFound %+v", 404, o.Payload) } - func (o *PostUsersNotFound) GetPayload() *auth0_models.Error { return o.Payload } @@ -194,7 +190,7 @@ func NewPostUsersConflict() *PostUsersConflict { return &PostUsersConflict{} } -/*PostUsersConflict handles this case with default header values. +/* PostUsersConflict describes a response with status code 409, with default header values. User already exists */ @@ -215,7 +211,7 @@ func NewPostUsersInternalServerError() *PostUsersInternalServerError { return &PostUsersInternalServerError{} } -/*PostUsersInternalServerError handles this case with default header values. +/* PostUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -226,7 +222,6 @@ type PostUsersInternalServerError struct { func (o *PostUsersInternalServerError) Error() string { return fmt.Sprintf("[POST /api/v2/users-by-email][%d] postUsersInternalServerError %+v", 500, o.Payload) } - func (o *PostUsersInternalServerError) GetPayload() *auth0_models.Error { return o.Payload } diff --git a/api/auth0/auth0_client/user/user_client.go b/api/auth0/auth0_client/user/user_client.go index 966a218..f0170a9 100644 --- a/api/auth0/auth0_client/user/user_client.go +++ b/api/auth0/auth0_client/user/user_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams) (*DeleteAPIV2UsersUserIDRolesNoContent, error) + DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams, opts ...ClientOption) (*DeleteAPIV2UsersUserIDRolesNoContent, error) - GetUserByEmail(params *GetUserByEmailParams) (*GetUserByEmailOK, error) + GetUserByEmail(params *GetUserByEmailParams, opts ...ClientOption) (*GetUserByEmailOK, error) - GetUserRoles(params *GetUserRolesParams) (*GetUserRolesOK, error) + GetUserRoles(params *GetUserRolesParams, opts ...ClientOption) (*GetUserRolesOK, error) - GetUsers(params *GetUsersParams) (*GetUsersOK, error) + GetUsers(params *GetUsersParams, opts ...ClientOption) (*GetUsersOK, error) - PostUsers(params *PostUsersParams) (*PostUsersCreated, error) + PostUsers(params *PostUsersParams, opts ...ClientOption) (*PostUsersCreated, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { /* DeleteAPIV2UsersUserIDRoles delete API v2 users user ID roles API */ -func (a *Client) DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams) (*DeleteAPIV2UsersUserIDRolesNoContent, error) { +func (a *Client) DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRolesParams, opts ...ClientOption) (*DeleteAPIV2UsersUserIDRolesNoContent, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteAPIV2UsersUserIDRolesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DeleteAPIV2UsersUserIDRoles", Method: "DELETE", PathPattern: "/api/v2/users/{userId}/roles", @@ -64,7 +66,12 @@ func (a *Client) DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRoles Reader: &DeleteAPIV2UsersUserIDRolesReader{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 } @@ -83,13 +90,12 @@ func (a *Client) DeleteAPIV2UsersUserIDRoles(params *DeleteAPIV2UsersUserIDRoles Get a single user from Auth0 by Email Address */ -func (a *Client) GetUserByEmail(params *GetUserByEmailParams) (*GetUserByEmailOK, error) { +func (a *Client) GetUserByEmail(params *GetUserByEmailParams, opts ...ClientOption) (*GetUserByEmailOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUserByEmailParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUserByEmail", Method: "GET", PathPattern: "/api/v2/users-by-email", @@ -100,7 +106,12 @@ func (a *Client) GetUserByEmail(params *GetUserByEmailParams) (*GetUserByEmailOK Reader: &GetUserByEmailReader{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 } @@ -119,13 +130,12 @@ func (a *Client) GetUserByEmail(params *GetUserByEmailParams) (*GetUserByEmailOK Get a User's Roles */ -func (a *Client) GetUserRoles(params *GetUserRolesParams) (*GetUserRolesOK, error) { +func (a *Client) GetUserRoles(params *GetUserRolesParams, opts ...ClientOption) (*GetUserRolesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUserRolesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUserRoles", Method: "GET", PathPattern: "/api/v2/users/{userId}/roles", @@ -136,7 +146,12 @@ func (a *Client) GetUserRoles(params *GetUserRolesParams) (*GetUserRolesOK, erro Reader: &GetUserRolesReader{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 } @@ -155,13 +170,12 @@ func (a *Client) GetUserRoles(params *GetUserRolesParams) (*GetUserRolesOK, erro Get all users from Auth0 */ -func (a *Client) GetUsers(params *GetUsersParams) (*GetUsersOK, error) { +func (a *Client) GetUsers(params *GetUsersParams, opts ...ClientOption) (*GetUsersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUsers", Method: "GET", PathPattern: "/api/v2/users", @@ -172,7 +186,12 @@ func (a *Client) GetUsers(params *GetUsersParams) (*GetUsersOK, error) { Reader: &GetUsersReader{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 } @@ -191,13 +210,12 @@ func (a *Client) GetUsers(params *GetUsersParams) (*GetUsersOK, error) { create new Auth0 user */ -func (a *Client) PostUsers(params *PostUsersParams) (*PostUsersCreated, error) { +func (a *Client) PostUsers(params *PostUsersParams, opts ...ClientOption) (*PostUsersCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPostUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postUsers", Method: "POST", PathPattern: "/api/v2/users-by-email", @@ -208,7 +226,12 @@ func (a *Client) PostUsers(params *PostUsersParams) (*PostUsersCreated, error) { Reader: &PostUsersReader{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 } diff --git a/api/auth0/auth0_models/credentials_request.go b/api/auth0/auth0_models/credentials_request.go index b8fce88..3a1658a 100644 --- a/api/auth0/auth0_models/credentials_request.go +++ b/api/auth0/auth0_models/credentials_request.go @@ -10,6 +10,8 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *CredentialsRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this credentials request based on context it is used +func (m *CredentialsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CredentialsRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/credentials_response.go b/api/auth0/auth0_models/credentials_response.go index f329ce4..19bcf6e 100644 --- a/api/auth0/auth0_models/credentials_response.go +++ b/api/auth0/auth0_models/credentials_response.go @@ -10,6 +10,8 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *CredentialsResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this credentials response based on context it is used +func (m *CredentialsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CredentialsResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/error.go b/api/auth0/auth0_models/error.go index 3d12740..5833565 100644 --- a/api/auth0/auth0_models/error.go +++ b/api/auth0/auth0_models/error.go @@ -10,6 +10,8 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/new_user.go b/api/auth0/auth0_models/new_user.go index 02e5400..ec85171 100644 --- a/api/auth0/auth0_models/new_user.go +++ b/api/auth0/auth0_models/new_user.go @@ -10,6 +10,8 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,48 +22,63 @@ import ( type NewUser struct { // blocked + // Example: false Blocked bool `json:"blocked,omitempty"` // connection + // Example: Initial-Connection Connection string `json:"connection,omitempty"` // email + // Example: john.doe@gmail.com Email string `json:"email,omitempty"` // email verified + // Example: false EmailVerified bool `json:"email_verified,omitempty"` // family name + // Example: Doe FamilyName string `json:"family_name,omitempty"` // given name + // Example: John GivenName string `json:"given_name,omitempty"` // name + // Example: John Doe Name string `json:"name,omitempty"` // nickname + // Example: Johnny Nickname string `json:"nickname,omitempty"` // password + // Example: secret Password string `json:"password,omitempty"` // phone number + // Example: +199999999999999 PhoneNumber string `json:"phone_number,omitempty"` // phone verified + // Example: false PhoneVerified bool `json:"phone_verified,omitempty"` // picture + // Example: https://secure.gravatar.com/avatar/15626c5e0c749cb912f9d1ad48dba440?s=480\u0026r=pg\u0026d=https%3A%2F%2Fssl.gstatic.com%2Fs2%2Fprofiles%2Fimages%2Fsilhouette80.png Picture string `json:"picture,omitempty"` // user id + // Example: abc UserID string `json:"user_id,omitempty"` // username + // Example: johndoe Username string `json:"username,omitempty"` // verify email + // Example: false VerifyEmail bool `json:"verify_email,omitempty"` } @@ -70,6 +87,11 @@ func (m *NewUser) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this new user based on context it is used +func (m *NewUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NewUser) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/role.go b/api/auth0/auth0_models/role.go index 2a43438..54b076f 100644 --- a/api/auth0/auth0_models/role.go +++ b/api/auth0/auth0_models/role.go @@ -10,6 +10,8 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,12 +22,15 @@ import ( type Role struct { // description + // Example: Taxnexus API Developer Description string `json:"description,omitempty"` // id + // Example: rol_oWVoMn2Zx2qDSGUL ID string `json:"id,omitempty"` // name + // Example: Developer Name string `json:"name,omitempty"` } @@ -34,6 +39,11 @@ func (m *Role) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this role based on context it is used +func (m *Role) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Role) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/role_response.go b/api/auth0/auth0_models/role_response.go index a5c00c5..571083d 100644 --- a/api/auth0/auth0_models/role_response.go +++ b/api/auth0/auth0_models/role_response.go @@ -10,6 +10,7 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *RoleResponse) Validate(formats strfmt.Registry) error { } func (m *RoleResponse) validateRoles(formats strfmt.Registry) error { - if swag.IsZero(m.Roles) { // not required return nil } @@ -65,6 +65,38 @@ func (m *RoleResponse) validateRoles(formats strfmt.Registry) error { return nil } +// ContextValidate validate this role response based on the context it is used +func (m *RoleResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRoles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RoleResponse) contextValidateRoles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Roles); i++ { + + if m.Roles[i] != nil { + if err := m.Roles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("roles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *RoleResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/role_users_request.go b/api/auth0/auth0_models/role_users_request.go index 9bfa5e7..1109e0f 100644 --- a/api/auth0/auth0_models/role_users_request.go +++ b/api/auth0/auth0_models/role_users_request.go @@ -10,6 +10,8 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *RoleUsersRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this role users request based on context it is used +func (m *RoleUsersRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RoleUsersRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/user.go b/api/auth0/auth0_models/user.go index 2e0f0b7..2028d00 100644 --- a/api/auth0/auth0_models/user.go +++ b/api/auth0/auth0_models/user.go @@ -10,6 +10,7 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -26,51 +27,66 @@ type User struct { AppMetadata *UserAppMetadata `json:"app_metadata,omitempty"` // created at + // Example: 2018-06-06T16:00:55.930Z CreatedAt string `json:"created_at,omitempty"` // email + // Example: vern@taxnexus.net Email string `json:"email,omitempty"` // email verified + // Example: true EmailVerified bool `json:"email_verified,omitempty"` // family name + // Example: Keenan FamilyName string `json:"family_name,omitempty"` // given name + // Example: Vernon GivenName string `json:"given_name,omitempty"` // identities Identities []*UserIdentitiesItems0 `json:"identities"` // last ip + // Example: 67.188.106.161 LastIP string `json:"last_ip,omitempty"` // last login + // Example: 2020-09-22T19:19:02.706Z LastLogin string `json:"last_login,omitempty"` // last password reset + // Example: 2020-09-21T00:11:47.397Z LastPasswordReset string `json:"last_password_reset,omitempty"` // logins count + // Example: 178 LoginsCount int64 `json:"logins_count,omitempty"` // multifactor last modified + // Example: 2020-09-21T00:30:34.081Z MultifactorLastModified string `json:"multifactor_last_modified,omitempty"` // name + // Example: Vernon Keenan Name string `json:"name,omitempty"` // nickname + // Example: vern Nickname string `json:"nickname,omitempty"` // picture + // Example: https://s.gravatar.com/avatar/a08710b8d49416c729a0da8a9c34cdb0?s=480\u0026r=pg\u0026d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fve.png Picture string `json:"picture,omitempty"` // updated at + // Example: 2020-09-22T19:19:02.706Z UpdatedAt string `json:"updated_at,omitempty"` // user id + // Example: auth0|5b180537157859716f2c9df5 UserID string `json:"user_id,omitempty"` // user metadata @@ -100,7 +116,6 @@ func (m *User) Validate(formats strfmt.Registry) error { } func (m *User) validateAppMetadata(formats strfmt.Registry) error { - if swag.IsZero(m.AppMetadata) { // not required return nil } @@ -118,7 +133,6 @@ func (m *User) validateAppMetadata(formats strfmt.Registry) error { } func (m *User) validateIdentities(formats strfmt.Registry) error { - if swag.IsZero(m.Identities) { // not required return nil } @@ -143,7 +157,6 @@ func (m *User) validateIdentities(formats strfmt.Registry) error { } func (m *User) validateUserMetadata(formats strfmt.Registry) error { - if swag.IsZero(m.UserMetadata) { // not required return nil } @@ -160,6 +173,74 @@ func (m *User) validateUserMetadata(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user based on the context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAppMetadata(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIdentities(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserMetadata(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) contextValidateAppMetadata(ctx context.Context, formats strfmt.Registry) error { + + if m.AppMetadata != nil { + if err := m.AppMetadata.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("app_metadata") + } + return err + } + } + + return nil +} + +func (m *User) contextValidateIdentities(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Identities); i++ { + + if m.Identities[i] != nil { + if err := m.Identities[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("identities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *User) contextValidateUserMetadata(ctx context.Context, formats strfmt.Registry) error { + + if m.UserMetadata != nil { + if err := m.UserMetadata.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user_metadata") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *User) MarshalBinary() ([]byte, error) { if m == nil { @@ -184,15 +265,19 @@ func (m *User) UnmarshalBinary(b []byte) error { type UserAppMetadata struct { // roles + // Example: ["login"] Roles []string `json:"roles"` // taxnexus account id + // Example: 7f661ca6-ae4a-486f-9c3c-cd292685a46d TaxnexusAccountID string `json:"taxnexus_account_id,omitempty"` // taxnexus contact id + // Example: 9f79dca8-e875-4e2b-a5ad-001a3d32e83d TaxnexusContactID string `json:"taxnexus_contact_id,omitempty"` // taxnexus user id + // Example: f04da03d-70ad-46df-a46c-a676388aadd7 TaxnexusUserID string `json:"taxnexus_user_id,omitempty"` } @@ -201,6 +286,11 @@ func (m *UserAppMetadata) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user app metadata based on context it is used +func (m *UserAppMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserAppMetadata) MarshalBinary() ([]byte, error) { if m == nil { @@ -225,15 +315,19 @@ func (m *UserAppMetadata) UnmarshalBinary(b []byte) error { type UserIdentitiesItems0 struct { // connection + // Example: Username-Password-Authentication Connection string `json:"connection,omitempty"` // is social + // Example: false IsSocial bool `json:"isSocial,omitempty"` // provider + // Example: auth0 Provider string `json:"provider,omitempty"` // user id + // Example: 5b180537157859716f2c9df5 UserID string `json:"user_id,omitempty"` } @@ -242,6 +336,11 @@ func (m *UserIdentitiesItems0) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user identities items0 based on context it is used +func (m *UserIdentitiesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserIdentitiesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -266,18 +365,23 @@ func (m *UserIdentitiesItems0) UnmarshalBinary(b []byte) error { type UserUserMetadata struct { // taxnexus email + // Example: vern@taxnexus.net TaxnexusEmail string `json:"taxnexus_email,omitempty"` // taxnexus firstname + // Example: Vernon TaxnexusFirstname string `json:"taxnexus_firstname,omitempty"` // taxnexus fullname + // Example: Vernon Keenan TaxnexusFullname string `json:"taxnexus_fullname,omitempty"` // taxnexus lastname + // Example: Keenan TaxnexusLastname string `json:"taxnexus_lastname,omitempty"` // taxnexus phone + // Example: +15106791900 TaxnexusPhone string `json:"taxnexus_phone,omitempty"` } @@ -286,6 +390,11 @@ func (m *UserUserMetadata) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user user metadata based on context it is used +func (m *UserUserMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserUserMetadata) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/user_request.go b/api/auth0/auth0_models/user_request.go index f31c609..9ee8ada 100644 --- a/api/auth0/auth0_models/user_request.go +++ b/api/auth0/auth0_models/user_request.go @@ -10,6 +10,7 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *UserRequest) Validate(formats strfmt.Registry) error { } func (m *UserRequest) validateUsers(formats strfmt.Registry) error { - if swag.IsZero(m.Users) { // not required return nil } @@ -65,6 +65,38 @@ func (m *UserRequest) validateUsers(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user request based on the context it is used +func (m *UserRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserRequest) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Users); i++ { + + if m.Users[i] != nil { + if err := m.Users[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *UserRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/auth0/auth0_models/user_roles_request.go b/api/auth0/auth0_models/user_roles_request.go index 129ad7e..27ec34e 100644 --- a/api/auth0/auth0_models/user_roles_request.go +++ b/api/auth0/auth0_models/user_roles_request.go @@ -10,6 +10,8 @@ package auth0_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *UserRolesRequest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user roles request based on context it is used +func (m *UserRolesRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserRolesRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_client/members/get_member_parameters.go b/api/blaze/blaze_client/members/get_member_parameters.go index c6f83dc..375172a 100644 --- a/api/blaze/blaze_client/members/get_member_parameters.go +++ b/api/blaze/blaze_client/members/get_member_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetMemberParams creates a new GetMemberParams object -// with the default values initialized. +// NewGetMemberParams creates a new GetMemberParams 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 NewGetMemberParams() *GetMemberParams { - var () return &GetMemberParams{ - timeout: cr.DefaultTimeout, } } // NewGetMemberParamsWithTimeout creates a new GetMemberParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetMemberParamsWithTimeout(timeout time.Duration) *GetMemberParams { - var () return &GetMemberParams{ - timeout: timeout, } } // NewGetMemberParamsWithContext creates a new GetMemberParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetMemberParamsWithContext(ctx context.Context) *GetMemberParams { - var () return &GetMemberParams{ - Context: ctx, } } // NewGetMemberParamsWithHTTPClient creates a new GetMemberParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetMemberParamsWithHTTPClient(client *http.Client) *GetMemberParams { - var () return &GetMemberParams{ HTTPClient: client, } } -/*GetMemberParams contains all the parameters to send to the API endpoint -for the get member operation typically these are written to a http.Request +/* GetMemberParams contains all the parameters to send to the API endpoint + for the get member operation. + + Typically these are written to a http.Request. */ type GetMemberParams struct { - /*MemberID - The Blaze Member Object Id + /* MemberID. + The Blaze Member Object Id */ MemberID string @@ -75,6 +74,21 @@ type GetMemberParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get member params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMemberParams) WithDefaults() *GetMemberParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get member params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMemberParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get member params func (o *GetMemberParams) WithTimeout(timeout time.Duration) *GetMemberParams { o.SetTimeout(timeout) diff --git a/api/blaze/blaze_client/members/get_member_responses.go b/api/blaze/blaze_client/members/get_member_responses.go index 3ea6216..740ce46 100644 --- a/api/blaze/blaze_client/members/get_member_responses.go +++ b/api/blaze/blaze_client/members/get_member_responses.go @@ -57,9 +57,8 @@ func (o *GetMemberReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetMemberOK() *GetMemberOK { return &GetMemberOK{} } -/*GetMemberOK handles this case with default header values. +/* GetMemberOK describes a response with status code 200, with default header values. Product was successfully retrieved */ @@ -79,7 +78,6 @@ type GetMemberOK struct { func (o *GetMemberOK) Error() string { return fmt.Sprintf("[GET /partner/members/{memberId}][%d] getMemberOK %+v", 200, o.Payload) } - func (o *GetMemberOK) GetPayload() *blaze_models.MemberResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetMemberUnauthorized() *GetMemberUnauthorized { return &GetMemberUnauthorized{} } -/*GetMemberUnauthorized handles this case with default header values. +/* GetMemberUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetMemberUnauthorized struct { func (o *GetMemberUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/members/{memberId}][%d] getMemberUnauthorized %+v", 401, o.Payload) } - func (o *GetMemberUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetMemberForbidden() *GetMemberForbidden { return &GetMemberForbidden{} } -/*GetMemberForbidden handles this case with default header values. +/* GetMemberForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetMemberForbidden struct { func (o *GetMemberForbidden) Error() string { return fmt.Sprintf("[GET /partner/members/{memberId}][%d] getMemberForbidden %+v", 403, o.Payload) } - func (o *GetMemberForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetMemberNotFound() *GetMemberNotFound { return &GetMemberNotFound{} } -/*GetMemberNotFound handles this case with default header values. +/* GetMemberNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetMemberNotFound struct { func (o *GetMemberNotFound) Error() string { return fmt.Sprintf("[GET /partner/members/{memberId}][%d] getMemberNotFound %+v", 404, o.Payload) } - func (o *GetMemberNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetMemberInternalServerError() *GetMemberInternalServerError { return &GetMemberInternalServerError{} } -/*GetMemberInternalServerError handles this case with default header values. +/* GetMemberInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetMemberInternalServerError struct { func (o *GetMemberInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/members/{memberId}][%d] getMemberInternalServerError %+v", 500, o.Payload) } - func (o *GetMemberInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/members/members_client.go b/api/blaze/blaze_client/members/members_client.go index 73b3db5..cc53d66 100644 --- a/api/blaze/blaze_client/members/members_client.go +++ b/api/blaze/blaze_client/members/members_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetMember(params *GetMemberParams, authInfo runtime.ClientAuthInfoWriter) (*GetMemberOK, error) + GetMember(params *GetMemberParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMemberOK, error) SetTransport(transport runtime.ClientTransport) } @@ -39,13 +42,12 @@ type ClientService interface { /* GetMember Get A Member (contact) */ -func (a *Client) GetMember(params *GetMemberParams, authInfo runtime.ClientAuthInfoWriter) (*GetMemberOK, error) { +func (a *Client) GetMember(params *GetMemberParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMemberOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetMemberParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getMember", Method: "GET", PathPattern: "/partner/members/{memberId}", @@ -57,7 +59,12 @@ func (a *Client) GetMember(params *GetMemberParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/blaze/blaze_client/products/get_product_parameters.go b/api/blaze/blaze_client/products/get_product_parameters.go index 905174b..d0b5414 100644 --- a/api/blaze/blaze_client/products/get_product_parameters.go +++ b/api/blaze/blaze_client/products/get_product_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetProductParams creates a new GetProductParams object -// with the default values initialized. +// NewGetProductParams creates a new GetProductParams 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 NewGetProductParams() *GetProductParams { - var () return &GetProductParams{ - timeout: cr.DefaultTimeout, } } // NewGetProductParamsWithTimeout creates a new GetProductParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetProductParamsWithTimeout(timeout time.Duration) *GetProductParams { - var () return &GetProductParams{ - timeout: timeout, } } // NewGetProductParamsWithContext creates a new GetProductParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetProductParamsWithContext(ctx context.Context) *GetProductParams { - var () return &GetProductParams{ - Context: ctx, } } // NewGetProductParamsWithHTTPClient creates a new GetProductParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetProductParamsWithHTTPClient(client *http.Client) *GetProductParams { - var () return &GetProductParams{ HTTPClient: client, } } -/*GetProductParams contains all the parameters to send to the API endpoint -for the get product operation typically these are written to a http.Request +/* GetProductParams contains all the parameters to send to the API endpoint + for the get product operation. + + Typically these are written to a http.Request. */ type GetProductParams struct { - /*ProductID - The Blaze Product Object Id + /* ProductID. + The Blaze Product Object Id */ ProductID string @@ -75,6 +74,21 @@ type GetProductParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get product params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductParams) WithDefaults() *GetProductParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get product params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get product params func (o *GetProductParams) WithTimeout(timeout time.Duration) *GetProductParams { o.SetTimeout(timeout) diff --git a/api/blaze/blaze_client/products/get_product_responses.go b/api/blaze/blaze_client/products/get_product_responses.go index 392445f..4567821 100644 --- a/api/blaze/blaze_client/products/get_product_responses.go +++ b/api/blaze/blaze_client/products/get_product_responses.go @@ -57,9 +57,8 @@ func (o *GetProductReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetProductOK() *GetProductOK { return &GetProductOK{} } -/*GetProductOK handles this case with default header values. +/* GetProductOK describes a response with status code 200, with default header values. Product was successfully retrieved */ @@ -79,7 +78,6 @@ type GetProductOK struct { func (o *GetProductOK) Error() string { return fmt.Sprintf("[GET /partner/products/{productId}][%d] getProductOK %+v", 200, o.Payload) } - func (o *GetProductOK) GetPayload() *blaze_models.ProductResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetProductUnauthorized() *GetProductUnauthorized { return &GetProductUnauthorized{} } -/*GetProductUnauthorized handles this case with default header values. +/* GetProductUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetProductUnauthorized struct { func (o *GetProductUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/products/{productId}][%d] getProductUnauthorized %+v", 401, o.Payload) } - func (o *GetProductUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetProductForbidden() *GetProductForbidden { return &GetProductForbidden{} } -/*GetProductForbidden handles this case with default header values. +/* GetProductForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetProductForbidden struct { func (o *GetProductForbidden) Error() string { return fmt.Sprintf("[GET /partner/products/{productId}][%d] getProductForbidden %+v", 403, o.Payload) } - func (o *GetProductForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetProductNotFound() *GetProductNotFound { return &GetProductNotFound{} } -/*GetProductNotFound handles this case with default header values. +/* GetProductNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetProductNotFound struct { func (o *GetProductNotFound) Error() string { return fmt.Sprintf("[GET /partner/products/{productId}][%d] getProductNotFound %+v", 404, o.Payload) } - func (o *GetProductNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetProductInternalServerError() *GetProductInternalServerError { return &GetProductInternalServerError{} } -/*GetProductInternalServerError handles this case with default header values. +/* GetProductInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetProductInternalServerError struct { func (o *GetProductInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/products/{productId}][%d] getProductInternalServerError %+v", 500, o.Payload) } - func (o *GetProductInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/products/get_products_parameters.go b/api/blaze/blaze_client/products/get_products_parameters.go index 1d5a7de..53f5e99 100644 --- a/api/blaze/blaze_client/products/get_products_parameters.go +++ b/api/blaze/blaze_client/products/get_products_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetProductsParams creates a new GetProductsParams object -// with the default values initialized. +// NewGetProductsParams creates a new GetProductsParams 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 NewGetProductsParams() *GetProductsParams { - return &GetProductsParams{ - timeout: cr.DefaultTimeout, } } // NewGetProductsParamsWithTimeout creates a new GetProductsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetProductsParamsWithTimeout(timeout time.Duration) *GetProductsParams { - return &GetProductsParams{ - timeout: timeout, } } // NewGetProductsParamsWithContext creates a new GetProductsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetProductsParamsWithContext(ctx context.Context) *GetProductsParams { - return &GetProductsParams{ - Context: ctx, } } // NewGetProductsParamsWithHTTPClient creates a new GetProductsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetProductsParamsWithHTTPClient(client *http.Client) *GetProductsParams { - return &GetProductsParams{ HTTPClient: client, } } -/*GetProductsParams contains all the parameters to send to the API endpoint -for the get products operation typically these are written to a http.Request +/* GetProductsParams contains all the parameters to send to the API endpoint + for the get products operation. + + Typically these are written to a http.Request. */ type GetProductsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetProductsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsParams) WithDefaults() *GetProductsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get products params func (o *GetProductsParams) WithTimeout(timeout time.Duration) *GetProductsParams { o.SetTimeout(timeout) diff --git a/api/blaze/blaze_client/products/get_products_responses.go b/api/blaze/blaze_client/products/get_products_responses.go index 0c1ac3c..5d99d39 100644 --- a/api/blaze/blaze_client/products/get_products_responses.go +++ b/api/blaze/blaze_client/products/get_products_responses.go @@ -57,9 +57,8 @@ func (o *GetProductsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetProductsOK() *GetProductsOK { return &GetProductsOK{} } -/*GetProductsOK handles this case with default header values. +/* GetProductsOK describes a response with status code 200, with default header values. Products were successfully retrieved */ @@ -79,7 +78,6 @@ type GetProductsOK struct { func (o *GetProductsOK) Error() string { return fmt.Sprintf("[GET /partner/products][%d] getProductsOK %+v", 200, o.Payload) } - func (o *GetProductsOK) GetPayload() *blaze_models.ProductsResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetProductsUnauthorized() *GetProductsUnauthorized { return &GetProductsUnauthorized{} } -/*GetProductsUnauthorized handles this case with default header values. +/* GetProductsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetProductsUnauthorized struct { func (o *GetProductsUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/products][%d] getProductsUnauthorized %+v", 401, o.Payload) } - func (o *GetProductsUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetProductsForbidden() *GetProductsForbidden { return &GetProductsForbidden{} } -/*GetProductsForbidden handles this case with default header values. +/* GetProductsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetProductsForbidden struct { func (o *GetProductsForbidden) Error() string { return fmt.Sprintf("[GET /partner/products][%d] getProductsForbidden %+v", 403, o.Payload) } - func (o *GetProductsForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetProductsNotFound() *GetProductsNotFound { return &GetProductsNotFound{} } -/*GetProductsNotFound handles this case with default header values. +/* GetProductsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetProductsNotFound struct { func (o *GetProductsNotFound) Error() string { return fmt.Sprintf("[GET /partner/products][%d] getProductsNotFound %+v", 404, o.Payload) } - func (o *GetProductsNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetProductsInternalServerError() *GetProductsInternalServerError { return &GetProductsInternalServerError{} } -/*GetProductsInternalServerError handles this case with default header values. +/* GetProductsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetProductsInternalServerError struct { func (o *GetProductsInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/products][%d] getProductsInternalServerError %+v", 500, o.Payload) } - func (o *GetProductsInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/products/products_client.go b/api/blaze/blaze_client/products/products_client.go index cc8a8e0..b1d6ae2 100644 --- a/api/blaze/blaze_client/products/products_client.go +++ b/api/blaze/blaze_client/products/products_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetProduct(params *GetProductParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductOK, error) + GetProduct(params *GetProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductOK, error) - GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error) + GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { /* GetProduct Get A Product */ -func (a *Client) GetProduct(params *GetProductParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductOK, error) { +func (a *Client) GetProduct(params *GetProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetProductParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getProduct", Method: "GET", PathPattern: "/partner/products/{productId}", @@ -59,7 +61,12 @@ func (a *Client) GetProduct(params *GetProductParams, authInfo runtime.ClientAut 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 } @@ -76,13 +83,12 @@ func (a *Client) GetProduct(params *GetProductParams, authInfo runtime.ClientAut /* GetProducts Get All Products */ -func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error) { +func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetProductsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getProducts", Method: "GET", PathPattern: "/partner/products", @@ -94,7 +100,12 @@ func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientA 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 } diff --git a/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_parameters.go b/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_parameters.go index e21bdf5..8afb8ad 100644 --- a/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_parameters.go +++ b/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPurchaseOrderListParams creates a new GetPurchaseOrderListParams object -// with the default values initialized. +// NewGetPurchaseOrderListParams creates a new GetPurchaseOrderListParams 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 NewGetPurchaseOrderListParams() *GetPurchaseOrderListParams { - var () return &GetPurchaseOrderListParams{ - timeout: cr.DefaultTimeout, } } // NewGetPurchaseOrderListParamsWithTimeout creates a new GetPurchaseOrderListParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPurchaseOrderListParamsWithTimeout(timeout time.Duration) *GetPurchaseOrderListParams { - var () return &GetPurchaseOrderListParams{ - timeout: timeout, } } // NewGetPurchaseOrderListParamsWithContext creates a new GetPurchaseOrderListParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPurchaseOrderListParamsWithContext(ctx context.Context) *GetPurchaseOrderListParams { - var () return &GetPurchaseOrderListParams{ - Context: ctx, } } // NewGetPurchaseOrderListParamsWithHTTPClient creates a new GetPurchaseOrderListParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPurchaseOrderListParamsWithHTTPClient(client *http.Client) *GetPurchaseOrderListParams { - var () return &GetPurchaseOrderListParams{ HTTPClient: client, } } -/*GetPurchaseOrderListParams contains all the parameters to send to the API endpoint -for the get purchase order list operation typically these are written to a http.Request +/* GetPurchaseOrderListParams contains all the parameters to send to the API endpoint + for the get purchase order list operation. + + Typically these are written to a http.Request. */ type GetPurchaseOrderListParams struct { - /*EndDate - The end date of transaction query + /* EndDate. + The end date of transaction query */ EndDate string - /*Limit - The number of records to retrieve + /* Limit. + + The number of records to retrieve */ Limit *float64 - /*Start - The starting record in multi-record retrievals + /* Start. + + The starting record in multi-record retrievals */ Start *float64 - /*StartDate - The start date of transaction query + /* StartDate. + + The start date of transaction query */ StartDate string @@ -91,6 +93,21 @@ type GetPurchaseOrderListParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get purchase order list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPurchaseOrderListParams) WithDefaults() *GetPurchaseOrderListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get purchase order list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPurchaseOrderListParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get purchase order list params func (o *GetPurchaseOrderListParams) WithTimeout(timeout time.Duration) *GetPurchaseOrderListParams { o.SetTimeout(timeout) @@ -180,6 +197,7 @@ func (o *GetPurchaseOrderListParams) WriteToRequest(r runtime.ClientRequest, reg qrEndDate := o.EndDate qEndDate := qrEndDate if qEndDate != "" { + if err := r.SetQueryParam("endDate", qEndDate); err != nil { return err } @@ -189,38 +207,41 @@ func (o *GetPurchaseOrderListParams) WriteToRequest(r runtime.ClientRequest, reg // query param limit var qrLimit float64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatFloat64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Start != nil { // query param start var qrStart float64 + if o.Start != nil { qrStart = *o.Start } qStart := swag.FormatFloat64(qrStart) if qStart != "" { + if err := r.SetQueryParam("start", qStart); err != nil { return err } } - } // query param startDate qrStartDate := o.StartDate qStartDate := qrStartDate if qStartDate != "" { + if err := r.SetQueryParam("startDate", qStartDate); err != nil { return err } diff --git a/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_responses.go b/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_responses.go index 3a1ed22..52451dc 100644 --- a/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_responses.go +++ b/api/blaze/blaze_client/purchase_orders/get_purchase_order_list_responses.go @@ -57,9 +57,8 @@ func (o *GetPurchaseOrderListReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPurchaseOrderListOK() *GetPurchaseOrderListOK { return &GetPurchaseOrderListOK{} } -/*GetPurchaseOrderListOK handles this case with default header values. +/* GetPurchaseOrderListOK describes a response with status code 200, with default header values. Shop was successfully retrieved */ @@ -79,7 +78,6 @@ type GetPurchaseOrderListOK struct { func (o *GetPurchaseOrderListOK) Error() string { return fmt.Sprintf("[GET /partner/store/purchaseOrder/list][%d] getPurchaseOrderListOK %+v", 200, o.Payload) } - func (o *GetPurchaseOrderListOK) GetPayload() *blaze_models.PurchaseOrderListResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPurchaseOrderListUnauthorized() *GetPurchaseOrderListUnauthorized { return &GetPurchaseOrderListUnauthorized{} } -/*GetPurchaseOrderListUnauthorized handles this case with default header values. +/* GetPurchaseOrderListUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPurchaseOrderListUnauthorized struct { func (o *GetPurchaseOrderListUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/store/purchaseOrder/list][%d] getPurchaseOrderListUnauthorized %+v", 401, o.Payload) } - func (o *GetPurchaseOrderListUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPurchaseOrderListForbidden() *GetPurchaseOrderListForbidden { return &GetPurchaseOrderListForbidden{} } -/*GetPurchaseOrderListForbidden handles this case with default header values. +/* GetPurchaseOrderListForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPurchaseOrderListForbidden struct { func (o *GetPurchaseOrderListForbidden) Error() string { return fmt.Sprintf("[GET /partner/store/purchaseOrder/list][%d] getPurchaseOrderListForbidden %+v", 403, o.Payload) } - func (o *GetPurchaseOrderListForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPurchaseOrderListNotFound() *GetPurchaseOrderListNotFound { return &GetPurchaseOrderListNotFound{} } -/*GetPurchaseOrderListNotFound handles this case with default header values. +/* GetPurchaseOrderListNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPurchaseOrderListNotFound struct { func (o *GetPurchaseOrderListNotFound) Error() string { return fmt.Sprintf("[GET /partner/store/purchaseOrder/list][%d] getPurchaseOrderListNotFound %+v", 404, o.Payload) } - func (o *GetPurchaseOrderListNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPurchaseOrderListInternalServerError() *GetPurchaseOrderListInternalS return &GetPurchaseOrderListInternalServerError{} } -/*GetPurchaseOrderListInternalServerError handles this case with default header values. +/* GetPurchaseOrderListInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPurchaseOrderListInternalServerError struct { func (o *GetPurchaseOrderListInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/store/purchaseOrder/list][%d] getPurchaseOrderListInternalServerError %+v", 500, o.Payload) } - func (o *GetPurchaseOrderListInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/purchase_orders/purchase_orders_client.go b/api/blaze/blaze_client/purchase_orders/purchase_orders_client.go index 8659f42..1e3eb5e 100644 --- a/api/blaze/blaze_client/purchase_orders/purchase_orders_client.go +++ b/api/blaze/blaze_client/purchase_orders/purchase_orders_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetPurchaseOrderList(params *GetPurchaseOrderListParams, authInfo runtime.ClientAuthInfoWriter) (*GetPurchaseOrderListOK, error) + GetPurchaseOrderList(params *GetPurchaseOrderListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPurchaseOrderListOK, error) SetTransport(transport runtime.ClientTransport) } @@ -39,13 +42,12 @@ type ClientService interface { /* GetPurchaseOrderList Get a list of purchase orders */ -func (a *Client) GetPurchaseOrderList(params *GetPurchaseOrderListParams, authInfo runtime.ClientAuthInfoWriter) (*GetPurchaseOrderListOK, error) { +func (a *Client) GetPurchaseOrderList(params *GetPurchaseOrderListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPurchaseOrderListOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPurchaseOrderListParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPurchaseOrderList", Method: "GET", PathPattern: "/partner/store/purchaseOrder/list", @@ -57,7 +59,12 @@ func (a *Client) GetPurchaseOrderList(params *GetPurchaseOrderListParams, authIn 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 } diff --git a/api/blaze/blaze_client/shop/get_shop_parameters.go b/api/blaze/blaze_client/shop/get_shop_parameters.go index 42cbeaf..9fcc6a5 100644 --- a/api/blaze/blaze_client/shop/get_shop_parameters.go +++ b/api/blaze/blaze_client/shop/get_shop_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetShopParams creates a new GetShopParams object -// with the default values initialized. +// NewGetShopParams creates a new GetShopParams 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 NewGetShopParams() *GetShopParams { - return &GetShopParams{ - timeout: cr.DefaultTimeout, } } // NewGetShopParamsWithTimeout creates a new GetShopParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetShopParamsWithTimeout(timeout time.Duration) *GetShopParams { - return &GetShopParams{ - timeout: timeout, } } // NewGetShopParamsWithContext creates a new GetShopParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetShopParamsWithContext(ctx context.Context) *GetShopParams { - return &GetShopParams{ - Context: ctx, } } // NewGetShopParamsWithHTTPClient creates a new GetShopParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetShopParamsWithHTTPClient(client *http.Client) *GetShopParams { - return &GetShopParams{ HTTPClient: client, } } -/*GetShopParams contains all the parameters to send to the API endpoint -for the get shop operation typically these are written to a http.Request +/* GetShopParams contains all the parameters to send to the API endpoint + for the get shop operation. + + Typically these are written to a http.Request. */ type GetShopParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetShopParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get shop params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetShopParams) WithDefaults() *GetShopParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get shop params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetShopParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get shop params func (o *GetShopParams) WithTimeout(timeout time.Duration) *GetShopParams { o.SetTimeout(timeout) diff --git a/api/blaze/blaze_client/shop/get_shop_responses.go b/api/blaze/blaze_client/shop/get_shop_responses.go index 42b52a4..891bea4 100644 --- a/api/blaze/blaze_client/shop/get_shop_responses.go +++ b/api/blaze/blaze_client/shop/get_shop_responses.go @@ -57,9 +57,8 @@ func (o *GetShopReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetShopOK() *GetShopOK { return &GetShopOK{} } -/*GetShopOK handles this case with default header values. +/* GetShopOK describes a response with status code 200, with default header values. Shop was successfully retrieved */ @@ -79,7 +78,6 @@ type GetShopOK struct { func (o *GetShopOK) Error() string { return fmt.Sprintf("[GET /partner/store][%d] getShopOK %+v", 200, o.Payload) } - func (o *GetShopOK) GetPayload() *blaze_models.ShopResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetShopUnauthorized() *GetShopUnauthorized { return &GetShopUnauthorized{} } -/*GetShopUnauthorized handles this case with default header values. +/* GetShopUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetShopUnauthorized struct { func (o *GetShopUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/store][%d] getShopUnauthorized %+v", 401, o.Payload) } - func (o *GetShopUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetShopForbidden() *GetShopForbidden { return &GetShopForbidden{} } -/*GetShopForbidden handles this case with default header values. +/* GetShopForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetShopForbidden struct { func (o *GetShopForbidden) Error() string { return fmt.Sprintf("[GET /partner/store][%d] getShopForbidden %+v", 403, o.Payload) } - func (o *GetShopForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetShopNotFound() *GetShopNotFound { return &GetShopNotFound{} } -/*GetShopNotFound handles this case with default header values. +/* GetShopNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetShopNotFound struct { func (o *GetShopNotFound) Error() string { return fmt.Sprintf("[GET /partner/store][%d] getShopNotFound %+v", 404, o.Payload) } - func (o *GetShopNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetShopInternalServerError() *GetShopInternalServerError { return &GetShopInternalServerError{} } -/*GetShopInternalServerError handles this case with default header values. +/* GetShopInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetShopInternalServerError struct { func (o *GetShopInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/store][%d] getShopInternalServerError %+v", 500, o.Payload) } - func (o *GetShopInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/shop/shop_client.go b/api/blaze/blaze_client/shop/shop_client.go index 84db455..2e258c5 100644 --- a/api/blaze/blaze_client/shop/shop_client.go +++ b/api/blaze/blaze_client/shop/shop_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetShop(params *GetShopParams, authInfo runtime.ClientAuthInfoWriter) (*GetShopOK, error) + GetShop(params *GetShopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetShopOK, error) SetTransport(transport runtime.ClientTransport) } @@ -39,13 +42,12 @@ type ClientService interface { /* GetShop Get basic Shop parameters */ -func (a *Client) GetShop(params *GetShopParams, authInfo runtime.ClientAuthInfoWriter) (*GetShopOK, error) { +func (a *Client) GetShop(params *GetShopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetShopOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetShopParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getShop", Method: "GET", PathPattern: "/partner/store", @@ -57,7 +59,12 @@ func (a *Client) GetShop(params *GetShopParams, authInfo runtime.ClientAuthInfoW 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 } diff --git a/api/blaze/blaze_client/transactions/get_transaction_by_id_parameters.go b/api/blaze/blaze_client/transactions/get_transaction_by_id_parameters.go index 30cbed9..9067add 100644 --- a/api/blaze/blaze_client/transactions/get_transaction_by_id_parameters.go +++ b/api/blaze/blaze_client/transactions/get_transaction_by_id_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTransactionByIDParams creates a new GetTransactionByIDParams object -// with the default values initialized. +// NewGetTransactionByIDParams creates a new GetTransactionByIDParams 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 NewGetTransactionByIDParams() *GetTransactionByIDParams { - var () return &GetTransactionByIDParams{ - timeout: cr.DefaultTimeout, } } // NewGetTransactionByIDParamsWithTimeout creates a new GetTransactionByIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTransactionByIDParamsWithTimeout(timeout time.Duration) *GetTransactionByIDParams { - var () return &GetTransactionByIDParams{ - timeout: timeout, } } // NewGetTransactionByIDParamsWithContext creates a new GetTransactionByIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTransactionByIDParamsWithContext(ctx context.Context) *GetTransactionByIDParams { - var () return &GetTransactionByIDParams{ - Context: ctx, } } // NewGetTransactionByIDParamsWithHTTPClient creates a new GetTransactionByIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTransactionByIDParamsWithHTTPClient(client *http.Client) *GetTransactionByIDParams { - var () return &GetTransactionByIDParams{ HTTPClient: client, } } -/*GetTransactionByIDParams contains all the parameters to send to the API endpoint -for the get transaction by Id operation typically these are written to a http.Request +/* GetTransactionByIDParams contains all the parameters to send to the API endpoint + for the get transaction by Id operation. + + Typically these are written to a http.Request. */ type GetTransactionByIDParams struct { - /*ItemNumber - The Blaze Transaction Number + /* ItemNumber. + The Blaze Transaction Number */ ItemNumber string @@ -75,6 +74,21 @@ type GetTransactionByIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get transaction by Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionByIDParams) WithDefaults() *GetTransactionByIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get transaction by Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionByIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get transaction by Id params func (o *GetTransactionByIDParams) WithTimeout(timeout time.Duration) *GetTransactionByIDParams { o.SetTimeout(timeout) diff --git a/api/blaze/blaze_client/transactions/get_transaction_by_id_responses.go b/api/blaze/blaze_client/transactions/get_transaction_by_id_responses.go index 408bdbe..dd520ac 100644 --- a/api/blaze/blaze_client/transactions/get_transaction_by_id_responses.go +++ b/api/blaze/blaze_client/transactions/get_transaction_by_id_responses.go @@ -57,9 +57,8 @@ func (o *GetTransactionByIDReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetTransactionByIDOK() *GetTransactionByIDOK { return &GetTransactionByIDOK{} } -/*GetTransactionByIDOK handles this case with default header values. +/* GetTransactionByIDOK describes a response with status code 200, with default header values. A Transaction was successfully retrieved */ @@ -79,7 +78,6 @@ type GetTransactionByIDOK struct { func (o *GetTransactionByIDOK) Error() string { return fmt.Sprintf("[GET /partner/transactions/{itemNumber}][%d] getTransactionByIdOK %+v", 200, o.Payload) } - func (o *GetTransactionByIDOK) GetPayload() *blaze_models.TransactionByIDResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetTransactionByIDUnauthorized() *GetTransactionByIDUnauthorized { return &GetTransactionByIDUnauthorized{} } -/*GetTransactionByIDUnauthorized handles this case with default header values. +/* GetTransactionByIDUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetTransactionByIDUnauthorized struct { func (o *GetTransactionByIDUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/transactions/{itemNumber}][%d] getTransactionByIdUnauthorized %+v", 401, o.Payload) } - func (o *GetTransactionByIDUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetTransactionByIDForbidden() *GetTransactionByIDForbidden { return &GetTransactionByIDForbidden{} } -/*GetTransactionByIDForbidden handles this case with default header values. +/* GetTransactionByIDForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetTransactionByIDForbidden struct { func (o *GetTransactionByIDForbidden) Error() string { return fmt.Sprintf("[GET /partner/transactions/{itemNumber}][%d] getTransactionByIdForbidden %+v", 403, o.Payload) } - func (o *GetTransactionByIDForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetTransactionByIDNotFound() *GetTransactionByIDNotFound { return &GetTransactionByIDNotFound{} } -/*GetTransactionByIDNotFound handles this case with default header values. +/* GetTransactionByIDNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetTransactionByIDNotFound struct { func (o *GetTransactionByIDNotFound) Error() string { return fmt.Sprintf("[GET /partner/transactions/{itemNumber}][%d] getTransactionByIdNotFound %+v", 404, o.Payload) } - func (o *GetTransactionByIDNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetTransactionByIDInternalServerError() *GetTransactionByIDInternalServe return &GetTransactionByIDInternalServerError{} } -/*GetTransactionByIDInternalServerError handles this case with default header values. +/* GetTransactionByIDInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetTransactionByIDInternalServerError struct { func (o *GetTransactionByIDInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/transactions/{itemNumber}][%d] getTransactionByIdInternalServerError %+v", 500, o.Payload) } - func (o *GetTransactionByIDInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/transactions/get_transactions_parameters.go b/api/blaze/blaze_client/transactions/get_transactions_parameters.go index 094c547..b954bd3 100644 --- a/api/blaze/blaze_client/transactions/get_transactions_parameters.go +++ b/api/blaze/blaze_client/transactions/get_transactions_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTransactionsParams creates a new GetTransactionsParams object -// with the default values initialized. +// NewGetTransactionsParams creates a new GetTransactionsParams 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 NewGetTransactionsParams() *GetTransactionsParams { - var () return &GetTransactionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTransactionsParamsWithTimeout creates a new GetTransactionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTransactionsParamsWithTimeout(timeout time.Duration) *GetTransactionsParams { - var () return &GetTransactionsParams{ - timeout: timeout, } } // NewGetTransactionsParamsWithContext creates a new GetTransactionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTransactionsParamsWithContext(ctx context.Context) *GetTransactionsParams { - var () return &GetTransactionsParams{ - Context: ctx, } } // NewGetTransactionsParamsWithHTTPClient creates a new GetTransactionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTransactionsParamsWithHTTPClient(client *http.Client) *GetTransactionsParams { - var () return &GetTransactionsParams{ HTTPClient: client, } } -/*GetTransactionsParams contains all the parameters to send to the API endpoint -for the get transactions operation typically these are written to a http.Request +/* GetTransactionsParams contains all the parameters to send to the API endpoint + for the get transactions operation. + + Typically these are written to a http.Request. */ type GetTransactionsParams struct { - /*EndDate - The end date of transaction query + /* EndDate. + The end date of transaction query */ EndDate string - /*Limit - The number of records to retrieve + /* Limit. + + The number of records to retrieve */ Limit *float64 - /*Start - The starting record in multi-record retrievals + /* Start. + + The starting record in multi-record retrievals */ Start *float64 - /*StartDate - The start date of transaction query + /* StartDate. + + The start date of transaction query */ StartDate string @@ -91,6 +93,21 @@ type GetTransactionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionsParams) WithDefaults() *GetTransactionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get transactions params func (o *GetTransactionsParams) WithTimeout(timeout time.Duration) *GetTransactionsParams { o.SetTimeout(timeout) @@ -180,6 +197,7 @@ func (o *GetTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg strf qrEndDate := o.EndDate qEndDate := qrEndDate if qEndDate != "" { + if err := r.SetQueryParam("endDate", qEndDate); err != nil { return err } @@ -189,38 +207,41 @@ func (o *GetTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param limit var qrLimit float64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatFloat64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Start != nil { // query param start var qrStart float64 + if o.Start != nil { qrStart = *o.Start } qStart := swag.FormatFloat64(qrStart) if qStart != "" { + if err := r.SetQueryParam("start", qStart); err != nil { return err } } - } // query param startDate qrStartDate := o.StartDate qStartDate := qrStartDate if qStartDate != "" { + if err := r.SetQueryParam("startDate", qStartDate); err != nil { return err } diff --git a/api/blaze/blaze_client/transactions/get_transactions_responses.go b/api/blaze/blaze_client/transactions/get_transactions_responses.go index 494f424..c64a804 100644 --- a/api/blaze/blaze_client/transactions/get_transactions_responses.go +++ b/api/blaze/blaze_client/transactions/get_transactions_responses.go @@ -57,9 +57,8 @@ func (o *GetTransactionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetTransactionsOK() *GetTransactionsOK { return &GetTransactionsOK{} } -/*GetTransactionsOK handles this case with default header values. +/* GetTransactionsOK describes a response with status code 200, with default header values. Transactions were successfully retrieved */ @@ -79,7 +78,6 @@ type GetTransactionsOK struct { func (o *GetTransactionsOK) Error() string { return fmt.Sprintf("[GET /partner/transactions][%d] getTransactionsOK %+v", 200, o.Payload) } - func (o *GetTransactionsOK) GetPayload() *blaze_models.TransactionsResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetTransactionsUnauthorized() *GetTransactionsUnauthorized { return &GetTransactionsUnauthorized{} } -/*GetTransactionsUnauthorized handles this case with default header values. +/* GetTransactionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetTransactionsUnauthorized struct { func (o *GetTransactionsUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/transactions][%d] getTransactionsUnauthorized %+v", 401, o.Payload) } - func (o *GetTransactionsUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetTransactionsForbidden() *GetTransactionsForbidden { return &GetTransactionsForbidden{} } -/*GetTransactionsForbidden handles this case with default header values. +/* GetTransactionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetTransactionsForbidden struct { func (o *GetTransactionsForbidden) Error() string { return fmt.Sprintf("[GET /partner/transactions][%d] getTransactionsForbidden %+v", 403, o.Payload) } - func (o *GetTransactionsForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetTransactionsNotFound() *GetTransactionsNotFound { return &GetTransactionsNotFound{} } -/*GetTransactionsNotFound handles this case with default header values. +/* GetTransactionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetTransactionsNotFound struct { func (o *GetTransactionsNotFound) Error() string { return fmt.Sprintf("[GET /partner/transactions][%d] getTransactionsNotFound %+v", 404, o.Payload) } - func (o *GetTransactionsNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetTransactionsInternalServerError() *GetTransactionsInternalServerError return &GetTransactionsInternalServerError{} } -/*GetTransactionsInternalServerError handles this case with default header values. +/* GetTransactionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetTransactionsInternalServerError struct { func (o *GetTransactionsInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/transactions][%d] getTransactionsInternalServerError %+v", 500, o.Payload) } - func (o *GetTransactionsInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/transactions/transactions_client.go b/api/blaze/blaze_client/transactions/transactions_client.go index 8bb74be..c6647c8 100644 --- a/api/blaze/blaze_client/transactions/transactions_client.go +++ b/api/blaze/blaze_client/transactions/transactions_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetTransactionByID(params *GetTransactionByIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransactionByIDOK, error) + GetTransactionByID(params *GetTransactionByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransactionByIDOK, error) - GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransactionsOK, error) + GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransactionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { /* GetTransactionByID Get a single transaction by ID */ -func (a *Client) GetTransactionByID(params *GetTransactionByIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransactionByIDOK, error) { +func (a *Client) GetTransactionByID(params *GetTransactionByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransactionByIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTransactionByIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTransactionById", Method: "GET", PathPattern: "/partner/transactions/{itemNumber}", @@ -59,7 +61,12 @@ func (a *Client) GetTransactionByID(params *GetTransactionByIDParams, authInfo r 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 } @@ -76,13 +83,12 @@ func (a *Client) GetTransactionByID(params *GetTransactionByIDParams, authInfo r /* GetTransactions Get a Range of Transactions */ -func (a *Client) GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransactionsOK, error) { +func (a *Client) GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransactionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTransactionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTransactions", Method: "GET", PathPattern: "/partner/transactions", @@ -94,7 +100,12 @@ func (a *Client) GetTransactions(params *GetTransactionsParams, authInfo runtime 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 } diff --git a/api/blaze/blaze_client/vendors/get_vendor_parameters.go b/api/blaze/blaze_client/vendors/get_vendor_parameters.go index 34641be..515c623 100644 --- a/api/blaze/blaze_client/vendors/get_vendor_parameters.go +++ b/api/blaze/blaze_client/vendors/get_vendor_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetVendorParams creates a new GetVendorParams object -// with the default values initialized. +// NewGetVendorParams creates a new GetVendorParams 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 NewGetVendorParams() *GetVendorParams { - var () return &GetVendorParams{ - timeout: cr.DefaultTimeout, } } // NewGetVendorParamsWithTimeout creates a new GetVendorParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetVendorParamsWithTimeout(timeout time.Duration) *GetVendorParams { - var () return &GetVendorParams{ - timeout: timeout, } } // NewGetVendorParamsWithContext creates a new GetVendorParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetVendorParamsWithContext(ctx context.Context) *GetVendorParams { - var () return &GetVendorParams{ - Context: ctx, } } // NewGetVendorParamsWithHTTPClient creates a new GetVendorParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetVendorParamsWithHTTPClient(client *http.Client) *GetVendorParams { - var () return &GetVendorParams{ HTTPClient: client, } } -/*GetVendorParams contains all the parameters to send to the API endpoint -for the get vendor operation typically these are written to a http.Request +/* GetVendorParams contains all the parameters to send to the API endpoint + for the get vendor operation. + + Typically these are written to a http.Request. */ type GetVendorParams struct { - /*VendorID - The Blaze Vendor Object Id + /* VendorID. + The Blaze Vendor Object Id */ VendorID string @@ -75,6 +74,21 @@ type GetVendorParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get vendor params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetVendorParams) WithDefaults() *GetVendorParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get vendor params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetVendorParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get vendor params func (o *GetVendorParams) WithTimeout(timeout time.Duration) *GetVendorParams { o.SetTimeout(timeout) diff --git a/api/blaze/blaze_client/vendors/get_vendor_responses.go b/api/blaze/blaze_client/vendors/get_vendor_responses.go index e109539..a250055 100644 --- a/api/blaze/blaze_client/vendors/get_vendor_responses.go +++ b/api/blaze/blaze_client/vendors/get_vendor_responses.go @@ -57,9 +57,8 @@ func (o *GetVendorReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetVendorOK() *GetVendorOK { return &GetVendorOK{} } -/*GetVendorOK handles this case with default header values. +/* GetVendorOK describes a response with status code 200, with default header values. Product was successfully retrieved */ @@ -79,7 +78,6 @@ type GetVendorOK struct { func (o *GetVendorOK) Error() string { return fmt.Sprintf("[GET /partner/vendors/{vendorId}][%d] getVendorOK %+v", 200, o.Payload) } - func (o *GetVendorOK) GetPayload() *blaze_models.VendorResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetVendorUnauthorized() *GetVendorUnauthorized { return &GetVendorUnauthorized{} } -/*GetVendorUnauthorized handles this case with default header values. +/* GetVendorUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetVendorUnauthorized struct { func (o *GetVendorUnauthorized) Error() string { return fmt.Sprintf("[GET /partner/vendors/{vendorId}][%d] getVendorUnauthorized %+v", 401, o.Payload) } - func (o *GetVendorUnauthorized) GetPayload() *blaze_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetVendorForbidden() *GetVendorForbidden { return &GetVendorForbidden{} } -/*GetVendorForbidden handles this case with default header values. +/* GetVendorForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetVendorForbidden struct { func (o *GetVendorForbidden) Error() string { return fmt.Sprintf("[GET /partner/vendors/{vendorId}][%d] getVendorForbidden %+v", 403, o.Payload) } - func (o *GetVendorForbidden) GetPayload() *blaze_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetVendorNotFound() *GetVendorNotFound { return &GetVendorNotFound{} } -/*GetVendorNotFound handles this case with default header values. +/* GetVendorNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetVendorNotFound struct { func (o *GetVendorNotFound) Error() string { return fmt.Sprintf("[GET /partner/vendors/{vendorId}][%d] getVendorNotFound %+v", 404, o.Payload) } - func (o *GetVendorNotFound) GetPayload() *blaze_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetVendorInternalServerError() *GetVendorInternalServerError { return &GetVendorInternalServerError{} } -/*GetVendorInternalServerError handles this case with default header values. +/* GetVendorInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetVendorInternalServerError struct { func (o *GetVendorInternalServerError) Error() string { return fmt.Sprintf("[GET /partner/vendors/{vendorId}][%d] getVendorInternalServerError %+v", 500, o.Payload) } - func (o *GetVendorInternalServerError) GetPayload() *blaze_models.Error { return o.Payload } diff --git a/api/blaze/blaze_client/vendors/vendors_client.go b/api/blaze/blaze_client/vendors/vendors_client.go index 272a195..d963047 100644 --- a/api/blaze/blaze_client/vendors/vendors_client.go +++ b/api/blaze/blaze_client/vendors/vendors_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetVendor(params *GetVendorParams, authInfo runtime.ClientAuthInfoWriter) (*GetVendorOK, error) + GetVendor(params *GetVendorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVendorOK, error) SetTransport(transport runtime.ClientTransport) } @@ -39,13 +42,12 @@ type ClientService interface { /* GetVendor Get A Vendor */ -func (a *Client) GetVendor(params *GetVendorParams, authInfo runtime.ClientAuthInfoWriter) (*GetVendorOK, error) { +func (a *Client) GetVendor(params *GetVendorParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVendorOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetVendorParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getVendor", Method: "GET", PathPattern: "/partner/vendors/{vendorId}", @@ -57,7 +59,12 @@ func (a *Client) GetVendor(params *GetVendorParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/blaze/blaze_models/error.go b/api/blaze/blaze_models/error.go index e975b6d..8449ca4 100644 --- a/api/blaze/blaze_models/error.go +++ b/api/blaze/blaze_models/error.go @@ -10,6 +10,8 @@ package blaze_models // 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" @@ -45,22 +47,26 @@ func (m *Error) Validate(formats strfmt.Registry) error { } func (m *Error) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } - if err := validate.MinimumInt("status", "body", int64(m.Status), 100, false); err != nil { + if err := validate.MinimumInt("status", "body", m.Status, 100, false); err != nil { return err } - if err := validate.MaximumInt("status", "body", int64(m.Status), 600, false); err != nil { + if err := validate.MaximumInt("status", "body", m.Status, 600, false); err != nil { return err } return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/invalid_error.go b/api/blaze/blaze_models/invalid_error.go index a8f933e..c078ed5 100644 --- a/api/blaze/blaze_models/invalid_error.go +++ b/api/blaze/blaze_models/invalid_error.go @@ -10,6 +10,8 @@ package blaze_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/member_response.go b/api/blaze/blaze_models/member_response.go index 340293d..eddd556 100644 --- a/api/blaze/blaze_models/member_response.go +++ b/api/blaze/blaze_models/member_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,183 +24,238 @@ import ( type MemberResponse struct { // active transaction + // Example: 0 ActiveTransaction float64 `json:"activeTransaction,omitempty"` // address Address *MemberResponseAddress `json:"address,omitempty"` // addresses + // Example: ["string"] Addresses []string `json:"addresses"` // agreement expired + // Example: false AgreementExpired bool `json:"agreementExpired,omitempty"` // anonymous + // Example: false Anonymous bool `json:"anonymous,omitempty"` // ban patient + // Example: false BanPatient bool `json:"banPatient,omitempty"` // cannabis result + // Example: string CannabisResult string `json:"cannabisResult,omitempty"` // care giver list + // Example: ["string"] CareGiverList []string `json:"careGiverList"` // care givers + // Example: ["string"] CareGivers []string `json:"careGivers"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: AdultUse ConsumerType string `json:"consumerType,omitempty"` // consumer user Id + // Example: string ConsumerUserID string `json:"consumerUserId,omitempty"` // contracts + // Example: ["string"] Contracts []string `json:"contracts"` // created + // Example: 1554826014780 Created int64 `json:"created,omitempty"` // current cannabis limit + // Example: string CurrentCannabisLimit string `json:"currentCannabisLimit,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // dl expired + // Example: false DlExpired bool `json:"dlExpired,omitempty"` // dob + // Example: 631180800000 Dob float64 `json:"dob,omitempty"` // email + // Example: hokus@taxnexus.net Email string `json:"email,omitempty"` // email opt in + // Example: true EmailOptIn bool `json:"emailOptIn,omitempty"` // email verified + // Example: false EmailVerified bool `json:"emailVerified,omitempty"` // enable loyalty + // Example: true EnableLoyalty bool `json:"enableLoyalty,omitempty"` // enabled care giver + // Example: false EnabledCareGiver bool `json:"enabledCareGiver,omitempty"` // exp statuses + // Example: ["string"] ExpStatuses []string `json:"expStatuses"` // first name + // Example: Hokus FirstName string `json:"firstName,omitempty"` // id + // Example: 5cacc31e6218d174d3f17b70 ID string `json:"id,omitempty"` // identifications Identifications []*MemberResponseIdentificationsItems0 `json:"identifications"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // in queue + // Example: false InQueue bool `json:"inQueue,omitempty"` // last name + // Example: Pokus LastName string `json:"lastName,omitempty"` // last visit date + // Example: 1554826633661 LastVisitDate int64 `json:"lastVisitDate,omitempty"` // lifetime points + // Example: 0 LifetimePoints float64 `json:"lifetimePoints,omitempty"` // loyalty points + // Example: 0 LoyaltyPoints float64 `json:"loyaltyPoints,omitempty"` // marketing source MarketingSource string `json:"marketingSource,omitempty"` // medical + // Example: false Medical bool `json:"medical,omitempty"` // member activities + // Example: ["string"] MemberActivities []string `json:"memberActivities"` // member group MemberGroup *MemberResponseMemberGroup `json:"memberGroup,omitempty"` // member group Id + // Example: 5cabd4ba6218d148395b404b MemberGroupID string `json:"memberGroupId,omitempty"` // middle name + // Example: string MiddleName string `json:"middleName,omitempty"` // modified + // Example: 1554826633661 Modified int64 `json:"modified,omitempty"` // notes + // Example: ["string"] Notes []string `json:"notes"` // preferences + // Example: ["string"] Preferences []string `json:"preferences"` // primary phone + // Example: (510) 859-7000 PrimaryPhone string `json:"primaryPhone,omitempty"` // qb customer ref + // Example: ["string"] QbCustomerRef []string `json:"qbCustomerRef"` // qb desktop customer ref + // Example: string QbDesktopCustomerRef string `json:"qbDesktopCustomerRef,omitempty"` // recent products + // Example: ["Binsky Flower","Tommy's Bong"] RecentProducts []string `json:"recentProducts"` // recommendation expired + // Example: true RecommendationExpired bool `json:"recommendationExpired,omitempty"` // recommendation expiry left + // Example: 0 RecommendationExpiryLeft float64 `json:"recommendationExpiryLeft,omitempty"` // recommendations Recommendations []*MemberResponseRecommendationsItems0 `json:"recommendations"` // region Id + // Example: string RegionID string `json:"regionId,omitempty"` // search text + // Example: hokus pokus 5125 miles ave hokus@taxnexus.net (510) 859-7000 delivery SearchText string `json:"searchText,omitempty"` // sex + // Example: 0 Sex float64 `json:"sex,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // start date + // Example: 1554826014781 StartDate int64 `json:"startDate,omitempty"` // state cannabis limit + // Example: string StateCannabisLimit string `json:"stateCannabisLimit,omitempty"` // status + // Example: Active Status string `json:"status,omitempty"` // tags + // Example: ["string"] Tags []string `json:"tags"` // text opt in + // Example: true TextOptIn bool `json:"textOptIn,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -230,7 +286,6 @@ func (m *MemberResponse) Validate(formats strfmt.Registry) error { } func (m *MemberResponse) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -248,7 +303,6 @@ func (m *MemberResponse) validateAddress(formats strfmt.Registry) error { } func (m *MemberResponse) validateIdentifications(formats strfmt.Registry) error { - if swag.IsZero(m.Identifications) { // not required return nil } @@ -273,7 +327,6 @@ func (m *MemberResponse) validateIdentifications(formats strfmt.Registry) error } func (m *MemberResponse) validateMemberGroup(formats strfmt.Registry) error { - if swag.IsZero(m.MemberGroup) { // not required return nil } @@ -291,7 +344,6 @@ func (m *MemberResponse) validateMemberGroup(formats strfmt.Registry) error { } func (m *MemberResponse) validateRecommendations(formats strfmt.Registry) error { - if swag.IsZero(m.Recommendations) { // not required return nil } @@ -315,6 +367,96 @@ func (m *MemberResponse) validateRecommendations(formats strfmt.Registry) error return nil } +// ContextValidate validate this member response based on the context it is used +func (m *MemberResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIdentifications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemberGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRecommendations(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MemberResponse) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("address") + } + return err + } + } + + return nil +} + +func (m *MemberResponse) contextValidateIdentifications(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Identifications); i++ { + + if m.Identifications[i] != nil { + if err := m.Identifications[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("identifications" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MemberResponse) contextValidateMemberGroup(ctx context.Context, formats strfmt.Registry) error { + + if m.MemberGroup != nil { + if err := m.MemberGroup.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memberGroup") + } + return err + } + } + + return nil +} + +func (m *MemberResponse) contextValidateRecommendations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Recommendations); i++ { + + if m.Recommendations[i] != nil { + if err := m.Recommendations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("recommendations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *MemberResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -339,36 +481,47 @@ func (m *MemberResponse) UnmarshalBinary(b []byte) error { type MemberResponseAddress struct { // address + // Example: 5125 Miles Ave Address string `json:"address,omitempty"` // city + // Example: Oakland City string `json:"city,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1554826014782 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cacc31e6218d174d3f17b6d ID string `json:"id,omitempty"` // modified + // Example: 1554826014782 Modified int64 `json:"modified,omitempty"` // state + // Example: CA State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code + // Example: 94618 ZipCode string `json:"zipCode,omitempty"` } @@ -377,6 +530,11 @@ func (m *MemberResponseAddress) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this member response address based on context it is used +func (m *MemberResponseAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MemberResponseAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -404,36 +562,47 @@ type MemberResponseIdentificationsItems0 struct { Assets []*MemberResponseIdentificationsItems0AssetsItems0 `json:"assets"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554826014782 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // expiration date + // Example: 1577779200000 ExpirationDate int64 `json:"expirationDate,omitempty"` // front photo + // Example: string FrontPhoto string `json:"frontPhoto,omitempty"` // id + // Example: 5cacc31e6218d174d3f17b6e ID string `json:"id,omitempty"` // license number + // Example: MYLICENSENUM LicenseNumber string `json:"licenseNumber,omitempty"` // modified + // Example: 1554826014782 Modified int64 `json:"modified,omitempty"` // state + // Example: string State string `json:"state,omitempty"` // type + // Example: string Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -452,7 +621,6 @@ func (m *MemberResponseIdentificationsItems0) Validate(formats strfmt.Registry) } func (m *MemberResponseIdentificationsItems0) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -476,6 +644,38 @@ func (m *MemberResponseIdentificationsItems0) validateAssets(formats strfmt.Regi return nil } +// ContextValidate validate this member response identifications items0 based on the context it is used +func (m *MemberResponseIdentificationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MemberResponseIdentificationsItems0) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *MemberResponseIdentificationsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -500,54 +700,71 @@ func (m *MemberResponseIdentificationsItems0) UnmarshalBinary(b []byte) error { type MemberResponseIdentificationsItems0AssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556052368662 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbf79908a29f808183540e7 ID string `json:"id,omitempty"` // key + // Example: c71adc95-bb07-47f2-b9f6-cc4db7936686.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556052368662 Modified int64 `json:"modified,omitempty"` // name + // Example: Brian Main DL.png Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -556,6 +773,11 @@ func (m *MemberResponseIdentificationsItems0AssetsItems0) Validate(formats strfm return nil } +// ContextValidate validates this member response identifications items0 assets items0 based on context it is used +func (m *MemberResponseIdentificationsItems0AssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MemberResponseIdentificationsItems0AssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -580,57 +802,75 @@ func (m *MemberResponseIdentificationsItems0AssetsItems0) UnmarshalBinary(b []by type MemberResponseMemberGroup struct { // active + // Example: true Active bool `json:"active,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554746451740 Created int64 `json:"created,omitempty"` // default group + // Example: true DefaultGroup bool `json:"defaultGroup,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // discount + // Example: 0 Discount float64 `json:"discount,omitempty"` // discount type + // Example: Percentage DiscountType string `json:"discountType,omitempty"` // enable promotion + // Example: false EnablePromotion bool `json:"enablePromotion,omitempty"` // id + // Example: 5cabd4ba6218d148395b404b ID string `json:"id,omitempty"` // member count + // Example: 0 MemberCount float64 `json:"memberCount,omitempty"` // member count email opt in + // Example: 0 MemberCountEmailOptIn float64 `json:"memberCountEmailOptIn,omitempty"` // member count text opt in + // Example: 0 MemberCountTextOptIn float64 `json:"memberCountTextOptIn,omitempty"` // modified + // Example: 1554824536062 Modified int64 `json:"modified,omitempty"` // name + // Example: Delivery Name string `json:"name,omitempty"` // promotion Id + // Example: string PromotionID string `json:"promotionId,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -639,6 +879,11 @@ func (m *MemberResponseMemberGroup) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this member response member group based on context it is used +func (m *MemberResponseMemberGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MemberResponseMemberGroup) MarshalBinary() ([]byte, error) { if m == nil { @@ -666,54 +911,71 @@ type MemberResponseRecommendationsItems0 struct { Assets []*MemberResponseRecommendationsItems0AssetsItems0 `json:"assets"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554826014782 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // doctor + // Example: string Doctor string `json:"doctor,omitempty"` // doctor Id + // Example: string DoctorID string `json:"doctorId,omitempty"` // expiration date + // Example: string ExpirationDate string `json:"expirationDate,omitempty"` // front photo + // Example: string FrontPhoto string `json:"frontPhoto,omitempty"` // id + // Example: 5cacc31e6218d174d3f17b6f ID string `json:"id,omitempty"` // issue date + // Example: string IssueDate string `json:"issueDate,omitempty"` // modified + // Example: 1554826014782 Modified int64 `json:"modified,omitempty"` // recommendation number + // Example: string RecommendationNumber string `json:"recommendationNumber,omitempty"` // state + // Example: string State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // verified + // Example: false Verified bool `json:"verified,omitempty"` // verify method + // Example: MANUAL VerifyMethod string `json:"verifyMethod,omitempty"` // verify phone number + // Example: string VerifyPhoneNumber string `json:"verifyPhoneNumber,omitempty"` // verify website + // Example: string VerifyWebsite string `json:"verifyWebsite,omitempty"` } @@ -732,7 +994,6 @@ func (m *MemberResponseRecommendationsItems0) Validate(formats strfmt.Registry) } func (m *MemberResponseRecommendationsItems0) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -756,6 +1017,38 @@ func (m *MemberResponseRecommendationsItems0) validateAssets(formats strfmt.Regi return nil } +// ContextValidate validate this member response recommendations items0 based on the context it is used +func (m *MemberResponseRecommendationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MemberResponseRecommendationsItems0) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *MemberResponseRecommendationsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -780,54 +1073,71 @@ func (m *MemberResponseRecommendationsItems0) UnmarshalBinary(b []byte) error { type MemberResponseRecommendationsItems0AssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556052368662 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbf79908a29f808183540e7 ID string `json:"id,omitempty"` // key + // Example: c71adc95-bb07-47f2-b9f6-cc4db7936686.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556052368662 Modified int64 `json:"modified,omitempty"` // name + // Example: Brian Main DL.png Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -836,6 +1146,11 @@ func (m *MemberResponseRecommendationsItems0AssetsItems0) Validate(formats strfm return nil } +// ContextValidate validates this member response recommendations items0 assets items0 based on context it is used +func (m *MemberResponseRecommendationsItems0AssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MemberResponseRecommendationsItems0AssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/message.go b/api/blaze/blaze_models/message.go index a640240..11d63da 100644 --- a/api/blaze/blaze_models/message.go +++ b/api/blaze/blaze_models/message.go @@ -10,6 +10,8 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,9 +22,11 @@ import ( type Message struct { // code + // Example: 200 Code float64 `json:"code,omitempty"` // message + // Example: successful operation Message string `json:"message,omitempty"` } @@ -31,6 +35,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/product_response.go b/api/blaze/blaze_models/product_response.go index 7a35eb3..024b1b2 100644 --- a/api/blaze/blaze_models/product_response.go +++ b/api/blaze/blaze_models/product_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,21 +24,26 @@ import ( type ProductResponse struct { // active + // Example: true Active bool `json:"active,omitempty"` // assets Assets []*ProductResponseAssetsItems0 `json:"assets"` // automatic re order + // Example: false AutomaticReOrder bool `json:"automaticReOrder,omitempty"` // brand + // Example: string Brand string `json:"brand,omitempty"` // brand Id + // Example: 5cba942502aeca080e3b11e3 BrandID string `json:"brandId,omitempty"` // brand name + // Example: Lowell Herb Co BrandName string `json:"brandName,omitempty"` // bundle item results @@ -47,105 +53,136 @@ type ProductResponse struct { BundleItems []*ProductResponseBundleItemsItems0 `json:"bundleItems"` // by gram + // Example: true ByGram bool `json:"byGram,omitempty"` // by prepackage + // Example: false ByPrepackage bool `json:"byPrepackage,omitempty"` // cannabis type + // Example: DEFAULT CannabisType string `json:"cannabisType,omitempty"` // category Category *ProductResponseCategory `json:"category,omitempty"` // category Id + // Example: 5c9fe425e0faca07db94b986 CategoryID string `json:"categoryId,omitempty"` // cbd + // Example: 0 Cbd float64 `json:"cbd,omitempty"` // cbda + // Example: 0 Cbda float64 `json:"cbda,omitempty"` // cbn + // Example: 0 Cbn float64 `json:"cbn,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // company link Id + // Example: MTkwNjFTMDE= CompanyLinkID string `json:"companyLinkId,omitempty"` // created + // Example: 1555533419406 Created int64 `json:"created,omitempty"` // custom gram type + // Example: GRAM CustomGramType string `json:"customGramType,omitempty"` // custom tax info + // Example: string CustomTaxInfo string `json:"customTaxInfo,omitempty"` // custom weight + // Example: 0 CustomWeight float64 `json:"customWeight,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // description + // Example: In this pack: A curated, effect based blend of sativa strains, pre-rolled into seven premium all flower smokes (3.5 grams per pack). All of our products are lab tested, we grow our flowers with only organic fertilizer, and we never use synthetic pesticides. Matches included for your convenience. Description string `json:"description,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // discountable + // Example: true Discountable bool `json:"discountable,omitempty"` // enable excise tax + // Example: false EnableExciseTax bool `json:"enableExciseTax,omitempty"` // enable mix match + // Example: false EnableMixMatch bool `json:"enableMixMatch,omitempty"` // enable weedmap + // Example: false EnableWeedmap bool `json:"enableWeedmap,omitempty"` // flower type + // Example: Sativa FlowerType string `json:"flowerType,omitempty"` // genetics + // Example: string Genetics string `json:"genetics,omitempty"` // id + // Example: 5cb78e6b829a5f0834444825 ID string `json:"id,omitempty"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // import src + // Example: string ImportSrc string `json:"importSrc,omitempty"` // low inventory notification + // Example: false LowInventoryNotification bool `json:"lowInventoryNotification,omitempty"` // low threshold + // Example: 0 LowThreshold float64 `json:"lowThreshold,omitempty"` // medical conditions MedicalConditions []string `json:"medicalConditions"` // medicinal + // Example: true Medicinal bool `json:"medicinal,omitempty"` // modified + // Example: 1556695451723 Modified int64 `json:"modified,omitempty"` // name + // Example: Lowell - 3.5g Preroll Pack - Uplifting (S) Name string `json:"name,omitempty"` // notes Notes []string `json:"notes"` // potency + // Example: false Potency bool `json:"potency,omitempty"` // potency amount @@ -155,9 +192,11 @@ type ProductResponse struct { PriceBreaks []*ProductResponsePriceBreaksItems0 `json:"priceBreaks"` // price includes a l excise + // Example: false PriceIncludesALExcise bool `json:"priceIncludesALExcise,omitempty"` // price includes excise + // Example: false PriceIncludesExcise bool `json:"priceIncludesExcise,omitempty"` // price ranges @@ -167,69 +206,87 @@ type ProductResponse struct { PricingTemplateID string `json:"pricingTemplateId,omitempty"` // product sale type + // Example: Both ProductSaleType string `json:"productSaleType,omitempty"` // product type + // Example: REGULAR ProductType string `json:"productType,omitempty"` // qb desktop item ref + // Example: string QbDesktopItemRef string `json:"qbDesktopItemRef,omitempty"` // qb item ref + // Example: string QbItemRef string `json:"qbItemRef,omitempty"` // quantities Quantities []*ProductResponseQuantitiesItems0 `json:"quantities"` // quantity available + // Example: 0 QuantityAvailable float64 `json:"quantityAvailable,omitempty"` // re order level + // Example: 0 ReOrderLevel float64 `json:"reOrderLevel,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // show in widget + // Example: true ShowInWidget bool `json:"showInWidget,omitempty"` // sku + // Example: 19061S01 Sku string `json:"sku,omitempty"` // tags Tags []string `json:"tags"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax tables TaxTables []*ProductResponseTaxTablesItems0 `json:"taxTables"` // tax type + // Example: Inherit TaxType string `json:"taxType,omitempty"` // thc + // Example: 15 Thc float64 `json:"thc,omitempty"` // thca + // Example: 0 Thca float64 `json:"thca,omitempty"` // unit price + // Example: 40 UnitPrice float64 `json:"unitPrice,omitempty"` // unit value + // Example: 1 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vendor Vendor *ProductResponseVendor `json:"vendor,omitempty"` // vendor Id + // Example: 5c82bafa4442190831bcd513 VendorID string `json:"vendorId,omitempty"` // weight per unit + // Example: EIGHTH WeightPerUnit string `json:"weightPerUnit,omitempty"` } @@ -276,7 +333,6 @@ func (m *ProductResponse) Validate(formats strfmt.Registry) error { } func (m *ProductResponse) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -301,7 +357,6 @@ func (m *ProductResponse) validateAssets(formats strfmt.Registry) error { } func (m *ProductResponse) validateBundleItems(formats strfmt.Registry) error { - if swag.IsZero(m.BundleItems) { // not required return nil } @@ -326,7 +381,6 @@ func (m *ProductResponse) validateBundleItems(formats strfmt.Registry) error { } func (m *ProductResponse) validateCategory(formats strfmt.Registry) error { - if swag.IsZero(m.Category) { // not required return nil } @@ -344,7 +398,6 @@ func (m *ProductResponse) validateCategory(formats strfmt.Registry) error { } func (m *ProductResponse) validatePotencyAmount(formats strfmt.Registry) error { - if swag.IsZero(m.PotencyAmount) { // not required return nil } @@ -362,7 +415,6 @@ func (m *ProductResponse) validatePotencyAmount(formats strfmt.Registry) error { } func (m *ProductResponse) validatePriceBreaks(formats strfmt.Registry) error { - if swag.IsZero(m.PriceBreaks) { // not required return nil } @@ -387,7 +439,6 @@ func (m *ProductResponse) validatePriceBreaks(formats strfmt.Registry) error { } func (m *ProductResponse) validateQuantities(formats strfmt.Registry) error { - if swag.IsZero(m.Quantities) { // not required return nil } @@ -412,7 +463,6 @@ func (m *ProductResponse) validateQuantities(formats strfmt.Registry) error { } func (m *ProductResponse) validateTaxTables(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTables) { // not required return nil } @@ -437,7 +487,6 @@ func (m *ProductResponse) validateTaxTables(formats strfmt.Registry) error { } func (m *ProductResponse) validateVendor(formats strfmt.Registry) error { - if swag.IsZero(m.Vendor) { // not required return nil } @@ -454,6 +503,180 @@ func (m *ProductResponse) validateVendor(formats strfmt.Registry) error { return nil } +// ContextValidate validate this product response based on the context it is used +func (m *ProductResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBundleItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCategory(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePotencyAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePriceBreaks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQuantities(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTables(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVendor(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductResponse) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponse) contextValidateBundleItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.BundleItems); i++ { + + if m.BundleItems[i] != nil { + if err := m.BundleItems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bundleItems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponse) contextValidateCategory(ctx context.Context, formats strfmt.Registry) error { + + if m.Category != nil { + if err := m.Category.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("category") + } + return err + } + } + + return nil +} + +func (m *ProductResponse) contextValidatePotencyAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.PotencyAmount != nil { + if err := m.PotencyAmount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("potencyAmount") + } + return err + } + } + + return nil +} + +func (m *ProductResponse) contextValidatePriceBreaks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PriceBreaks); i++ { + + if m.PriceBreaks[i] != nil { + if err := m.PriceBreaks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("priceBreaks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponse) contextValidateQuantities(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Quantities); i++ { + + if m.Quantities[i] != nil { + if err := m.Quantities[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quantities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponse) contextValidateTaxTables(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTables); i++ { + + if m.TaxTables[i] != nil { + if err := m.TaxTables[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTables" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponse) contextValidateVendor(ctx context.Context, formats strfmt.Registry) error { + + if m.Vendor != nil { + if err := m.Vendor.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vendor") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -478,60 +701,79 @@ func (m *ProductResponse) UnmarshalBinary(b []byte) error { type ProductResponseAssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1555828648113 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbc0fa83f8de507ff768bfd ID string `json:"id,omitempty"` // key + // Example: 99556cc6-6820-425c-8620-f4ba5a8d601f.jpg Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-public.s3.amazonaws.com/99556cc6-6820-425c-8620-f4ba5a8d601f-800x800.jpg LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/99556cc6-6820-425c-8620-f4ba5a8d601f-1600x1600.jpg LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-public.s3.amazonaws.com/99556cc6-6820-425c-8620-f4ba5a8d601f-500x500.jpg MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1555828648113 Modified int64 `json:"modified,omitempty"` // name + // Example: Lowell 3 5g.jpg Name string `json:"name,omitempty"` // orig URL + // Example: https://connect-files-public.s3.amazonaws.com/99556cc6-6820-425c-8620-f4ba5a8d601f.jpg OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://connect-files-public.s3.amazonaws.com/99556cc6-6820-425c-8620-f4ba5a8d601f.jpg PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-public.s3.amazonaws.com/99556cc6-6820-425c-8620-f4ba5a8d601f-200x200.jpg ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -540,6 +782,11 @@ func (m *ProductResponseAssetsItems0) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this product response assets items0 based on context it is used +func (m *ProductResponseAssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseAssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -575,6 +822,11 @@ func (m *ProductResponseBundleItemsItems0) Validate(formats strfmt.Registry) err return nil } +// ContextValidate validates this product response bundle items items0 based on context it is used +func (m *ProductResponseBundleItemsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseBundleItemsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -599,51 +851,66 @@ func (m *ProductResponseBundleItemsItems0) UnmarshalBinary(b []byte) error { type ProductResponseCategory struct { // active + // Example: true Active bool `json:"active,omitempty"` // cannabis + // Example: true Cannabis bool `json:"cannabis,omitempty"` // cannabis type + // Example: DEFAULT CannabisType string `json:"cannabisType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1553982501834 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5c9fe425e0faca07db94b986 ID string `json:"id,omitempty"` // low threshold + // Example: 0 LowThreshold float64 `json:"lowThreshold,omitempty"` // modified + // Example: 1553982501834 Modified int64 `json:"modified,omitempty"` // name + // Example: Preroll Name string `json:"name,omitempty"` // photo Photo *ProductResponseCategoryPhoto `json:"photo,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // unit type + // Example: units UnitType string `json:"unitType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -662,7 +929,6 @@ func (m *ProductResponseCategory) Validate(formats strfmt.Registry) error { } func (m *ProductResponseCategory) validatePhoto(formats strfmt.Registry) error { - if swag.IsZero(m.Photo) { // not required return nil } @@ -679,6 +945,34 @@ func (m *ProductResponseCategory) validatePhoto(formats strfmt.Registry) error { return nil } +// ContextValidate validate this product response category based on the context it is used +func (m *ProductResponseCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePhoto(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductResponseCategory) contextValidatePhoto(ctx context.Context, formats strfmt.Registry) error { + + if m.Photo != nil { + if err := m.Photo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("category" + "." + "photo") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseCategory) MarshalBinary() ([]byte, error) { if m == nil { @@ -703,60 +997,79 @@ func (m *ProductResponseCategory) UnmarshalBinary(b []byte) error { type ProductResponseCategoryPhoto struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1553982501834 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5c9fe425e0faca07db94b97a ID string `json:"id,omitempty"` // key + // Example: 420default-Preroll.jpg Key string `json:"key,omitempty"` // large URL + // Example: string LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: string LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: string MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1553982501834 Modified int64 `json:"modified,omitempty"` // name + // Example: Preroll.jpg Name string `json:"name,omitempty"` // orig URL + // Example: string OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://s3.amazonaws.com/connect-files-public/420default-Preroll.jpg PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: string ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -765,6 +1078,11 @@ func (m *ProductResponseCategoryPhoto) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this product response category photo based on context it is used +func (m *ProductResponseCategoryPhoto) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseCategoryPhoto) MarshalBinary() ([]byte, error) { if m == nil { @@ -789,18 +1107,23 @@ func (m *ProductResponseCategoryPhoto) UnmarshalBinary(b []byte) error { type ProductResponsePotencyAmount struct { // cbd + // Example: 0 Cbd float64 `json:"cbd,omitempty"` // cbda + // Example: 0 Cbda float64 `json:"cbda,omitempty"` // cbn + // Example: 0 Cbn float64 `json:"cbn,omitempty"` // thc + // Example: 0 Thc float64 `json:"thc,omitempty"` // thca + // Example: 0 Thca float64 `json:"thca,omitempty"` } @@ -809,6 +1132,11 @@ func (m *ProductResponsePotencyAmount) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this product response potency amount based on context it is used +func (m *ProductResponsePotencyAmount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponsePotencyAmount) MarshalBinary() ([]byte, error) { if m == nil { @@ -833,42 +1161,55 @@ func (m *ProductResponsePotencyAmount) UnmarshalBinary(b []byte) error { type ProductResponsePriceBreaksItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1555533419417 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // display name + // Example: string DisplayName string `json:"displayName,omitempty"` // id + // Example: 5cb78e6b829a5f0834444827 ID string `json:"id,omitempty"` // modified + // Example: 1555533419417 Modified int64 `json:"modified,omitempty"` // name + // Example: 1 each Name string `json:"name,omitempty"` // price + // Example: 40 Price float64 `json:"price,omitempty"` // price break type + // Example: OneGramUnit PriceBreakType string `json:"priceBreakType,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // quantity + // Example: 1 Quantity float64 `json:"quantity,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -877,6 +1218,11 @@ func (m *ProductResponsePriceBreaksItems0) Validate(formats strfmt.Registry) err return nil } +// ContextValidate validates this product response price breaks items0 based on context it is used +func (m *ProductResponsePriceBreaksItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponsePriceBreaksItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -901,33 +1247,43 @@ func (m *ProductResponsePriceBreaksItems0) UnmarshalBinary(b []byte) error { type ProductResponseQuantitiesItems0 struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1555633414363 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb91506819d9e04973cc7c2 ID string `json:"id,omitempty"` // inventory Id + // Example: 5c9fe425e0faca07db94b992 InventoryID string `json:"inventoryId,omitempty"` // modified + // Example: 1555633414363 Modified int64 `json:"modified,omitempty"` // quantity + // Example: 0 Quantity float64 `json:"quantity,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -936,6 +1292,11 @@ func (m *ProductResponseQuantitiesItems0) Validate(formats strfmt.Registry) erro return nil } +// ContextValidate validates this product response quantities items0 based on context it is used +func (m *ProductResponseQuantitiesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseQuantitiesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -960,54 +1321,67 @@ func (m *ProductResponseQuantitiesItems0) UnmarshalBinary(b []byte) error { type ProductResponseTaxTablesItems0 struct { // active + // Example: false Active bool `json:"active,omitempty"` // city tax CityTax *ProductResponseTaxTablesItems0CityTax `json:"cityTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: AdultUse ConsumerType string `json:"consumerType,omitempty"` // county tax CountyTax *ProductResponseTaxTablesItems0CountyTax `json:"countyTax,omitempty"` // created + // Example: 1555609033636 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // federal tax FederalTax *ProductResponseTaxTablesItems0FederalTax `json:"federalTax,omitempty"` // id + // Example: 5cb8b5c99c57ec083d307a93 ID string `json:"id,omitempty"` // modified + // Example: 1555609033636 Modified int64 `json:"modified,omitempty"` // name + // Example: Adult Use Name string `json:"name,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // state tax StateTax *ProductResponseTaxTablesItems0StateTax `json:"stateTax,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax type + // Example: Custom TaxType string `json:"taxType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1038,7 +1412,6 @@ func (m *ProductResponseTaxTablesItems0) Validate(formats strfmt.Registry) error } func (m *ProductResponseTaxTablesItems0) validateCityTax(formats strfmt.Registry) error { - if swag.IsZero(m.CityTax) { // not required return nil } @@ -1056,7 +1429,6 @@ func (m *ProductResponseTaxTablesItems0) validateCityTax(formats strfmt.Registry } func (m *ProductResponseTaxTablesItems0) validateCountyTax(formats strfmt.Registry) error { - if swag.IsZero(m.CountyTax) { // not required return nil } @@ -1074,7 +1446,6 @@ func (m *ProductResponseTaxTablesItems0) validateCountyTax(formats strfmt.Regist } func (m *ProductResponseTaxTablesItems0) validateFederalTax(formats strfmt.Registry) error { - if swag.IsZero(m.FederalTax) { // not required return nil } @@ -1092,7 +1463,6 @@ func (m *ProductResponseTaxTablesItems0) validateFederalTax(formats strfmt.Regis } func (m *ProductResponseTaxTablesItems0) validateStateTax(formats strfmt.Registry) error { - if swag.IsZero(m.StateTax) { // not required return nil } @@ -1109,6 +1479,88 @@ func (m *ProductResponseTaxTablesItems0) validateStateTax(formats strfmt.Registr return nil } +// ContextValidate validate this product response tax tables items0 based on the context it is used +func (m *ProductResponseTaxTablesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCityTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountyTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFederalTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStateTax(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductResponseTaxTablesItems0) contextValidateCityTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CityTax != nil { + if err := m.CityTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cityTax") + } + return err + } + } + + return nil +} + +func (m *ProductResponseTaxTablesItems0) contextValidateCountyTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CountyTax != nil { + if err := m.CountyTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("countyTax") + } + return err + } + } + + return nil +} + +func (m *ProductResponseTaxTablesItems0) contextValidateFederalTax(ctx context.Context, formats strfmt.Registry) error { + + if m.FederalTax != nil { + if err := m.FederalTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("federalTax") + } + return err + } + } + + return nil +} + +func (m *ProductResponseTaxTablesItems0) contextValidateStateTax(ctx context.Context, formats strfmt.Registry) error { + + if m.StateTax != nil { + if err := m.StateTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stateTax") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseTaxTablesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1133,45 +1585,59 @@ func (m *ProductResponseTaxTablesItems0) UnmarshalBinary(b []byte) error { type ProductResponseTaxTablesItems0CityTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1555609033636 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb8b5c99c57ec083d307a94 ID string `json:"id,omitempty"` // modified + // Example: 1555609033636 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: City Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1180,6 +1646,11 @@ func (m *ProductResponseTaxTablesItems0CityTax) Validate(formats strfmt.Registry return nil } +// ContextValidate validates this product response tax tables items0 city tax based on context it is used +func (m *ProductResponseTaxTablesItems0CityTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseTaxTablesItems0CityTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1204,45 +1675,59 @@ func (m *ProductResponseTaxTablesItems0CityTax) UnmarshalBinary(b []byte) error type ProductResponseTaxTablesItems0CountyTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1555609033636 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb8b5c99c57ec083d307a95 ID string `json:"id,omitempty"` // modified + // Example: 1555609033636 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: County Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1251,6 +1736,11 @@ func (m *ProductResponseTaxTablesItems0CountyTax) Validate(formats strfmt.Regist return nil } +// ContextValidate validates this product response tax tables items0 county tax based on context it is used +func (m *ProductResponseTaxTablesItems0CountyTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseTaxTablesItems0CountyTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1275,45 +1765,59 @@ func (m *ProductResponseTaxTablesItems0CountyTax) UnmarshalBinary(b []byte) erro type ProductResponseTaxTablesItems0FederalTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1555609033636 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb8b5c99c57ec083d307a97 ID string `json:"id,omitempty"` // modified + // Example: 1555609033636 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: Federal Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1322,6 +1826,11 @@ func (m *ProductResponseTaxTablesItems0FederalTax) Validate(formats strfmt.Regis return nil } +// ContextValidate validates this product response tax tables items0 federal tax based on context it is used +func (m *ProductResponseTaxTablesItems0FederalTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseTaxTablesItems0FederalTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1346,45 +1855,59 @@ func (m *ProductResponseTaxTablesItems0FederalTax) UnmarshalBinary(b []byte) err type ProductResponseTaxTablesItems0StateTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1555609033636 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb8b5c99c57ec083d307a96 ID string `json:"id,omitempty"` // modified + // Example: 1555609033636 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: State Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1393,6 +1916,11 @@ func (m *ProductResponseTaxTablesItems0StateTax) Validate(formats strfmt.Registr return nil } +// ContextValidate validates this product response tax tables items0 state tax based on context it is used +func (m *ProductResponseTaxTablesItems0StateTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseTaxTablesItems0StateTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1417,6 +1945,7 @@ func (m *ProductResponseTaxTablesItems0StateTax) UnmarshalBinary(b []byte) error type ProductResponseVendor struct { // active + // Example: true Active bool `json:"active,omitempty"` // additional address list @@ -1426,36 +1955,45 @@ type ProductResponseVendor struct { Address *ProductResponseVendorAddress `json:"address,omitempty"` // arms length type + // Example: ARMS_LENGTH ArmsLengthType string `json:"armsLengthType,omitempty"` // assets Assets []*ProductResponseVendorAssetsItems0 `json:"assets"` // back order enabled + // Example: false BackOrderEnabled bool `json:"backOrderEnabled,omitempty"` // brands + // Example: ["5cba942502aeca080e3b11e3"] Brands []string `json:"brands"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // company licenses CompanyLicenses []*ProductResponseVendorCompanyLicensesItems0 `json:"companyLicenses"` // company type + // Example: string CompanyType string `json:"companyType,omitempty"` // created + // Example: 1552071418457 Created int64 `json:"created,omitempty"` // credits + // Example: 0 Credits float64 `json:"credits,omitempty"` // dba name + // Example: string DbaName string `json:"dbaName,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // description @@ -1468,33 +2006,41 @@ type ProductResponseVendor struct { Fax string `json:"fax,omitempty"` // first name + // Example: Dom FirstName string `json:"firstName,omitempty"` // id + // Example: 5c82bafa4442190831bcd513 ID string `json:"id,omitempty"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // last name LastName string `json:"lastName,omitempty"` // licence type + // Example: string LicenceType string `json:"licenceType,omitempty"` // license expiration date + // Example: 0 LicenseExpirationDate float64 `json:"licenseExpirationDate,omitempty"` // license number LicenseNumber string `json:"licenseNumber,omitempty"` // mobile number + // Example: string MobileNumber string `json:"mobileNumber,omitempty"` // modified + // Example: 1556175123774 Modified int64 `json:"modified,omitempty"` // name + // Example: Lowell Herb Co / The Hacienda Co LLC Name string `json:"name,omitempty"` // notes @@ -1504,21 +2050,26 @@ type ProductResponseVendor struct { Phone string `json:"phone,omitempty"` // qb desktop ref + // Example: string QbDesktopRef string `json:"qbDesktopRef,omitempty"` // qb vendor ref QbVendorRef []string `json:"qbVendorRef"` // related entity + // Example: false RelatedEntity bool `json:"relatedEntity,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vendor key + // Example: NWM3ZThjN2I3MjJlZDYwN2U2MWVkYjA2X2xvd2VsbCBoZXJiIGNvIC8gdGhlIGhhY2llbmRhIGNvIGxsYw== VendorKey string `json:"vendorKey,omitempty"` // vendor type + // Example: VENDOR VendorType string `json:"vendorType,omitempty"` // website @@ -1548,7 +2099,6 @@ func (m *ProductResponseVendor) Validate(formats strfmt.Registry) error { } func (m *ProductResponseVendor) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -1566,7 +2116,6 @@ func (m *ProductResponseVendor) validateAddress(formats strfmt.Registry) error { } func (m *ProductResponseVendor) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -1591,7 +2140,6 @@ func (m *ProductResponseVendor) validateAssets(formats strfmt.Registry) error { } func (m *ProductResponseVendor) validateCompanyLicenses(formats strfmt.Registry) error { - if swag.IsZero(m.CompanyLicenses) { // not required return nil } @@ -1615,6 +2163,78 @@ func (m *ProductResponseVendor) validateCompanyLicenses(formats strfmt.Registry) return nil } +// ContextValidate validate this product response vendor based on the context it is used +func (m *ProductResponseVendor) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCompanyLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductResponseVendor) 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("vendor" + "." + "address") + } + return err + } + } + + return nil +} + +func (m *ProductResponseVendor) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vendor" + "." + "assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponseVendor) contextValidateCompanyLicenses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CompanyLicenses); i++ { + + if m.CompanyLicenses[i] != nil { + if err := m.CompanyLicenses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vendor" + "." + "companyLicenses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseVendor) MarshalBinary() ([]byte, error) { if m == nil { @@ -1645,27 +2265,34 @@ type ProductResponseVendorAddress struct { City string `json:"city,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1552071418457 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5c82bafa4442190831bcd512 ID string `json:"id,omitempty"` // modified + // Example: 1552071418457 Modified int64 `json:"modified,omitempty"` // state State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code @@ -1677,6 +2304,11 @@ func (m *ProductResponseVendorAddress) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this product response vendor address based on context it is used +func (m *ProductResponseVendorAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseVendorAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -1701,54 +2333,71 @@ func (m *ProductResponseVendorAddress) UnmarshalBinary(b []byte) error { type ProductResponseVendorAssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556052368662 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbf79908a29f808183540e7 ID string `json:"id,omitempty"` // key + // Example: c71adc95-bb07-47f2-b9f6-cc4db7936686.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556052368662 Modified int64 `json:"modified,omitempty"` // name + // Example: Brian Main DL.png Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1757,6 +2406,11 @@ func (m *ProductResponseVendorAssetsItems0) Validate(formats strfmt.Registry) er return nil } +// ContextValidate validates this product response vendor assets items0 based on context it is used +func (m *ProductResponseVendorAssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseVendorAssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1781,33 +2435,42 @@ func (m *ProductResponseVendorAssetsItems0) UnmarshalBinary(b []byte) error { type ProductResponseVendorCompanyLicensesItems0 struct { // company type + // Example: RETAILER CompanyType string `json:"companyType,omitempty"` // created + // Example: 1556175123774 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cc159132a77f44828c02d8b ID string `json:"id,omitempty"` // license expiration date + // Example: 0 LicenseExpirationDate float64 `json:"licenseExpirationDate,omitempty"` // license number LicenseNumber string `json:"licenseNumber,omitempty"` // license type + // Example: string LicenseType string `json:"licenseType,omitempty"` // modified + // Example: 1556175123774 Modified int64 `json:"modified,omitempty"` // to default + // Example: true ToDefault bool `json:"toDefault,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1816,6 +2479,11 @@ func (m *ProductResponseVendorCompanyLicensesItems0) Validate(formats strfmt.Reg return nil } +// ContextValidate validates this product response vendor company licenses items0 based on context it is used +func (m *ProductResponseVendorCompanyLicensesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductResponseVendorCompanyLicensesItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/products_response.go b/api/blaze/blaze_models/products_response.go index cba9376..e2d0eb3 100644 --- a/api/blaze/blaze_models/products_response.go +++ b/api/blaze/blaze_models/products_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,12 +24,15 @@ import ( type ProductsResponse struct { // limit + // Example: 200 Limit float64 `json:"limit,omitempty"` // skip + // Example: 0 Skip float64 `json:"skip,omitempty"` // total + // Example: 2 Total float64 `json:"total,omitempty"` // values @@ -50,7 +54,6 @@ func (m *ProductsResponse) Validate(formats strfmt.Registry) error { } func (m *ProductsResponse) validateValues(formats strfmt.Registry) error { - if swag.IsZero(m.Values) { // not required return nil } @@ -74,6 +77,38 @@ func (m *ProductsResponse) validateValues(formats strfmt.Registry) error { return nil } +// ContextValidate validate this products response based on the context it is used +func (m *ProductsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateValues(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductsResponse) contextValidateValues(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Values); i++ { + + if m.Values[i] != nil { + if err := m.Values[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("values" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -98,204 +133,267 @@ func (m *ProductsResponse) UnmarshalBinary(b []byte) error { type ProductsResponseValuesItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // assets + // Example: ["string"] Assets []*ProductsResponseValuesItems0AssetsItems0 `json:"assets"` // automatic re order + // Example: false AutomaticReOrder bool `json:"automaticReOrder,omitempty"` // brand + // Example: string Brand string `json:"brand,omitempty"` // brand Id + // Example: string BrandID string `json:"brandId,omitempty"` // bundle items + // Example: ["string"] BundleItems []string `json:"bundleItems"` // by gram + // Example: true ByGram bool `json:"byGram,omitempty"` // by prepackage + // Example: false ByPrepackage bool `json:"byPrepackage,omitempty"` // cannabis type + // Example: DEFAULT CannabisType string `json:"cannabisType,omitempty"` // category Category *ProductsResponseValuesItems0Category `json:"category,omitempty"` // category Id + // Example: 5cabd4ba6218d148395b405b CategoryID string `json:"categoryId,omitempty"` // cbd + // Example: 0 Cbd float64 `json:"cbd,omitempty"` // cbda + // Example: 0 Cbda float64 `json:"cbda,omitempty"` // cbn + // Example: 0 Cbn float64 `json:"cbn,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // company link Id + // Example: VEIxMFBSTzE= CompanyLinkID string `json:"companyLinkId,omitempty"` // created + // Example: 1554825555219 Created int64 `json:"created,omitempty"` // custom gram type + // Example: GRAM CustomGramType string `json:"customGramType,omitempty"` // custom tax info + // Example: string CustomTaxInfo string `json:"customTaxInfo,omitempty"` // custom weight + // Example: 0 CustomWeight float64 `json:"customWeight,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // description Description string `json:"description,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // discountable + // Example: true Discountable bool `json:"discountable,omitempty"` // enable excise tax + // Example: false EnableExciseTax bool `json:"enableExciseTax,omitempty"` // enable mix match + // Example: false EnableMixMatch bool `json:"enableMixMatch,omitempty"` // enable weedmap + // Example: false EnableWeedmap bool `json:"enableWeedmap,omitempty"` // flower type + // Example: Sativa FlowerType string `json:"flowerType,omitempty"` // genetics + // Example: string Genetics string `json:"genetics,omitempty"` // id + // Example: 5cacc1536218d174d3f17b10 ID string `json:"id,omitempty"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // import src + // Example: string ImportSrc string `json:"importSrc,omitempty"` // low inventory notification + // Example: false LowInventoryNotification bool `json:"lowInventoryNotification,omitempty"` // low threshold + // Example: 0 LowThreshold float64 `json:"lowThreshold,omitempty"` // medical conditions + // Example: ["string"] MedicalConditions []string `json:"medicalConditions"` // medicinal + // Example: true Medicinal bool `json:"medicinal,omitempty"` // modified + // Example: 1554942857511 Modified int64 `json:"modified,omitempty"` // name + // Example: Binsky Flower Name string `json:"name,omitempty"` // notes + // Example: ["string"] Notes []string `json:"notes"` // potency + // Example: false Potency bool `json:"potency,omitempty"` // potency amount + // Example: string PotencyAmount string `json:"potencyAmount,omitempty"` // price breaks + // Example: ["1234"] PriceBreaks []string `json:"priceBreaks"` // price includes a l excise + // Example: false PriceIncludesALExcise bool `json:"priceIncludesALExcise,omitempty"` // price includes excise + // Example: false PriceIncludesExcise bool `json:"priceIncludesExcise,omitempty"` // price ranges PriceRanges []*ProductsResponseValuesItems0PriceRangesItems0 `json:"priceRanges"` // pricing template Id + // Example: string PricingTemplateID string `json:"pricingTemplateId,omitempty"` // product sale type + // Example: Both ProductSaleType string `json:"productSaleType,omitempty"` // product type + // Example: REGULAR ProductType string `json:"productType,omitempty"` // qb desktop item ref + // Example: string QbDesktopItemRef string `json:"qbDesktopItemRef,omitempty"` // qb item ref + // Example: string QbItemRef string `json:"qbItemRef,omitempty"` // quantities Quantities []*ProductsResponseValuesItems0QuantitiesItems0 `json:"quantities"` // re order level + // Example: 0 ReOrderLevel float64 `json:"reOrderLevel,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // show in widget + // Example: true ShowInWidget bool `json:"showInWidget,omitempty"` // sku + // Example: TB10PRO1 Sku string `json:"sku,omitempty"` // tags + // Example: ["string"] Tags []string `json:"tags"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax tables + // Example: ["string"] TaxTables []string `json:"taxTables"` // tax type + // Example: Inherit TaxType string `json:"taxType,omitempty"` // thc + // Example: 0 Thc float64 `json:"thc,omitempty"` // thca + // Example: 0 Thca float64 `json:"thca,omitempty"` // unit price + // Example: 0 UnitPrice float64 `json:"unitPrice,omitempty"` // unit value + // Example: 1 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vendor + // Example: string Vendor string `json:"vendor,omitempty"` // vendor Id + // Example: 5cacc0c66218d174d3f17b0d VendorID string `json:"vendorId,omitempty"` // weight per unit + // Example: EACH WeightPerUnit string `json:"weightPerUnit,omitempty"` } @@ -326,7 +424,6 @@ func (m *ProductsResponseValuesItems0) Validate(formats strfmt.Registry) error { } func (m *ProductsResponseValuesItems0) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -351,7 +448,6 @@ func (m *ProductsResponseValuesItems0) validateAssets(formats strfmt.Registry) e } func (m *ProductsResponseValuesItems0) validateCategory(formats strfmt.Registry) error { - if swag.IsZero(m.Category) { // not required return nil } @@ -369,7 +465,6 @@ func (m *ProductsResponseValuesItems0) validateCategory(formats strfmt.Registry) } func (m *ProductsResponseValuesItems0) validatePriceRanges(formats strfmt.Registry) error { - if swag.IsZero(m.PriceRanges) { // not required return nil } @@ -394,7 +489,6 @@ func (m *ProductsResponseValuesItems0) validatePriceRanges(formats strfmt.Regist } func (m *ProductsResponseValuesItems0) validateQuantities(formats strfmt.Registry) error { - if swag.IsZero(m.Quantities) { // not required return nil } @@ -418,6 +512,100 @@ func (m *ProductsResponseValuesItems0) validateQuantities(formats strfmt.Registr return nil } +// ContextValidate validate this products response values items0 based on the context it is used +func (m *ProductsResponseValuesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCategory(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePriceRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQuantities(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductsResponseValuesItems0) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductsResponseValuesItems0) contextValidateCategory(ctx context.Context, formats strfmt.Registry) error { + + if m.Category != nil { + if err := m.Category.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("category") + } + return err + } + } + + return nil +} + +func (m *ProductsResponseValuesItems0) contextValidatePriceRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PriceRanges); i++ { + + if m.PriceRanges[i] != nil { + if err := m.PriceRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("priceRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductsResponseValuesItems0) contextValidateQuantities(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Quantities); i++ { + + if m.Quantities[i] != nil { + if err := m.Quantities[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quantities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponseValuesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -442,54 +630,71 @@ func (m *ProductsResponseValuesItems0) UnmarshalBinary(b []byte) error { type ProductsResponseValuesItems0AssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556052368662 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbf79908a29f808183540e7 ID string `json:"id,omitempty"` // key + // Example: c71adc95-bb07-47f2-b9f6-cc4db7936686.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556052368662 Modified int64 `json:"modified,omitempty"` // name + // Example: Brian Main DL.png Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -498,6 +703,11 @@ func (m *ProductsResponseValuesItems0AssetsItems0) Validate(formats strfmt.Regis return nil } +// ContextValidate validates this products response values items0 assets items0 based on context it is used +func (m *ProductsResponseValuesItems0AssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponseValuesItems0AssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -522,51 +732,66 @@ func (m *ProductsResponseValuesItems0AssetsItems0) UnmarshalBinary(b []byte) err type ProductsResponseValuesItems0Category struct { // active + // Example: true Active bool `json:"active,omitempty"` // cannabis + // Example: true Cannabis bool `json:"cannabis,omitempty"` // cannabis type + // Example: DEFAULT CannabisType string `json:"cannabisType,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554764986388 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cabd4ba6218d148395b405b ID string `json:"id,omitempty"` // low threshold + // Example: string LowThreshold string `json:"lowThreshold,omitempty"` // modified + // Example: 1554764986388 Modified int64 `json:"modified,omitempty"` // name + // Example: Flowers Name string `json:"name,omitempty"` // photo Photo *ProductsResponseValuesItems0CategoryPhoto `json:"photo,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // unit type + // Example: grams UnitType string `json:"unitType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -585,7 +810,6 @@ func (m *ProductsResponseValuesItems0Category) Validate(formats strfmt.Registry) } func (m *ProductsResponseValuesItems0Category) validatePhoto(formats strfmt.Registry) error { - if swag.IsZero(m.Photo) { // not required return nil } @@ -602,6 +826,34 @@ func (m *ProductsResponseValuesItems0Category) validatePhoto(formats strfmt.Regi return nil } +// ContextValidate validate this products response values items0 category based on the context it is used +func (m *ProductsResponseValuesItems0Category) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePhoto(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductsResponseValuesItems0Category) contextValidatePhoto(ctx context.Context, formats strfmt.Registry) error { + + if m.Photo != nil { + if err := m.Photo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("category" + "." + "photo") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponseValuesItems0Category) MarshalBinary() ([]byte, error) { if m == nil { @@ -626,60 +878,79 @@ func (m *ProductsResponseValuesItems0Category) UnmarshalBinary(b []byte) error { type ProductsResponseValuesItems0CategoryPhoto struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554764986388 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cabd4ba6218d148395b404f ID string `json:"id,omitempty"` // key + // Example: 420default-Flower.jpg Key string `json:"key,omitempty"` // large URL + // Example: string LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: string LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: string MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1554764986388 Modified int64 `json:"modified,omitempty"` // name + // Example: Flower.jpg Name string `json:"name,omitempty"` // orig URL + // Example: string OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://s3.amazonaws.com/connect-files-public/420default-Flower.jpg PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: string ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -688,6 +959,11 @@ func (m *ProductsResponseValuesItems0CategoryPhoto) Validate(formats strfmt.Regi return nil } +// ContextValidate validates this products response values items0 category photo based on context it is used +func (m *ProductsResponseValuesItems0CategoryPhoto) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponseValuesItems0CategoryPhoto) MarshalBinary() ([]byte, error) { if m == nil { @@ -712,18 +988,22 @@ func (m *ProductsResponseValuesItems0CategoryPhoto) UnmarshalBinary(b []byte) er type ProductsResponseValuesItems0PriceRangesItems0 struct { // id + // Example: 5cacc1536218d174d3f17b10_5cabd4ba6218d148395b402e ID string `json:"id,omitempty"` // price + // Example: 10 Price float64 `json:"price,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // weight tolerance WeightTolerance *ProductsResponseValuesItems0PriceRangesItems0WeightTolerance `json:"weightTolerance,omitempty"` // weight tolerance Id + // Example: 5cabd4ba6218d148395b402e WeightToleranceID string `json:"weightToleranceId,omitempty"` } @@ -742,7 +1022,6 @@ func (m *ProductsResponseValuesItems0PriceRangesItems0) Validate(formats strfmt. } func (m *ProductsResponseValuesItems0PriceRangesItems0) validateWeightTolerance(formats strfmt.Registry) error { - if swag.IsZero(m.WeightTolerance) { // not required return nil } @@ -759,6 +1038,34 @@ func (m *ProductsResponseValuesItems0PriceRangesItems0) validateWeightTolerance( return nil } +// ContextValidate validate this products response values items0 price ranges items0 based on the context it is used +func (m *ProductsResponseValuesItems0PriceRangesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateWeightTolerance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProductsResponseValuesItems0PriceRangesItems0) contextValidateWeightTolerance(ctx context.Context, formats strfmt.Registry) error { + + if m.WeightTolerance != nil { + if err := m.WeightTolerance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("weightTolerance") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponseValuesItems0PriceRangesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -783,45 +1090,59 @@ func (m *ProductsResponseValuesItems0PriceRangesItems0) UnmarshalBinary(b []byte type ProductsResponseValuesItems0PriceRangesItems0WeightTolerance struct { // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554746451739 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 0.6 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5cabd4ba6218d148395b402e ID string `json:"id,omitempty"` // modified + // Example: 1554746451739 Modified int64 `json:"modified,omitempty"` // name + // Example: .5 Gram Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 0.5 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 0.5 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: HALF_GRAM WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 0.5 WeightValue float64 `json:"weightValue,omitempty"` } @@ -830,6 +1151,11 @@ func (m *ProductsResponseValuesItems0PriceRangesItems0WeightTolerance) Validate( return nil } +// ContextValidate validates this products response values items0 price ranges items0 weight tolerance based on context it is used +func (m *ProductsResponseValuesItems0PriceRangesItems0WeightTolerance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponseValuesItems0PriceRangesItems0WeightTolerance) MarshalBinary() ([]byte, error) { if m == nil { @@ -854,33 +1180,43 @@ func (m *ProductsResponseValuesItems0PriceRangesItems0WeightTolerance) Unmarshal type ProductsResponseValuesItems0QuantitiesItems0 struct { // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554825661504 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cacc1bd6218d174d3f17b38 ID string `json:"id,omitempty"` // inventory Id + // Example: 5cabd4ba6218d148395b4067 InventoryID string `json:"inventoryId,omitempty"` // modified + // Example: 1554825661504 Modified int64 `json:"modified,omitempty"` // quantity + // Example: 890 Quantity float64 `json:"quantity,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -889,6 +1225,11 @@ func (m *ProductsResponseValuesItems0QuantitiesItems0) Validate(formats strfmt.R return nil } +// ContextValidate validates this products response values items0 quantities items0 based on context it is used +func (m *ProductsResponseValuesItems0QuantitiesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductsResponseValuesItems0QuantitiesItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/purchase_order_list_response.go b/api/blaze/blaze_models/purchase_order_list_response.go index bd39576..51fa83e 100644 --- a/api/blaze/blaze_models/purchase_order_list_response.go +++ b/api/blaze/blaze_models/purchase_order_list_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,18 +24,23 @@ import ( type PurchaseOrderListResponse struct { // after date + // Example: 0 AfterDate float64 `json:"afterDate,omitempty"` // before date + // Example: 1554944967088 BeforeDate int64 `json:"beforeDate,omitempty"` // limit + // Example: 200 Limit float64 `json:"limit,omitempty"` // skip + // Example: 0 Skip float64 `json:"skip,omitempty"` // total + // Example: 2 Total float64 `json:"total,omitempty"` // values @@ -56,7 +62,6 @@ func (m *PurchaseOrderListResponse) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderListResponse) validateValues(formats strfmt.Registry) error { - if swag.IsZero(m.Values) { // not required return nil } @@ -80,6 +85,38 @@ func (m *PurchaseOrderListResponse) validateValues(formats strfmt.Registry) erro return nil } +// ContextValidate validate this purchase order list response based on the context it is used +func (m *PurchaseOrderListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateValues(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponse) contextValidateValues(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Values); i++ { + + if m.Values[i] != nil { + if err := m.Values[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("values" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -104,135 +141,177 @@ func (m *PurchaseOrderListResponse) UnmarshalBinary(b []byte) error { type PurchaseOrderListResponseValuesItems0 struct { // amount paid + // Example: 0 AmountPaid float64 `json:"amountPaid,omitempty"` // approved by + // Example: 5cabd6e96218d148395b408b ApprovedBy string `json:"approvedBy,omitempty"` // approved by member ApprovedByMember *PurchaseOrderListResponseValuesItems0ApprovedByMember `json:"approvedByMember,omitempty"` // approved date + // Example: 1554942803672 ApprovedDate int64 `json:"approvedDate,omitempty"` // approved signature + // Example: string ApprovedSignature string `json:"approvedSignature,omitempty"` // archive + // Example: false Archive bool `json:"archive,omitempty"` // archive date + // Example: string ArchiveDate string `json:"archiveDate,omitempty"` // company asset list + // Example: ["string"] CompanyAssetList []string `json:"companyAssetList"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // company logo + // Example: https://connect-assets.s3.amazonaws.com/email/logo.jpg CompanyLogo string `json:"companyLogo,omitempty"` // completed by employee Id + // Example: 5cabd6e96218d148395b408b CompletedByEmployeeID string `json:"completedByEmployeeId,omitempty"` // completed date + // Example: 1554942856343 CompletedDate int64 `json:"completedDate,omitempty"` // created + // Example: 1554938213635 Created int64 `json:"created,omitempty"` // created by employee Id + // Example: 5cabd6e96218d148395b408b CreatedByEmployeeID string `json:"createdByEmployeeId,omitempty"` // custom term date + // Example: 1554938121828 CustomTermDate int64 `json:"customTermDate,omitempty"` // customer type + // Example: VENDOR CustomerType string `json:"customerType,omitempty"` // decline date + // Example: string DeclineDate string `json:"declineDate,omitempty"` // decline reason + // Example: string DeclineReason string `json:"declineReason,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // delivered by + // Example: string DeliveredBy string `json:"deliveredBy,omitempty"` // delivery address + // Example: string DeliveryAddress string `json:"deliveryAddress,omitempty"` // delivery charge + // Example: 0 DeliveryCharge float64 `json:"deliveryCharge,omitempty"` // delivery date + // Example: 0 DeliveryDate float64 `json:"deliveryDate,omitempty"` // delivery time + // Example: string DeliveryTime string `json:"deliveryTime,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // discount + // Example: 0 Discount float64 `json:"discount,omitempty"` // due date + // Example: 1557530213629 DueDate float64 `json:"dueDate,omitempty"` // enable delivery charge + // Example: false EnableDeliveryCharge bool `json:"enableDeliveryCharge,omitempty"` // fees + // Example: 0 Fees float64 `json:"fees,omitempty"` // flower source type + // Example: CULTIVATOR_DIRECT FlowerSourceType string `json:"flowerSourceType,omitempty"` // grand total + // Example: 7936 GrandTotal float64 `json:"grandTotal,omitempty"` // id + // Example: 5cae79656218d13275d36bf4 ID string `json:"id,omitempty"` // license Id + // Example: string LicenseID string `json:"licenseId,omitempty"` // manager receive signature + // Example: string ManagerReceiveSignature string `json:"managerReceiveSignature,omitempty"` // manual close + // Example: false ManualClose bool `json:"manualClose,omitempty"` // modified + // Example: 1554942856353 Modified int64 `json:"modified,omitempty"` // notes + // Example: string Notes string `json:"notes,omitempty"` // parent p o Id + // Example: string ParentPOID string `json:"parentPOId,omitempty"` // parent p o number + // Example: string ParentPONumber string `json:"parentPONumber,omitempty"` // po activity log PoActivityLog []*PurchaseOrderListResponseValuesItems0PoActivityLogItems0 `json:"poActivityLog"` // po number + // Example: 2-N PoNumber string `json:"poNumber,omitempty"` // po payment options + // Example: CASH PoPaymentOptions string `json:"poPaymentOptions,omitempty"` // po payment terms + // Example: NET_30 PoPaymentTerms string `json:"poPaymentTerms,omitempty"` // po product request list + // Example: string PoProductRequestList string `json:"poProductRequestList,omitempty"` // po product request result list @@ -242,69 +321,89 @@ type PurchaseOrderListResponseValuesItems0 struct { PoQrCodeAsset *PurchaseOrderListResponseValuesItems0PoQrCodeAsset `json:"poQrCodeAsset,omitempty"` // po qr code Url + // Example: https://connect-files-public.s3.amazonaws.com/5cae79656218d13275d36bf4-2-N.png PoQrCodeURL string `json:"poQrCodeUrl,omitempty"` // po type + // Example: Normal PoType string `json:"poType,omitempty"` // podue date + // Example: 1557530213635 PodueDate int64 `json:"podueDate,omitempty"` // purchase order date + // Example: 0 PurchaseOrderDate float64 `json:"purchaseOrderDate,omitempty"` // purchase order status + // Example: Closed PurchaseOrderStatus string `json:"purchaseOrderStatus,omitempty"` // qb purchase order ref + // Example: string QbPurchaseOrderRef string `json:"qbPurchaseOrderRef,omitempty"` // received by employee Id + // Example: 5cabd6e96218d148395b408b ReceivedByEmployeeID string `json:"receivedByEmployeeId,omitempty"` // received date + // Example: 1554942839629 ReceivedDate int64 `json:"receivedDate,omitempty"` // reference + // Example: string Reference string `json:"reference,omitempty"` // shipment bill Id + // Example: 5cae8b886218d13275d36c59 ShipmentBillID string `json:"shipmentBillId,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // submit for approval date + // Example: 1554938214072 SubmitForApprovalDate int64 `json:"submitForApprovalDate,omitempty"` // tax result TaxResult *PurchaseOrderListResponseValuesItems0TaxResult `json:"taxResult,omitempty"` // terms and condition + // Example: string TermsAndCondition string `json:"termsAndCondition,omitempty"` // total calc tax + // Example: 0 TotalCalcTax float64 `json:"totalCalcTax,omitempty"` // total cost + // Example: 6400 TotalCost float64 `json:"totalCost,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // total tax + // Example: 1536 TotalTax float64 `json:"totalTax,omitempty"` // transaction type + // Example: ARMS_LENGTH TransactionType string `json:"transactionType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vendor Vendor *PurchaseOrderListResponseValuesItems0Vendor `json:"vendor,omitempty"` // vendor Id + // Example: 5cacc0c66218d174d3f17b0d VendorID string `json:"vendorId,omitempty"` } @@ -343,7 +442,6 @@ func (m *PurchaseOrderListResponseValuesItems0) Validate(formats strfmt.Registry } func (m *PurchaseOrderListResponseValuesItems0) validateApprovedByMember(formats strfmt.Registry) error { - if swag.IsZero(m.ApprovedByMember) { // not required return nil } @@ -361,7 +459,6 @@ func (m *PurchaseOrderListResponseValuesItems0) validateApprovedByMember(formats } func (m *PurchaseOrderListResponseValuesItems0) validatePoActivityLog(formats strfmt.Registry) error { - if swag.IsZero(m.PoActivityLog) { // not required return nil } @@ -386,7 +483,6 @@ func (m *PurchaseOrderListResponseValuesItems0) validatePoActivityLog(formats st } func (m *PurchaseOrderListResponseValuesItems0) validatePoProductRequestResultList(formats strfmt.Registry) error { - if swag.IsZero(m.PoProductRequestResultList) { // not required return nil } @@ -411,7 +507,6 @@ func (m *PurchaseOrderListResponseValuesItems0) validatePoProductRequestResultLi } func (m *PurchaseOrderListResponseValuesItems0) validatePoQrCodeAsset(formats strfmt.Registry) error { - if swag.IsZero(m.PoQrCodeAsset) { // not required return nil } @@ -429,7 +524,6 @@ func (m *PurchaseOrderListResponseValuesItems0) validatePoQrCodeAsset(formats st } func (m *PurchaseOrderListResponseValuesItems0) validateTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.TaxResult) { // not required return nil } @@ -447,7 +541,6 @@ func (m *PurchaseOrderListResponseValuesItems0) validateTaxResult(formats strfmt } func (m *PurchaseOrderListResponseValuesItems0) validateVendor(formats strfmt.Registry) error { - if swag.IsZero(m.Vendor) { // not required return nil } @@ -464,6 +557,132 @@ func (m *PurchaseOrderListResponseValuesItems0) validateVendor(formats strfmt.Re return nil } +// ContextValidate validate this purchase order list response values items0 based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateApprovedByMember(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoActivityLog(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoProductRequestResultList(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoQrCodeAsset(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVendor(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0) contextValidateApprovedByMember(ctx context.Context, formats strfmt.Registry) error { + + if m.ApprovedByMember != nil { + if err := m.ApprovedByMember.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("approvedByMember") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0) contextValidatePoActivityLog(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PoActivityLog); i++ { + + if m.PoActivityLog[i] != nil { + if err := m.PoActivityLog[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poActivityLog" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0) contextValidatePoProductRequestResultList(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PoProductRequestResultList); i++ { + + if m.PoProductRequestResultList[i] != nil { + if err := m.PoProductRequestResultList[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poProductRequestResultList" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0) contextValidatePoQrCodeAsset(ctx context.Context, formats strfmt.Registry) error { + + if m.PoQrCodeAsset != nil { + if err := m.PoQrCodeAsset.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poQrCodeAsset") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0) contextValidateTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxResult != nil { + if err := m.TaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxResult") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0) contextValidateVendor(ctx context.Context, formats strfmt.Registry) error { + + if m.Vendor != nil { + if err := m.Vendor.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vendor") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -491,117 +710,155 @@ type PurchaseOrderListResponseValuesItems0ApprovedByMember struct { Address *PurchaseOrderListResponseValuesItems0ApprovedByMemberAddress `json:"address,omitempty"` // app access list + // Example: ["AuthenticationApp","Distribution","Retail"] AppAccessList []string `json:"appAccessList"` // assigned inventory Id + // Example: string AssignedInventoryID string `json:"assignedInventoryId,omitempty"` // assigned terminal Id + // Example: string AssignedTerminalID string `json:"assignedTerminalId,omitempty"` // can apply custom discount + // Example: false CanApplyCustomDiscount bool `json:"canApplyCustomDiscount,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554765545438 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // disabled + // Example: false Disabled bool `json:"disabled,omitempty"` // dl expiration date + // Example: string DlExpirationDate string `json:"dlExpirationDate,omitempty"` // drivers license + // Example: string DriversLicense string `json:"driversLicense,omitempty"` // email + // Example: vern@taxnexus.net Email string `json:"email,omitempty"` // employee on fleet info list + // Example: string EmployeeOnFleetInfoList string `json:"employeeOnFleetInfoList,omitempty"` // first name + // Example: Vernon FirstName string `json:"firstName,omitempty"` // id + // Example: 5cabd6e96218d148395b408b ID string `json:"id,omitempty"` // insurance company name + // Example: string InsuranceCompanyName string `json:"insuranceCompanyName,omitempty"` // insurance expire date + // Example: 0 InsuranceExpireDate float64 `json:"insuranceExpireDate,omitempty"` // last logged in shop Id + // Example: 5cabd4ba6218d148395b4043 LastLoggedInShopID string `json:"lastLoggedInShopId,omitempty"` // last name + // Example: Keenan LastName string `json:"lastName,omitempty"` // modified + // Example: 1554942481145 Modified int64 `json:"modified,omitempty"` // notes + // Example: ["string"] Notes []string `json:"notes"` // password + // Example: UbMkbvcx9ui2Bjhu3M/eoPyvJCo5VGBj Password string `json:"password,omitempty"` // phone number + // Example: (510) 679-1900 PhoneNumber string `json:"phoneNumber,omitempty"` // pin + // Example: 1234 Pin string `json:"pin,omitempty"` // policy number + // Example: string PolicyNumber string `json:"policyNumber,omitempty"` // recent location + // Example: string RecentLocation string `json:"recentLocation,omitempty"` // registration expire date + // Example: 0 RegistrationExpireDate float64 `json:"registrationExpireDate,omitempty"` // role + // Example: string Role string `json:"role,omitempty"` // role Id + // Example: 5cabd4ba6218d148395b403b RoleID string `json:"roleId,omitempty"` // shops + // Example: ["5cabd4ba6218d148395b4043"] Shops []string `json:"shops"` // time card + // Example: string TimeCard string `json:"timeCard,omitempty"` // timecard Id + // Example: 5cae8a116218d13275d36c45 TimecardID string `json:"timecardId,omitempty"` // tookan info list + // Example: string TookanInfoList string `json:"tookanInfoList,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vehicle license plate + // Example: string VehicleLicensePlate string `json:"vehicleLicensePlate,omitempty"` // vehicle make + // Example: string VehicleMake string `json:"vehicleMake,omitempty"` // vehicle model + // Example: string VehicleModel string `json:"vehicleModel,omitempty"` // vehicle pin + // Example: string VehiclePin string `json:"vehiclePin,omitempty"` // vin no + // Example: string VinNo string `json:"vinNo,omitempty"` } @@ -620,7 +877,6 @@ func (m *PurchaseOrderListResponseValuesItems0ApprovedByMember) Validate(formats } func (m *PurchaseOrderListResponseValuesItems0ApprovedByMember) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -637,6 +893,34 @@ func (m *PurchaseOrderListResponseValuesItems0ApprovedByMember) validateAddress( return nil } +// ContextValidate validate this purchase order list response values items0 approved by member based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0ApprovedByMember) 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 *PurchaseOrderListResponseValuesItems0ApprovedByMember) 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("approvedByMember" + "." + "address") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0ApprovedByMember) MarshalBinary() ([]byte, error) { if m == nil { @@ -661,36 +945,47 @@ func (m *PurchaseOrderListResponseValuesItems0ApprovedByMember) UnmarshalBinary( type PurchaseOrderListResponseValuesItems0ApprovedByMemberAddress struct { // address + // Example: 2342 Shattuck Ave Ste 182 Address string `json:"address,omitempty"` // city + // Example: Berkeley City string `json:"city,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1554765545438 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cabd6e96218d148395b408a ID string `json:"id,omitempty"` // modified + // Example: 1554765545438 Modified int64 `json:"modified,omitempty"` // state + // Example: CA State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code + // Example: 94704 ZipCode string `json:"zipCode,omitempty"` } @@ -699,6 +994,11 @@ func (m *PurchaseOrderListResponseValuesItems0ApprovedByMemberAddress) Validate( return nil } +// ContextValidate validates this purchase order list response values items0 approved by member address based on context it is used +func (m *PurchaseOrderListResponseValuesItems0ApprovedByMemberAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0ApprovedByMemberAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -723,39 +1023,51 @@ func (m *PurchaseOrderListResponseValuesItems0ApprovedByMemberAddress) Unmarshal type PurchaseOrderListResponseValuesItems0PoActivityLogItems0 struct { // activity type + // Example: NORMAL_LOG ActivityType string `json:"activityType,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554938213660 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // employee Id + // Example: 5cabd6e96218d148395b408b EmployeeID string `json:"employeeId,omitempty"` // id + // Example: 5cae79656218d13275d36bf5 ID string `json:"id,omitempty"` // log + // Example: Created PO Log string `json:"log,omitempty"` // modified + // Example: 1554938213660 Modified int64 `json:"modified,omitempty"` // purchase order Id + // Example: 5cae79656218d13275d36bf4 PurchaseOrderID string `json:"purchaseOrderId,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -764,6 +1076,11 @@ func (m *PurchaseOrderListResponseValuesItems0PoActivityLogItems0) Validate(form return nil } +// ContextValidate validates this purchase order list response values items0 po activity log items0 based on context it is used +func (m *PurchaseOrderListResponseValuesItems0PoActivityLogItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoActivityLogItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -788,84 +1105,110 @@ func (m *PurchaseOrderListResponseValuesItems0PoActivityLogItems0) UnmarshalBina type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0 struct { // batch add details + // Example: string BatchAddDetails string `json:"batchAddDetails,omitempty"` // batch quantity map + // Example: object BatchQuantityMap string `json:"batchQuantityMap,omitempty"` // cannabis + // Example: false Cannabis bool `json:"cannabis,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554938213630 Created int64 `json:"created,omitempty"` // decline reason + // Example: string DeclineReason string `json:"declineReason,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // excise tax + // Example: 1.92 ExciseTax float64 `json:"exciseTax,omitempty"` // id + // Example: 5cae79656218d13275d36bf2 ID string `json:"id,omitempty"` // modified + // Example: 1554938213630 Modified int64 `json:"modified,omitempty"` // notes + // Example: string Notes string `json:"notes,omitempty"` // product Product *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product `json:"product,omitempty"` // product Id + // Example: 5cacc1536218d174d3f17b10 ProductID string `json:"productId,omitempty"` // product name + // Example: Binsky Flower ProductName string `json:"productName,omitempty"` // receive batch status + // Example: READY_FOR_SALE ReceiveBatchStatus string `json:"receiveBatchStatus,omitempty"` // received quantity + // Example: 800 ReceivedQuantity float64 `json:"receivedQuantity,omitempty"` // request quantity + // Example: 800 RequestQuantity float64 `json:"requestQuantity,omitempty"` // request status + // Example: ACCEPTED RequestStatus string `json:"requestStatus,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // total cost + // Example: 6400 TotalCost float64 `json:"totalCost,omitempty"` // total cultivation tax + // Example: 0 TotalCultivationTax float64 `json:"totalCultivationTax,omitempty"` // total excise tax + // Example: 1536 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // track trace system + // Example: string TrackTraceSystem string `json:"trackTraceSystem,omitempty"` // tracking packages list + // Example: ["string"] TrackingPackagesList []string `json:"trackingPackagesList"` // unit price + // Example: 8 UnitPrice float64 `json:"unitPrice,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -884,7 +1227,6 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0) } func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0) validateProduct(formats strfmt.Registry) error { - if swag.IsZero(m.Product) { // not required return nil } @@ -901,6 +1243,34 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0) return nil } +// ContextValidate validate this purchase order list response values items0 po product request result list items0 based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateProduct(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0) contextValidateProduct(ctx context.Context, formats strfmt.Registry) error { + + if m.Product != nil { + if err := m.Product.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("product") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -925,204 +1295,267 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0) type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product struct { // active + // Example: true Active bool `json:"active,omitempty"` // assets Assets []*PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductAssetsItems0 `json:"assets"` // automatic re order + // Example: false AutomaticReOrder bool `json:"automaticReOrder,omitempty"` // brand + // Example: string Brand string `json:"brand,omitempty"` // brand Id + // Example: string BrandID string `json:"brandId,omitempty"` // bundle items + // Example: ["string"] BundleItems []string `json:"bundleItems"` // by gram + // Example: true ByGram bool `json:"byGram,omitempty"` // by prepackage + // Example: false ByPrepackage bool `json:"byPrepackage,omitempty"` // cannabis type + // Example: string CannabisType string `json:"cannabisType,omitempty"` // category Category *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategory `json:"category,omitempty"` // category Id + // Example: 5cabd4ba6218d148395b405b CategoryID string `json:"categoryId,omitempty"` // cbd + // Example: 0 Cbd float64 `json:"cbd,omitempty"` // cbda + // Example: 0 Cbda float64 `json:"cbda,omitempty"` // cbn + // Example: 0 Cbn float64 `json:"cbn,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // company link Id + // Example: string CompanyLinkID string `json:"companyLinkId,omitempty"` // created + // Example: 1554825555219 Created int64 `json:"created,omitempty"` // custom gram type + // Example: string CustomGramType string `json:"customGramType,omitempty"` // custom tax info + // Example: string CustomTaxInfo string `json:"customTaxInfo,omitempty"` // custom weight + // Example: 0 CustomWeight float64 `json:"customWeight,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // description + // Example: string Description string `json:"description,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // discountable + // Example: true Discountable bool `json:"discountable,omitempty"` // enable excise tax + // Example: false EnableExciseTax bool `json:"enableExciseTax,omitempty"` // enable mix match + // Example: false EnableMixMatch bool `json:"enableMixMatch,omitempty"` // enable weedmap + // Example: false EnableWeedmap bool `json:"enableWeedmap,omitempty"` // flower type + // Example: Sativa FlowerType string `json:"flowerType,omitempty"` // genetics + // Example: string Genetics string `json:"genetics,omitempty"` // id + // Example: 5cacc1536218d174d3f17b10 ID string `json:"id,omitempty"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // import src + // Example: string ImportSrc string `json:"importSrc,omitempty"` // low inventory notification + // Example: false LowInventoryNotification bool `json:"lowInventoryNotification,omitempty"` // low threshold + // Example: 0 LowThreshold float64 `json:"lowThreshold,omitempty"` // medical conditions + // Example: ["string"] MedicalConditions []string `json:"medicalConditions"` // medicinal + // Example: true Medicinal bool `json:"medicinal,omitempty"` // modified + // Example: 1554942857511 Modified int64 `json:"modified,omitempty"` // name + // Example: Binsky Flower Name string `json:"name,omitempty"` // notes + // Example: ["string"] Notes []string `json:"notes"` // potency + // Example: false Potency bool `json:"potency,omitempty"` // potency amount + // Example: string PotencyAmount string `json:"potencyAmount,omitempty"` // price breaks + // Example: ["string"] PriceBreaks []string `json:"priceBreaks"` // price includes a l excise + // Example: false PriceIncludesALExcise bool `json:"priceIncludesALExcise,omitempty"` // price includes excise + // Example: false PriceIncludesExcise bool `json:"priceIncludesExcise,omitempty"` // price ranges PriceRanges []*PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0 `json:"priceRanges"` // pricing template Id + // Example: string PricingTemplateID string `json:"pricingTemplateId,omitempty"` // product sale type + // Example: Both ProductSaleType string `json:"productSaleType,omitempty"` // product type + // Example: string ProductType string `json:"productType,omitempty"` // qb desktop item ref + // Example: string QbDesktopItemRef string `json:"qbDesktopItemRef,omitempty"` // qb item ref + // Example: string QbItemRef string `json:"qbItemRef,omitempty"` // quantities Quantities []*PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductQuantitiesItems0 `json:"quantities"` // re order level + // Example: 0 ReOrderLevel float64 `json:"reOrderLevel,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // show in widget + // Example: true ShowInWidget bool `json:"showInWidget,omitempty"` // sku + // Example: TB10PRO1 Sku string `json:"sku,omitempty"` // tags + // Example: ["string"] Tags []string `json:"tags"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax tables + // Example: ["string"] TaxTables []string `json:"taxTables"` // tax type + // Example: Inherit TaxType string `json:"taxType,omitempty"` // thc + // Example: 0 Thc float64 `json:"thc,omitempty"` // thca + // Example: 0 Thca float64 `json:"thca,omitempty"` // unit price + // Example: 0 UnitPrice float64 `json:"unitPrice,omitempty"` // unit value + // Example: 1 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vendor + // Example: string Vendor string `json:"vendor,omitempty"` // vendor Id + // Example: 5cacc0c66218d174d3f17b0d VendorID string `json:"vendorId,omitempty"` // weight per unit + // Example: EACH WeightPerUnit string `json:"weightPerUnit,omitempty"` } @@ -1153,7 +1586,6 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr } func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -1178,7 +1610,6 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr } func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) validateCategory(formats strfmt.Registry) error { - if swag.IsZero(m.Category) { // not required return nil } @@ -1196,7 +1627,6 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr } func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) validatePriceRanges(formats strfmt.Registry) error { - if swag.IsZero(m.PriceRanges) { // not required return nil } @@ -1221,7 +1651,6 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr } func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) validateQuantities(formats strfmt.Registry) error { - if swag.IsZero(m.Quantities) { // not required return nil } @@ -1245,6 +1674,100 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr return nil } +// ContextValidate validate this purchase order list response values items0 po product request result list items0 product based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCategory(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePriceRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQuantities(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("product" + "." + "assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) contextValidateCategory(ctx context.Context, formats strfmt.Registry) error { + + if m.Category != nil { + if err := m.Category.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("product" + "." + "category") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) contextValidatePriceRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PriceRanges); i++ { + + if m.PriceRanges[i] != nil { + if err := m.PriceRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("product" + "." + "priceRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) contextValidateQuantities(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Quantities); i++ { + + if m.Quantities[i] != nil { + if err := m.Quantities[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("product" + "." + "quantities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Product) MarshalBinary() ([]byte, error) { if m == nil { @@ -1269,54 +1792,71 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductAssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556052368662 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbf79908a29f808183540e7 ID string `json:"id,omitempty"` // key + // Example: c71adc95-bb07-47f2-b9f6-cc4db7936686.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556052368662 Modified int64 `json:"modified,omitempty"` // name + // Example: Brian Main DL.png Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1325,6 +1865,11 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr return nil } +// ContextValidate validates this purchase order list response values items0 po product request result list items0 product assets items0 based on context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductAssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductAssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1349,51 +1894,66 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategory struct { // active + // Example: true Active bool `json:"active,omitempty"` // cannabis + // Example: true Cannabis bool `json:"cannabis,omitempty"` // cannabis type + // Example: DEFAULT CannabisType string `json:"cannabisType,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554764986388 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cabd4ba6218d148395b405b ID string `json:"id,omitempty"` // low threshold + // Example: string LowThreshold string `json:"lowThreshold,omitempty"` // modified + // Example: 1554764986388 Modified int64 `json:"modified,omitempty"` // name + // Example: Flowers Name string `json:"name,omitempty"` // photo Photo *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategoryPhoto `json:"photo,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // unit type + // Example: grams UnitType string `json:"unitType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1412,7 +1972,6 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr } func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategory) validatePhoto(formats strfmt.Registry) error { - if swag.IsZero(m.Photo) { // not required return nil } @@ -1429,6 +1988,34 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr return nil } +// ContextValidate validate this purchase order list response values items0 po product request result list items0 product category based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePhoto(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategory) contextValidatePhoto(ctx context.Context, formats strfmt.Registry) error { + + if m.Photo != nil { + if err := m.Photo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("product" + "." + "category" + "." + "photo") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategory) MarshalBinary() ([]byte, error) { if m == nil { @@ -1453,60 +2040,79 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategoryPhoto struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554764986388 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cabd4ba6218d148395b404f ID string `json:"id,omitempty"` // key + // Example: 420default-Flower.jpg Key string `json:"key,omitempty"` // large URL + // Example: string LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: string LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: string MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1554764986388 Modified int64 `json:"modified,omitempty"` // name + // Example: Flower.jpg Name string `json:"name,omitempty"` // orig URL + // Example: string OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://s3.amazonaws.com/connect-files-public/420default-Flower.jpg PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: string ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1515,6 +2121,11 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr return nil } +// ContextValidate validates this purchase order list response values items0 po product request result list items0 product category photo based on context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategoryPhoto) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductCategoryPhoto) MarshalBinary() ([]byte, error) { if m == nil { @@ -1539,18 +2150,22 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0 struct { // id + // Example: 5cacc1536218d174d3f17b10_5cabd4ba6218d148395b402e ID string `json:"id,omitempty"` // price + // Example: 10 Price float64 `json:"price,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // weight tolerance WeightTolerance *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0WeightTolerance `json:"weightTolerance,omitempty"` // weight tolerance Id + // Example: 5cabd4ba6218d148395b402e WeightToleranceID string `json:"weightToleranceId,omitempty"` } @@ -1569,7 +2184,6 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr } func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0) validateWeightTolerance(formats strfmt.Registry) error { - if swag.IsZero(m.WeightTolerance) { // not required return nil } @@ -1586,6 +2200,34 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr return nil } +// ContextValidate validate this purchase order list response values items0 po product request result list items0 product price ranges items0 based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateWeightTolerance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0) contextValidateWeightTolerance(ctx context.Context, formats strfmt.Registry) error { + + if m.WeightTolerance != nil { + if err := m.WeightTolerance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("weightTolerance") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1610,45 +2252,59 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0WeightTolerance struct { // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554746451739 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 0.6 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5cabd4ba6218d148395b402e ID string `json:"id,omitempty"` // modified + // Example: 1554746451739 Modified int64 `json:"modified,omitempty"` // name + // Example: .5 Gram Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 0.5 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 0.5 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: HALF_GRAM WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 0.5 WeightValue float64 `json:"weightValue,omitempty"` } @@ -1657,6 +2313,11 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr return nil } +// ContextValidate validates this purchase order list response values items0 po product request result list items0 product price ranges items0 weight tolerance based on context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0WeightTolerance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductPriceRangesItems0WeightTolerance) MarshalBinary() ([]byte, error) { if m == nil { @@ -1681,33 +2342,43 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr type PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductQuantitiesItems0 struct { // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554825661504 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cacc1bd6218d174d3f17b38 ID string `json:"id,omitempty"` // inventory Id + // Example: 5cabd4ba6218d148395b4067 InventoryID string `json:"inventoryId,omitempty"` // modified + // Example: 1554825661504 Modified int64 `json:"modified,omitempty"` // quantity + // Example: 890 Quantity float64 `json:"quantity,omitempty"` // shop Id + // Example: 5cabd4ba6218d148395b4043 ShopID string `json:"shopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1716,6 +2387,11 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr return nil } +// ContextValidate validates this purchase order list response values items0 po product request result list items0 product quantities items0 based on context it is used +func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductQuantitiesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0ProductQuantitiesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1740,60 +2416,79 @@ func (m *PurchaseOrderListResponseValuesItems0PoProductRequestResultListItems0Pr type PurchaseOrderListResponseValuesItems0PoQrCodeAsset struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1554938213885 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cae79656218d13275d36bf6 ID string `json:"id,omitempty"` // key + // Example: 5cae79656218d13275d36bf4-2-N.png Key string `json:"key,omitempty"` // large URL + // Example: string LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: string LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: string MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1554938213885 Modified int64 `json:"modified,omitempty"` // name + // Example: Invoice Name string `json:"name,omitempty"` // orig URL + // Example: string OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://connect-files-public.s3.amazonaws.com/5cae79656218d13275d36bf4-2-N.png PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: string ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1802,6 +2497,11 @@ func (m *PurchaseOrderListResponseValuesItems0PoQrCodeAsset) Validate(formats st return nil } +// ContextValidate validates this purchase order list response values items0 po qr code asset based on context it is used +func (m *PurchaseOrderListResponseValuesItems0PoQrCodeAsset) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0PoQrCodeAsset) MarshalBinary() ([]byte, error) { if m == nil { @@ -1826,63 +2526,82 @@ func (m *PurchaseOrderListResponseValuesItems0PoQrCodeAsset) UnmarshalBinary(b [ type PurchaseOrderListResponseValuesItems0TaxResult struct { // created + // Example: 1554942856352 Created int64 `json:"created,omitempty"` // cultivation tax result CultivationTaxResult *PurchaseOrderListResponseValuesItems0TaxResultCultivationTaxResult `json:"cultivationTaxResult,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cae8b886218d13275d36c5a ID string `json:"id,omitempty"` // modified + // Example: 1554942856352 Modified int64 `json:"modified,omitempty"` // total a l excise tax + // Example: 0 TotalALExciseTax float64 `json:"totalALExciseTax,omitempty"` // total a l post excise tax + // Example: 0 TotalALPostExciseTax float64 `json:"totalALPostExciseTax,omitempty"` // total city pre tax + // Example: 0 TotalCityPreTax float64 `json:"totalCityPreTax,omitempty"` // total city tax + // Example: 0 TotalCityTax float64 `json:"totalCityTax,omitempty"` // total county pre tax + // Example: 0 TotalCountyPreTax float64 `json:"totalCountyPreTax,omitempty"` // total county tax + // Example: 0 TotalCountyTax float64 `json:"totalCountyTax,omitempty"` // total excise tax + // Example: 1536 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // total fed pre tax + // Example: 0 TotalFedPreTax float64 `json:"totalFedPreTax,omitempty"` // total fed tax + // Example: 0 TotalFedTax float64 `json:"totalFedTax,omitempty"` // total n a l pre excise tax + // Example: 0 TotalNALPreExciseTax float64 `json:"totalNALPreExciseTax,omitempty"` // total post calc tax + // Example: 0 TotalPostCalcTax float64 `json:"totalPostCalcTax,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // total state pre tax + // Example: 0 TotalStatePreTax float64 `json:"totalStatePreTax,omitempty"` // total state tax + // Example: 0 TotalStateTax float64 `json:"totalStateTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1901,7 +2620,6 @@ func (m *PurchaseOrderListResponseValuesItems0TaxResult) Validate(formats strfmt } func (m *PurchaseOrderListResponseValuesItems0TaxResult) validateCultivationTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.CultivationTaxResult) { // not required return nil } @@ -1918,6 +2636,34 @@ func (m *PurchaseOrderListResponseValuesItems0TaxResult) validateCultivationTaxR return nil } +// ContextValidate validate this purchase order list response values items0 tax result based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0TaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCultivationTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0TaxResult) contextValidateCultivationTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.CultivationTaxResult != nil { + if err := m.CultivationTaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxResult" + "." + "cultivationTaxResult") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0TaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1942,24 +2688,31 @@ func (m *PurchaseOrderListResponseValuesItems0TaxResult) UnmarshalBinary(b []byt type PurchaseOrderListResponseValuesItems0TaxResultCultivationTaxResult struct { // flower tax oz + // Example: 0 FlowerTaxOz float64 `json:"flowerTaxOz,omitempty"` // leaf tax oz + // Example: 0 LeafTaxOz float64 `json:"leafTaxOz,omitempty"` // total cultivation tax + // Example: 0 TotalCultivationTax float64 `json:"totalCultivationTax,omitempty"` // total flower oz + // Example: 0 TotalFlowerOz float64 `json:"totalFlowerOz,omitempty"` // total flower tax + // Example: 0 TotalFlowerTax float64 `json:"totalFlowerTax,omitempty"` // total leaf oz + // Example: 0 TotalLeafOz float64 `json:"totalLeafOz,omitempty"` // total leaf tax + // Example: 0 TotalLeafTax float64 `json:"totalLeafTax,omitempty"` } @@ -1968,6 +2721,11 @@ func (m *PurchaseOrderListResponseValuesItems0TaxResultCultivationTaxResult) Val return nil } +// ContextValidate validates this purchase order list response values items0 tax result cultivation tax result based on context it is used +func (m *PurchaseOrderListResponseValuesItems0TaxResultCultivationTaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0TaxResultCultivationTaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1992,111 +2750,144 @@ func (m *PurchaseOrderListResponseValuesItems0TaxResultCultivationTaxResult) Unm type PurchaseOrderListResponseValuesItems0Vendor struct { // active + // Example: true Active bool `json:"active,omitempty"` // additional address list + // Example: ["string"] AdditionalAddressList []string `json:"additionalAddressList"` // address Address *PurchaseOrderListResponseValuesItems0VendorAddress `json:"address,omitempty"` // arms length type + // Example: ARMS_LENGTH ArmsLengthType string `json:"armsLengthType,omitempty"` // assets Assets []*PurchaseOrderListResponseValuesItems0VendorAssetsItems0 `json:"assets"` // back order enabled + // Example: false BackOrderEnabled bool `json:"backOrderEnabled,omitempty"` // brands + // Example: ["string"] Brands []string `json:"brands"` // company Id + // Example: 5cabd4ba6218d148395b4043 CompanyID string `json:"companyId,omitempty"` // company licenses CompanyLicenses []string `json:"companyLicenses"` // company type + // Example: string CompanyType string `json:"companyType,omitempty"` // created + // Example: 1554825414778 Created int64 `json:"created,omitempty"` // credits + // Example: 0 Credits float64 `json:"credits,omitempty"` // dba name + // Example: string DbaName string `json:"dbaName,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // description + // Example: string Description string `json:"description,omitempty"` // email + // Example: string Email string `json:"email,omitempty"` // fax + // Example: string Fax string `json:"fax,omitempty"` // first name + // Example: string FirstName string `json:"firstName,omitempty"` // id + // Example: 5cacc0c66218d174d3f17b0d ID string `json:"id,omitempty"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // last name + // Example: string LastName string `json:"lastName,omitempty"` // licence type + // Example: string LicenceType string `json:"licenceType,omitempty"` // license expiration date + // Example: 0 LicenseExpirationDate float64 `json:"licenseExpirationDate,omitempty"` // license number + // Example: string LicenseNumber string `json:"licenseNumber,omitempty"` // mobile number + // Example: string MobileNumber string `json:"mobileNumber,omitempty"` // modified + // Example: 1554825414778 Modified int64 `json:"modified,omitempty"` // name + // Example: Binsky Name string `json:"name,omitempty"` // notes + // Example: ["string"] Notes []string `json:"notes"` // phone + // Example: string Phone string `json:"phone,omitempty"` // qb desktop ref + // Example: string QbDesktopRef string `json:"qbDesktopRef,omitempty"` // qb vendor ref + // Example: ["string"] QbVendorRef []string `json:"qbVendorRef"` // related entity + // Example: false RelatedEntity bool `json:"relatedEntity,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vendor key + // Example: NWNhYmQ0YmE2MjE4ZDE0ODM5NWI0MDJjX2JpbnNreQ== VendorKey string `json:"vendorKey,omitempty"` // vendor type + // Example: VENDOR VendorType string `json:"vendorType,omitempty"` // website + // Example: string Website string `json:"website,omitempty"` } @@ -2119,7 +2910,6 @@ func (m *PurchaseOrderListResponseValuesItems0Vendor) Validate(formats strfmt.Re } func (m *PurchaseOrderListResponseValuesItems0Vendor) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -2137,7 +2927,6 @@ func (m *PurchaseOrderListResponseValuesItems0Vendor) validateAddress(formats st } func (m *PurchaseOrderListResponseValuesItems0Vendor) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -2161,6 +2950,56 @@ func (m *PurchaseOrderListResponseValuesItems0Vendor) validateAssets(formats str return nil } +// ContextValidate validate this purchase order list response values items0 vendor based on the context it is used +func (m *PurchaseOrderListResponseValuesItems0Vendor) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0Vendor) 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("vendor" + "." + "address") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrderListResponseValuesItems0Vendor) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vendor" + "." + "assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0Vendor) MarshalBinary() ([]byte, error) { if m == nil { @@ -2185,36 +3024,47 @@ func (m *PurchaseOrderListResponseValuesItems0Vendor) UnmarshalBinary(b []byte) type PurchaseOrderListResponseValuesItems0VendorAddress struct { // address + // Example: string Address string `json:"address,omitempty"` // city + // Example: string City string `json:"city,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1554825414778 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cacc0c66218d174d3f17b0c ID string `json:"id,omitempty"` // modified + // Example: 1554825414778 Modified int64 `json:"modified,omitempty"` // state + // Example: string State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code + // Example: string ZipCode string `json:"zipCode,omitempty"` } @@ -2223,6 +3073,11 @@ func (m *PurchaseOrderListResponseValuesItems0VendorAddress) Validate(formats st return nil } +// ContextValidate validates this purchase order list response values items0 vendor address based on context it is used +func (m *PurchaseOrderListResponseValuesItems0VendorAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0VendorAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -2247,54 +3102,71 @@ func (m *PurchaseOrderListResponseValuesItems0VendorAddress) UnmarshalBinary(b [ type PurchaseOrderListResponseValuesItems0VendorAssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556052368662 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbf79908a29f808183540e7 ID string `json:"id,omitempty"` // key + // Example: c71adc95-bb07-47f2-b9f6-cc4db7936686.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556052368662 Modified int64 `json:"modified,omitempty"` // name + // Example: Brian Main DL.png Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2303,6 +3175,11 @@ func (m *PurchaseOrderListResponseValuesItems0VendorAssetsItems0) Validate(forma return nil } +// ContextValidate validates this purchase order list response values items0 vendor assets items0 based on context it is used +func (m *PurchaseOrderListResponseValuesItems0VendorAssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderListResponseValuesItems0VendorAssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/shop_response.go b/api/blaze/blaze_models/shop_response.go index 995b1a6..c827f83 100644 --- a/api/blaze/blaze_models/shop_response.go +++ b/api/blaze/blaze_models/shop_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,6 +24,7 @@ import ( type ShopResponse struct { // company logo URL + // Example: https://connect-files-public.s3.amazonaws.com/1d405589-9408-4f00-8b00-b30bfbc636d1.png CompanyLogoURL string `json:"companyLogoURL,omitempty"` // shop @@ -51,7 +53,6 @@ func (m *ShopResponse) Validate(formats strfmt.Registry) error { } func (m *ShopResponse) validateShop(formats strfmt.Registry) error { - if swag.IsZero(m.Shop) { // not required return nil } @@ -69,7 +70,6 @@ func (m *ShopResponse) validateShop(formats strfmt.Registry) error { } func (m *ShopResponse) validateToleranceMap(formats strfmt.Registry) error { - if swag.IsZero(m.ToleranceMap) { // not required return nil } @@ -86,6 +86,52 @@ func (m *ShopResponse) validateToleranceMap(formats strfmt.Registry) error { return nil } +// ContextValidate validate this shop response based on the context it is used +func (m *ShopResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateShop(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateToleranceMap(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ShopResponse) contextValidateShop(ctx context.Context, formats strfmt.Registry) error { + + if m.Shop != nil { + if err := m.Shop.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop") + } + return err + } + } + + return nil +} + +func (m *ShopResponse) contextValidateToleranceMap(ctx context.Context, formats strfmt.Registry) error { + + if m.ToleranceMap != nil { + if err := m.ToleranceMap.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ShopResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -110,291 +156,379 @@ func (m *ShopResponse) UnmarshalBinary(b []byte) error { type ShopResponseShop struct { // active + // Example: true Active bool `json:"active,omitempty"` // address Address *ShopResponseShopAddress `json:"address,omitempty"` // age limit + // Example: 21 AgeLimit float64 `json:"ageLimit,omitempty"` // al excise on zero price + // Example: true AlExciseOnZeroPrice bool `json:"alExciseOnZeroPrice,omitempty"` // allow anonymous orders + // Example: false AllowAnonymousOrders bool `json:"allowAnonymousOrders,omitempty"` // app target + // Example: Retail AppTarget string `json:"appTarget,omitempty"` // assets Assets []*ShopResponseShopAssetsItems0 `json:"assets"` // auto cash drawer + // Example: false AutoCashDrawer bool `json:"autoCashDrawer,omitempty"` // bcc email address + // Example: info@pineappleexpress.com BccEmailAddress string `json:"bccEmailAddress,omitempty"` // cart minimums CartMinimums *ShopResponseShopCartMinimums `json:"cartMinimums,omitempty"` // checkout type + // Example: Direct CheckoutType string `json:"checkoutType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1553982501824 Created int64 `json:"created,omitempty"` // credit fefund type + // Example: NONE CreditFefundType string `json:"creditFefundType,omitempty"` // default country + // Example: US DefaultCountry string `json:"defaultCountry,omitempty"` // default pin timeout + // Example: 5 DefaultPinTimeout float64 `json:"defaultPinTimeout,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // delivery fee + // Example: 0 DeliveryFee float64 `json:"deliveryFee,omitempty"` // delivery refund type + // Example: NONE DeliveryRefundType string `json:"deliveryRefundType,omitempty"` // email adress + // Example: support@pineappleexpress.com EmailAdress string `json:"emailAdress,omitempty"` // email message + // Example: string EmailMessage string `json:"emailMessage,omitempty"` // enable age limit + // Example: true EnableAgeLimit bool `json:"enableAgeLimit,omitempty"` // enable b c c receipt + // Example: true EnableBCCReceipt bool `json:"enableBCCReceipt,omitempty"` // enable cannabis limit + // Example: true EnableCannabisLimit bool `json:"enableCannabisLimit,omitempty"` // enable cash in out + // Example: false EnableCashInOut bool `json:"enableCashInOut,omitempty"` // enable daily summary email + // Example: false EnableDailySummaryEmail bool `json:"enableDailySummaryEmail,omitempty"` // enable delivery fee + // Example: false EnableDeliveryFee bool `json:"enableDeliveryFee,omitempty"` // enable delivery signature + // Example: true EnableDeliverySignature bool `json:"enableDeliverySignature,omitempty"` // enable excise tax + // Example: true EnableExciseTax bool `json:"enableExciseTax,omitempty"` // enable g p s tracking + // Example: true EnableGPSTracking bool `json:"enableGPSTracking,omitempty"` // enable harvest tax + // Example: false EnableHarvestTax bool `json:"enableHarvestTax,omitempty"` // enable low inventory email + // Example: true EnableLowInventoryEmail bool `json:"enableLowInventoryEmail,omitempty"` // enable medicinal age + // Example: true EnableMedicinalAge bool `json:"enableMedicinalAge,omitempty"` // enable on fleet + // Example: true EnableOnFleet bool `json:"enableOnFleet,omitempty"` // enable pin for cash drawer + // Example: false EnablePinForCashDrawer bool `json:"enablePinForCashDrawer,omitempty"` // enable sale logout + // Example: false EnableSaleLogout bool `json:"enableSaleLogout,omitempty"` // enable spring big + // Example: false EnableSpringBig bool `json:"enableSpringBig,omitempty"` // enable tookan + // Example: false EnableTookan bool `json:"enableTookan,omitempty"` // enable woo commerce + // Example: false EnableWooCommerce bool `json:"enableWooCommerce,omitempty"` // enforce cash drawers + // Example: true EnforceCashDrawers bool `json:"enforceCashDrawers,omitempty"` // excise tax type + // Example: TOTAL_AMOUNT ExciseTaxType string `json:"exciseTaxType,omitempty"` // hub Id + // Example: JPowoWy*p6zFD5D*y9t77DNJ HubID string `json:"hubId,omitempty"` // hub name + // Example: Palm Springs HubName string `json:"hubName,omitempty"` // id + // Example: 5c9fe425e0faca07db94b970 ID string `json:"id,omitempty"` // invoice note + // Example: string InvoiceNote string `json:"invoiceNote,omitempty"` // invoice term condition + // Example: string InvoiceTermCondition string `json:"invoiceTermCondition,omitempty"` // latitude + // Example: 0 Latitude float64 `json:"latitude,omitempty"` // legal language + // Example: WARNING: This product can expose you to marijuana smoke and myrcene, which are known to the State of California to cause cancer. For more information, go to www.P65Warnings.ca.gov. LegalLanguage string `json:"legalLanguage,omitempty"` // license + // Example: C9-18-0000102-TEMP License string `json:"license,omitempty"` // logo Logo *ShopResponseShopLogo `json:"logo,omitempty"` // longitude + // Example: 0 Longitude float64 `json:"longitude,omitempty"` // marketing sources + // Example: ["On Deck","Weed Maps","Google","Personal Referral","Billboard","Social Media","Print Media","Other"] MarketingSources []string `json:"marketingSources"` // medicinal age + // Example: 18 MedicinalAge float64 `json:"medicinalAge,omitempty"` // members count sync date + // Example: 1558372668851 MembersCountSyncDate float64 `json:"membersCountSyncDate,omitempty"` // members tag + // Example: ["Disabled"] MembersTag []string `json:"membersTag"` // modified + // Example: 1558372668851 Modified int64 `json:"modified,omitempty"` // nal excise from retail cost + // Example: false NalExciseFromRetailCost bool `json:"nalExciseFromRetailCost,omitempty"` // name + // Example: Pineapple Express Palm Springs Name string `json:"name,omitempty"` // next snapshot time + // Example: 1558422300000 NextSnapshotTime int64 `json:"nextSnapshotTime,omitempty"` // num allow active trans + // Example: 1 NumAllowActiveTrans float64 `json:"numAllowActiveTrans,omitempty"` // on fleet Api key + // Example: d3ba42b1b557f703910d53d1a45be8ed OnFleetAPIKey string `json:"onFleetApiKey,omitempty"` // on fleet organization Id + // Example: ziXWVNJiLeB2IeMUN5kSdIkX OnFleetOrganizationID string `json:"onFleetOrganizationId,omitempty"` // on fleet organization name + // Example: Pineapple Express OnFleetOrganizationName string `json:"onFleetOrganizationName,omitempty"` // online store info OnlineStoreInfo *ShopResponseShopOnlineStoreInfo `json:"onlineStoreInfo,omitempty"` // order tags + // Example: ["Appointment","Early Bird","Late Gift"] OrderTags []string `json:"orderTags"` // phone number + // Example: (877) 933-3548 PhoneNumber string `json:"phoneNumber,omitempty"` // po note + // Example: string PoNote string `json:"poNote,omitempty"` // po term condition + // Example: string PoTermCondition string `json:"poTermCondition,omitempty"` // product price include excise tax + // Example: false ProductPriceIncludeExciseTax bool `json:"productPriceIncludeExciseTax,omitempty"` // products tag + // Example: ["Flower","Concentrate","Edibles","Vegan","vegan","Preroll","Vape Pens","Topical","Wraps"] ProductsTag []string `json:"productsTag"` // receipt info ReceiptInfo []*ShopResponseShopReceiptInfoItems0 `json:"receiptInfo"` // receiving inventory Id + // Example: 5c9fe425e0faca07db94b990 ReceivingInventoryID string `json:"receivingInventoryId,omitempty"` // require valid rec date + // Example: true RequireValidRecDate bool `json:"requireValidRecDate,omitempty"` // restrict incoming order notifications + // Example: true RestrictIncomingOrderNotifications bool `json:"restrictIncomingOrderNotifications,omitempty"` // restricted notification terminals + // Example: ["5c82b36db4ab160827412e62","5c82b3944442190831bca731","5cb7d5f54cd84907f647b6cd"] RestrictedNotificationTerminals []string `json:"restrictedNotificationTerminals"` // restricted views + // Example: true RestrictedViews bool `json:"restrictedViews,omitempty"` // round off type + // Example: NONE RoundOffType string `json:"roundOffType,omitempty"` // round up message + // Example: string RoundUpMessage string `json:"roundUpMessage,omitempty"` // shop type + // Example: Both ShopType string `json:"shopType,omitempty"` // short identifier + // Example: string ShortIdentifier string `json:"shortIdentifier,omitempty"` // show delivery queue + // Example: true ShowDeliveryQueue bool `json:"showDeliveryQueue,omitempty"` // show online queue + // Example: false ShowOnlineQueue bool `json:"showOnlineQueue,omitempty"` // show product by available quantity + // Example: true ShowProductByAvailableQuantity bool `json:"showProductByAvailableQuantity,omitempty"` // show special queue + // Example: false ShowSpecialQueue bool `json:"showSpecialQueue,omitempty"` // show walk in queue + // Example: false ShowWalkInQueue bool `json:"showWalkInQueue,omitempty"` // snapshop time + // Example: 1558336185744 SnapshopTime int64 `json:"snapshopTime,omitempty"` // tax info TaxInfo *ShopResponseShopTaxInfo `json:"taxInfo,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax round off type + // Example: ONE_CENT TaxRoundOffType string `json:"taxRoundOffType,omitempty"` // tax tables TaxTables []*ShopResponseShopTaxTablesItems0 `json:"taxTables"` // time zone + // Example: America/Los_Angeles TimeZone string `json:"timeZone,omitempty"` // timezone offset in minutes + // Example: -420 TimezoneOffsetInMinutes float64 `json:"timezoneOffsetInMinutes,omitempty"` // twilio number + // Example: string TwilioNumber string `json:"twilioNumber,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // use assigned employee + // Example: false UseAssignedEmployee bool `json:"useAssignedEmployee,omitempty"` // use complex tax + // Example: true UseComplexTax bool `json:"useComplexTax,omitempty"` } @@ -441,7 +575,6 @@ func (m *ShopResponseShop) Validate(formats strfmt.Registry) error { } func (m *ShopResponseShop) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -459,7 +592,6 @@ func (m *ShopResponseShop) validateAddress(formats strfmt.Registry) error { } func (m *ShopResponseShop) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -484,7 +616,6 @@ func (m *ShopResponseShop) validateAssets(formats strfmt.Registry) error { } func (m *ShopResponseShop) validateCartMinimums(formats strfmt.Registry) error { - if swag.IsZero(m.CartMinimums) { // not required return nil } @@ -502,7 +633,6 @@ func (m *ShopResponseShop) validateCartMinimums(formats strfmt.Registry) error { } func (m *ShopResponseShop) validateLogo(formats strfmt.Registry) error { - if swag.IsZero(m.Logo) { // not required return nil } @@ -520,7 +650,6 @@ func (m *ShopResponseShop) validateLogo(formats strfmt.Registry) error { } func (m *ShopResponseShop) validateOnlineStoreInfo(formats strfmt.Registry) error { - if swag.IsZero(m.OnlineStoreInfo) { // not required return nil } @@ -538,7 +667,6 @@ func (m *ShopResponseShop) validateOnlineStoreInfo(formats strfmt.Registry) erro } func (m *ShopResponseShop) validateReceiptInfo(formats strfmt.Registry) error { - if swag.IsZero(m.ReceiptInfo) { // not required return nil } @@ -563,7 +691,6 @@ func (m *ShopResponseShop) validateReceiptInfo(formats strfmt.Registry) error { } func (m *ShopResponseShop) validateTaxInfo(formats strfmt.Registry) error { - if swag.IsZero(m.TaxInfo) { // not required return nil } @@ -581,7 +708,6 @@ func (m *ShopResponseShop) validateTaxInfo(formats strfmt.Registry) error { } func (m *ShopResponseShop) validateTaxTables(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTables) { // not required return nil } @@ -605,6 +731,172 @@ func (m *ShopResponseShop) validateTaxTables(formats strfmt.Registry) error { return nil } +// ContextValidate validate this shop response shop based on the context it is used +func (m *ShopResponseShop) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCartMinimums(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLogo(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOnlineStoreInfo(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReceiptInfo(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxInfo(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTables(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ShopResponseShop) 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("shop" + "." + "address") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShop) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ShopResponseShop) contextValidateCartMinimums(ctx context.Context, formats strfmt.Registry) error { + + if m.CartMinimums != nil { + if err := m.CartMinimums.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "cartMinimums") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShop) contextValidateLogo(ctx context.Context, formats strfmt.Registry) error { + + if m.Logo != nil { + if err := m.Logo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "logo") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShop) contextValidateOnlineStoreInfo(ctx context.Context, formats strfmt.Registry) error { + + if m.OnlineStoreInfo != nil { + if err := m.OnlineStoreInfo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "onlineStoreInfo") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShop) contextValidateReceiptInfo(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ReceiptInfo); i++ { + + if m.ReceiptInfo[i] != nil { + if err := m.ReceiptInfo[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "receiptInfo" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ShopResponseShop) contextValidateTaxInfo(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxInfo != nil { + if err := m.TaxInfo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "taxInfo") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShop) contextValidateTaxTables(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTables); i++ { + + if m.TaxTables[i] != nil { + if err := m.TaxTables[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "taxTables" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShop) MarshalBinary() ([]byte, error) { if m == nil { @@ -629,39 +921,50 @@ func (m *ShopResponseShop) UnmarshalBinary(b []byte) error { type ShopResponseShopAddress struct { // address + // Example: 695 Williams Rd Address string `json:"address,omitempty"` // address line1 AddressLine1 string `json:"addressLine1,omitempty"` // city + // Example: Palm Springs City string `json:"city,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1553982501824 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5c9fe425e0faca07db94b971 ID string `json:"id,omitempty"` // modified + // Example: 1553982501824 Modified int64 `json:"modified,omitempty"` // state + // Example: CA State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code + // Example: 92264 ZipCode string `json:"zipCode,omitempty"` } @@ -670,6 +973,11 @@ func (m *ShopResponseShopAddress) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this shop response shop address based on context it is used +func (m *ShopResponseShopAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -694,60 +1002,79 @@ func (m *ShopResponseShopAddress) UnmarshalBinary(b []byte) error { type ShopResponseShopAssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Document AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1558145178150 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cdf689a59ded8080e03c06a ID string `json:"id,omitempty"` // key + // Example: f5777926-e5cd-48c3-a026-a527bfaa930f.pdf Key string `json:"key,omitempty"` // large URL + // Example: string LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: string LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: string MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1558145178150 Modified int64 `json:"modified,omitempty"` // name + // Example: CGI Sellers Permit 247130880 - 00001.pdf Name string `json:"name,omitempty"` // orig URL + // Example: string OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: string PublicURL string `json:"publicURL,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: string ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Document Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -756,6 +1083,11 @@ func (m *ShopResponseShopAssetsItems0) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this shop response shop assets items0 based on context it is used +func (m *ShopResponseShopAssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopAssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -783,24 +1115,31 @@ type ShopResponseShopCartMinimums struct { CartMinimumDetails []*ShopResponseShopCartMinimumsCartMinimumDetailsItems0 `json:"cartMinimumDetails"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1553984069346 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5c9fea45b8bccf07fc47d5cc ID string `json:"id,omitempty"` // minimums type + // Example: SIMPLE MinimumsType string `json:"minimumsType,omitempty"` // modified + // Example: 1553984069346 Modified int64 `json:"modified,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -819,7 +1158,6 @@ func (m *ShopResponseShopCartMinimums) Validate(formats strfmt.Registry) error { } func (m *ShopResponseShopCartMinimums) validateCartMinimumDetails(formats strfmt.Registry) error { - if swag.IsZero(m.CartMinimumDetails) { // not required return nil } @@ -843,6 +1181,38 @@ func (m *ShopResponseShopCartMinimums) validateCartMinimumDetails(formats strfmt return nil } +// ContextValidate validate this shop response shop cart minimums based on the context it is used +func (m *ShopResponseShopCartMinimums) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCartMinimumDetails(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ShopResponseShopCartMinimums) contextValidateCartMinimumDetails(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CartMinimumDetails); i++ { + + if m.CartMinimumDetails[i] != nil { + if err := m.CartMinimumDetails[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shop" + "." + "cartMinimums" + "." + "cartMinimumDetails" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopCartMinimums) MarshalBinary() ([]byte, error) { if m == nil { @@ -867,9 +1237,11 @@ func (m *ShopResponseShopCartMinimums) UnmarshalBinary(b []byte) error { type ShopResponseShopCartMinimumsCartMinimumDetailsItems0 struct { // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // minimum + // Example: 40 Minimum float64 `json:"minimum,omitempty"` } @@ -878,6 +1250,11 @@ func (m *ShopResponseShopCartMinimumsCartMinimumDetailsItems0) Validate(formats return nil } +// ContextValidate validates this shop response shop cart minimums cart minimum details items0 based on context it is used +func (m *ShopResponseShopCartMinimumsCartMinimumDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopCartMinimumsCartMinimumDetailsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -902,60 +1279,79 @@ func (m *ShopResponseShopCartMinimumsCartMinimumDetailsItems0) UnmarshalBinary(b type ShopResponseShopLogo struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1555870891770 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbcb4ab85c8ac07ed72aac0 ID string `json:"id,omitempty"` // key + // Example: 5d145b98-e563-40ec-bf50-189fa275888d.jpg Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-public.s3.amazonaws.com/5d145b98-e563-40ec-bf50-189fa275888d-800x800.jpg LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/5d145b98-e563-40ec-bf50-189fa275888d-1600x1600.jpg LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-public.s3.amazonaws.com/5d145b98-e563-40ec-bf50-189fa275888d-500x500.jpg MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1555870891770 Modified int64 `json:"modified,omitempty"` // name + // Example: PE New.jpg Name string `json:"name,omitempty"` // orig URL + // Example: https://connect-files-public.s3.amazonaws.com/5d145b98-e563-40ec-bf50-189fa275888d.jpg OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://connect-files-public.s3.amazonaws.com/5d145b98-e563-40ec-bf50-189fa275888d.jpg PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-public.s3.amazonaws.com/5d145b98-e563-40ec-bf50-189fa275888d-200x200.jpg ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -964,6 +1360,11 @@ func (m *ShopResponseShopLogo) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this shop response shop logo based on context it is used +func (m *ShopResponseShopLogo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopLogo) MarshalBinary() ([]byte, error) { if m == nil { @@ -988,111 +1389,146 @@ func (m *ShopResponseShopLogo) UnmarshalBinary(b []byte) error { type ShopResponseShopOnlineStoreInfo struct { // active inventory Id + // Example: string ActiveInventoryID string `json:"activeInventoryId,omitempty"` // cart min type + // Example: SubtotalWithDiscount CartMinType string `json:"cartMinType,omitempty"` // cart minimum + // Example: 0 CartMinimum float64 `json:"cartMinimum,omitempty"` // color theme + // Example: Light ColorTheme string `json:"colorTheme,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1553984069346 Created int64 `json:"created,omitempty"` // custom message e t a + // Example: string CustomMessageETA string `json:"customMessageETA,omitempty"` // default e t a + // Example: 90 DefaultETA float64 `json:"defaultETA,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // enable delivery + // Example: true EnableDelivery bool `json:"enableDelivery,omitempty"` // enable delivery area restrictions + // Example: true EnableDeliveryAreaRestrictions bool `json:"enableDeliveryAreaRestrictions,omitempty"` // enable Html text + // Example: false EnableHTMLText bool `json:"enableHtmlText,omitempty"` // enable inventory + // Example: false EnableInventory bool `json:"enableInventory,omitempty"` // enable inventory type + // Example: Custom EnableInventoryType string `json:"enableInventoryType,omitempty"` // enable online p o s + // Example: true EnableOnlinePOS bool `json:"enableOnlinePOS,omitempty"` // enable online shipment + // Example: false EnableOnlineShipment bool `json:"enableOnlineShipment,omitempty"` // enable other marketing source + // Example: false EnableOtherMarketingSource bool `json:"enableOtherMarketingSource,omitempty"` // enable product reviews + // Example: true EnableProductReviews bool `json:"enableProductReviews,omitempty"` // enable store pickup + // Example: false EnableStorePickup bool `json:"enableStorePickup,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // html text + // Example: string HTMLText string `json:"htmlText,omitempty"` // id + // Example: 5c9fea45b8bccf07fc47d5cd ID string `json:"id,omitempty"` // modified + // Example: 1553984069346 Modified int64 `json:"modified,omitempty"` // page one message body + // Example: string PageOneMessageBody string `json:"pageOneMessageBody,omitempty"` // page one message title + // Example: string PageOneMessageTitle string `json:"pageOneMessageTitle,omitempty"` // restricted zip codes + // Example: ["90895","91001","91006","91007","93063"] RestrictedZipCodes []string `json:"restrictedZipCodes"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // store hex color + // Example: string StoreHexColor string `json:"storeHexColor,omitempty"` // submission message + // Example: string SubmissionMessage string `json:"submissionMessage,omitempty"` // support email + // Example: support@pineappleexpress.com SupportEmail string `json:"supportEmail,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // use custom e t a + // Example: false UseCustomETA bool `json:"useCustomETA,omitempty"` // view type + // Example: List ViewType string `json:"viewType,omitempty"` // website origins WebsiteOrigins string `json:"websiteOrigins,omitempty"` // website Url + // Example: https://pineappleexpress.com WebsiteURL string `json:"websiteUrl,omitempty"` } @@ -1101,6 +1537,11 @@ func (m *ShopResponseShopOnlineStoreInfo) Validate(formats strfmt.Registry) erro return nil } +// ContextValidate validates this shop response shop online store info based on context it is used +func (m *ShopResponseShopOnlineStoreInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopOnlineStoreInfo) MarshalBinary() ([]byte, error) { if m == nil { @@ -1125,75 +1566,99 @@ func (m *ShopResponseShopOnlineStoreInfo) UnmarshalBinary(b []byte) error { type ShopResponseShopReceiptInfoItems0 struct { // above free text + // Example: TOP OF RECEIPT TEXT GOES HERE. AboveFreeText string `json:"aboveFreeText,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // created + // Example: 1557103750658 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // enable brand + // Example: false EnableBrand bool `json:"enableBrand,omitempty"` // enable employee name + // Example: true EnableEmployeeName bool `json:"enableEmployeeName,omitempty"` // enable excise tax as item + // Example: true EnableExciseTaxAsItem bool `json:"enableExciseTaxAsItem,omitempty"` // enable include item in s k u + // Example: false EnableIncludeItemInSKU bool `json:"enableIncludeItemInSKU,omitempty"` // enable member address + // Example: false EnableMemberAddress bool `json:"enableMemberAddress,omitempty"` // enable member Id + // Example: false EnableMemberID bool `json:"enableMemberId,omitempty"` // enable member loyalty points + // Example: true EnableMemberLoyaltyPoints bool `json:"enableMemberLoyaltyPoints,omitempty"` // enable member name + // Example: true EnableMemberName bool `json:"enableMemberName,omitempty"` // enable notes + // Example: false EnableNotes bool `json:"enableNotes,omitempty"` // enable shop address + // Example: false EnableShopAddress bool `json:"enableShopAddress,omitempty"` // enable shop phone no + // Example: true EnableShopPhoneNo bool `json:"enableShopPhoneNo,omitempty"` // enabled bottom free text + // Example: false EnabledBottomFreeText bool `json:"enabledBottomFreeText,omitempty"` // enabled free text + // Example: false EnabledFreeText bool `json:"enabledFreeText,omitempty"` // free text + // Example: BOTTOM OF RECEIPT TEXT GOES HERE. FreeText string `json:"freeText,omitempty"` // id + // Example: string ID string `json:"id,omitempty"` // modified + // Example: 1557103750658 Modified int64 `json:"modified,omitempty"` // receipt type + // Example: SALES ReceiptType string `json:"receiptType,omitempty"` // shop Id + // Example: string ShopID string `json:"shopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1202,6 +1667,11 @@ func (m *ShopResponseShopReceiptInfoItems0) Validate(formats strfmt.Registry) er return nil } +// ContextValidate validates this shop response shop receipt info items0 based on context it is used +func (m *ShopResponseShopReceiptInfoItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopReceiptInfoItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1226,27 +1696,35 @@ func (m *ShopResponseShopReceiptInfoItems0) UnmarshalBinary(b []byte) error { type ShopResponseShopTaxInfo struct { // city tax + // Example: 0 CityTax float64 `json:"cityTax,omitempty"` // created + // Example: 1553984069346 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // federal tax + // Example: 0 FederalTax float64 `json:"federalTax,omitempty"` // id + // Example: 5c9fea45b8bccf07fc47d5ce ID string `json:"id,omitempty"` // modified + // Example: 1553984069346 Modified int64 `json:"modified,omitempty"` // state tax + // Example: 0.08 StateTax float64 `json:"stateTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1255,6 +1733,11 @@ func (m *ShopResponseShopTaxInfo) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this shop response shop tax info based on context it is used +func (m *ShopResponseShopTaxInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopTaxInfo) MarshalBinary() ([]byte, error) { if m == nil { @@ -1279,54 +1762,67 @@ func (m *ShopResponseShopTaxInfo) UnmarshalBinary(b []byte) error { type ShopResponseShopTaxTablesItems0 struct { // active + // Example: false Active bool `json:"active,omitempty"` // city tax CityTax *ShopResponseShopTaxTablesItems0CityTax `json:"cityTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: AdultUse ConsumerType string `json:"consumerType,omitempty"` // county tax CountyTax *ShopResponseShopTaxTablesItems0CountyTax `json:"countyTax,omitempty"` // created + // Example: 1553984069346 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // federal tax FederalTax *ShopResponseShopTaxTablesItems0FederalTax `json:"federalTax,omitempty"` // id + // Example: 5c9fea45b8bccf07fc47d5c9 ID string `json:"id,omitempty"` // modified + // Example: 1553984069346 Modified int64 `json:"modified,omitempty"` // name + // Example: Adult Use Name string `json:"name,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // state tax StateTax *ShopResponseShopTaxTablesItems0StateTax `json:"stateTax,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax type + // Example: Inherit TaxType string `json:"taxType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1357,7 +1853,6 @@ func (m *ShopResponseShopTaxTablesItems0) Validate(formats strfmt.Registry) erro } func (m *ShopResponseShopTaxTablesItems0) validateCityTax(formats strfmt.Registry) error { - if swag.IsZero(m.CityTax) { // not required return nil } @@ -1375,7 +1870,6 @@ func (m *ShopResponseShopTaxTablesItems0) validateCityTax(formats strfmt.Registr } func (m *ShopResponseShopTaxTablesItems0) validateCountyTax(formats strfmt.Registry) error { - if swag.IsZero(m.CountyTax) { // not required return nil } @@ -1393,7 +1887,6 @@ func (m *ShopResponseShopTaxTablesItems0) validateCountyTax(formats strfmt.Regis } func (m *ShopResponseShopTaxTablesItems0) validateFederalTax(formats strfmt.Registry) error { - if swag.IsZero(m.FederalTax) { // not required return nil } @@ -1411,7 +1904,6 @@ func (m *ShopResponseShopTaxTablesItems0) validateFederalTax(formats strfmt.Regi } func (m *ShopResponseShopTaxTablesItems0) validateStateTax(formats strfmt.Registry) error { - if swag.IsZero(m.StateTax) { // not required return nil } @@ -1428,6 +1920,88 @@ func (m *ShopResponseShopTaxTablesItems0) validateStateTax(formats strfmt.Regist return nil } +// ContextValidate validate this shop response shop tax tables items0 based on the context it is used +func (m *ShopResponseShopTaxTablesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCityTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountyTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFederalTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStateTax(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ShopResponseShopTaxTablesItems0) contextValidateCityTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CityTax != nil { + if err := m.CityTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cityTax") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShopTaxTablesItems0) contextValidateCountyTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CountyTax != nil { + if err := m.CountyTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("countyTax") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShopTaxTablesItems0) contextValidateFederalTax(ctx context.Context, formats strfmt.Registry) error { + + if m.FederalTax != nil { + if err := m.FederalTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("federalTax") + } + return err + } + } + + return nil +} + +func (m *ShopResponseShopTaxTablesItems0) contextValidateStateTax(ctx context.Context, formats strfmt.Registry) error { + + if m.StateTax != nil { + if err := m.StateTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stateTax") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopTaxTablesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1452,45 +2026,59 @@ func (m *ShopResponseShopTaxTablesItems0) UnmarshalBinary(b []byte) error { type ShopResponseShopTaxTablesItems0CityTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1555534297286 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb791d92f7a85083f3638ad ID string `json:"id,omitempty"` // modified + // Example: 1555534297286 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: string ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: City Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1499,6 +2087,11 @@ func (m *ShopResponseShopTaxTablesItems0CityTax) Validate(formats strfmt.Registr return nil } +// ContextValidate validates this shop response shop tax tables items0 city tax based on context it is used +func (m *ShopResponseShopTaxTablesItems0CityTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopTaxTablesItems0CityTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1523,45 +2116,59 @@ func (m *ShopResponseShopTaxTablesItems0CityTax) UnmarshalBinary(b []byte) error type ShopResponseShopTaxTablesItems0CountyTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1555534297286 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb791d92f7a85083f3638ae ID string `json:"id,omitempty"` // modified + // Example: 1555534297286 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: string ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0.25 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: County Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1570,6 +2177,11 @@ func (m *ShopResponseShopTaxTablesItems0CountyTax) Validate(formats strfmt.Regis return nil } +// ContextValidate validates this shop response shop tax tables items0 county tax based on context it is used +func (m *ShopResponseShopTaxTablesItems0CountyTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopTaxTablesItems0CountyTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1594,45 +2206,59 @@ func (m *ShopResponseShopTaxTablesItems0CountyTax) UnmarshalBinary(b []byte) err type ShopResponseShopTaxTablesItems0FederalTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1555534297286 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb791d92f7a85083f3638b0 ID string `json:"id,omitempty"` // modified + // Example: 1555534297286 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: string ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: Federal Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1641,6 +2267,11 @@ func (m *ShopResponseShopTaxTablesItems0FederalTax) Validate(formats strfmt.Regi return nil } +// ContextValidate validates this shop response shop tax tables items0 federal tax based on context it is used +func (m *ShopResponseShopTaxTablesItems0FederalTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopTaxTablesItems0FederalTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1665,45 +2296,59 @@ func (m *ShopResponseShopTaxTablesItems0FederalTax) UnmarshalBinary(b []byte) er type ShopResponseShopTaxTablesItems0StateTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1555534297286 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cb791d92f7a85083f3638af ID string `json:"id,omitempty"` // modified + // Example: 1555534297286 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: string ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 9.25 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: State Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1712,6 +2357,11 @@ func (m *ShopResponseShopTaxTablesItems0StateTax) Validate(formats strfmt.Regist return nil } +// ContextValidate validates this shop response shop tax tables items0 state tax based on context it is used +func (m *ShopResponseShopTaxTablesItems0StateTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseShopTaxTablesItems0StateTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1803,7 +2453,6 @@ func (m *ShopResponseToleranceMap) Validate(formats strfmt.Registry) error { } func (m *ShopResponseToleranceMap) validateGRAM(formats strfmt.Registry) error { - if swag.IsZero(m.GRAM) { // not required return nil } @@ -1821,7 +2470,6 @@ func (m *ShopResponseToleranceMap) validateGRAM(formats strfmt.Registry) error { } func (m *ShopResponseToleranceMap) validateHALF(formats strfmt.Registry) error { - if swag.IsZero(m.HALF) { // not required return nil } @@ -1839,7 +2487,6 @@ func (m *ShopResponseToleranceMap) validateHALF(formats strfmt.Registry) error { } func (m *ShopResponseToleranceMap) validateHALFGRAM(formats strfmt.Registry) error { - if swag.IsZero(m.HALFGRAM) { // not required return nil } @@ -1857,7 +2504,6 @@ func (m *ShopResponseToleranceMap) validateHALFGRAM(formats strfmt.Registry) err } func (m *ShopResponseToleranceMap) validateONEEIGHTTH(formats strfmt.Registry) error { - if swag.IsZero(m.ONEEIGHTTH) { // not required return nil } @@ -1875,7 +2521,6 @@ func (m *ShopResponseToleranceMap) validateONEEIGHTTH(formats strfmt.Registry) e } func (m *ShopResponseToleranceMap) validateOUNCE(formats strfmt.Registry) error { - if swag.IsZero(m.OUNCE) { // not required return nil } @@ -1893,7 +2538,6 @@ func (m *ShopResponseToleranceMap) validateOUNCE(formats strfmt.Registry) error } func (m *ShopResponseToleranceMap) validateQUARTER(formats strfmt.Registry) error { - if swag.IsZero(m.QUARTER) { // not required return nil } @@ -1911,7 +2555,6 @@ func (m *ShopResponseToleranceMap) validateQUARTER(formats strfmt.Registry) erro } func (m *ShopResponseToleranceMap) validateTHREEGRAMS(formats strfmt.Registry) error { - if swag.IsZero(m.THREEGRAMS) { // not required return nil } @@ -1929,7 +2572,6 @@ func (m *ShopResponseToleranceMap) validateTHREEGRAMS(formats strfmt.Registry) e } func (m *ShopResponseToleranceMap) validateTWOGRAMS(formats strfmt.Registry) error { - if swag.IsZero(m.TWOGRAMS) { // not required return nil } @@ -1946,6 +2588,160 @@ func (m *ShopResponseToleranceMap) validateTWOGRAMS(formats strfmt.Registry) err return nil } +// ContextValidate validate this shop response tolerance map based on the context it is used +func (m *ShopResponseToleranceMap) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGRAM(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHALF(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHALFGRAM(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateONEEIGHTTH(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOUNCE(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQUARTER(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTHREEGRAMS(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTWOGRAMS(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateGRAM(ctx context.Context, formats strfmt.Registry) error { + + if m.GRAM != nil { + if err := m.GRAM.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "GRAM") + } + return err + } + } + + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateHALF(ctx context.Context, formats strfmt.Registry) error { + + if m.HALF != nil { + if err := m.HALF.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "HALF") + } + return err + } + } + + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateHALFGRAM(ctx context.Context, formats strfmt.Registry) error { + + if m.HALFGRAM != nil { + if err := m.HALFGRAM.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "HALF_GRAM") + } + return err + } + } + + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateONEEIGHTTH(ctx context.Context, formats strfmt.Registry) error { + + if m.ONEEIGHTTH != nil { + if err := m.ONEEIGHTTH.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "ONE_EIGHTTH") + } + return err + } + } + + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateOUNCE(ctx context.Context, formats strfmt.Registry) error { + + if m.OUNCE != nil { + if err := m.OUNCE.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "OUNCE") + } + return err + } + } + + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateQUARTER(ctx context.Context, formats strfmt.Registry) error { + + if m.QUARTER != nil { + if err := m.QUARTER.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "QUARTER") + } + return err + } + } + + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateTHREEGRAMS(ctx context.Context, formats strfmt.Registry) error { + + if m.THREEGRAMS != nil { + if err := m.THREEGRAMS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "THREE_GRAMS") + } + return err + } + } + + return nil +} + +func (m *ShopResponseToleranceMap) contextValidateTWOGRAMS(ctx context.Context, formats strfmt.Registry) error { + + if m.TWOGRAMS != nil { + if err := m.TWOGRAMS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("toleranceMap" + "." + "TWO_GRAMS") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMap) MarshalBinary() ([]byte, error) { if m == nil { @@ -1970,45 +2766,59 @@ func (m *ShopResponseToleranceMap) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapGRAM struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486903 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 1.35 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb09 ID string `json:"id,omitempty"` // modified + // Example: 1551488486903 Modified int64 `json:"modified,omitempty"` // name + // Example: Gram Name string `json:"name,omitempty"` // priority + // Example: 1 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 0.85 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 1 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: GRAM WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 1 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2017,6 +2827,11 @@ func (m *ShopResponseToleranceMapGRAM) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this shop response tolerance map g RAM based on context it is used +func (m *ShopResponseToleranceMapGRAM) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapGRAM) MarshalBinary() ([]byte, error) { if m == nil { @@ -2041,45 +2856,59 @@ func (m *ShopResponseToleranceMapGRAM) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapHALF struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486905 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 14.5 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb0e ID string `json:"id,omitempty"` // modified + // Example: 1551488486905 Modified int64 `json:"modified,omitempty"` // name + // Example: 1/2 Name string `json:"name,omitempty"` // priority + // Example: 6 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 14 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 14 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: HALF WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 14.17476 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2088,6 +2917,11 @@ func (m *ShopResponseToleranceMapHALF) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this shop response tolerance map h a l f based on context it is used +func (m *ShopResponseToleranceMapHALF) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapHALF) MarshalBinary() ([]byte, error) { if m == nil { @@ -2112,45 +2946,59 @@ func (m *ShopResponseToleranceMapHALF) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapHALFGRAM struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486902 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 0.6 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb08 ID string `json:"id,omitempty"` // modified + // Example: 1551488486902 Modified int64 `json:"modified,omitempty"` // name + // Example: .5 Gram Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 0.5 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 0.5 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: HALF_GRAM WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 0.5 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2159,6 +3007,11 @@ func (m *ShopResponseToleranceMapHALFGRAM) Validate(formats strfmt.Registry) err return nil } +// ContextValidate validates this shop response tolerance map h a l f g RAM based on context it is used +func (m *ShopResponseToleranceMapHALFGRAM) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapHALFGRAM) MarshalBinary() ([]byte, error) { if m == nil { @@ -2183,45 +3036,59 @@ func (m *ShopResponseToleranceMapHALFGRAM) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapONEEIGHTTH struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486905 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 3.85 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb0c ID string `json:"id,omitempty"` // modified + // Example: 1551488486905 Modified int64 `json:"modified,omitempty"` // name + // Example: 1/8th Name string `json:"name,omitempty"` // priority + // Example: 4 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 3.45 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 3.5 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: ONE_EIGHTTH WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 3.54369 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2230,6 +3097,11 @@ func (m *ShopResponseToleranceMapONEEIGHTTH) Validate(formats strfmt.Registry) e return nil } +// ContextValidate validates this shop response tolerance map o n e e i g h t t h based on context it is used +func (m *ShopResponseToleranceMapONEEIGHTTH) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapONEEIGHTTH) MarshalBinary() ([]byte, error) { if m == nil { @@ -2254,45 +3126,59 @@ func (m *ShopResponseToleranceMapONEEIGHTTH) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapOUNCE struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486905 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 28.5 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb0f ID string `json:"id,omitempty"` // modified + // Example: 1551488486905 Modified int64 `json:"modified,omitempty"` // name + // Example: 1 Oz Name string `json:"name,omitempty"` // priority + // Example: 7 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 28 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 28 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: OUNCE WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 28.34952 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2301,6 +3187,11 @@ func (m *ShopResponseToleranceMapOUNCE) Validate(formats strfmt.Registry) error return nil } +// ContextValidate validates this shop response tolerance map o u n c e based on context it is used +func (m *ShopResponseToleranceMapOUNCE) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapOUNCE) MarshalBinary() ([]byte, error) { if m == nil { @@ -2325,45 +3216,59 @@ func (m *ShopResponseToleranceMapOUNCE) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapQUARTER struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486905 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 7.5 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb0d ID string `json:"id,omitempty"` // modified + // Example: 1551488486905 Modified int64 `json:"modified,omitempty"` // name + // Example: 1/4th Name string `json:"name,omitempty"` // priority + // Example: 5 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 7 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 7 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: QUARTER WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 7.087381 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2372,6 +3277,11 @@ func (m *ShopResponseToleranceMapQUARTER) Validate(formats strfmt.Registry) erro return nil } +// ContextValidate validates this shop response tolerance map q u a r t e r based on context it is used +func (m *ShopResponseToleranceMapQUARTER) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapQUARTER) MarshalBinary() ([]byte, error) { if m == nil { @@ -2396,45 +3306,59 @@ func (m *ShopResponseToleranceMapQUARTER) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapTHREEGRAMS struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486904 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 3.1 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb0b ID string `json:"id,omitempty"` // modified + // Example: 1551488486904 Modified int64 `json:"modified,omitempty"` // name + // Example: 3 Grams Name string `json:"name,omitempty"` // priority + // Example: 3 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 3 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 3 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: THREE_GRAMS WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 3 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2443,6 +3367,11 @@ func (m *ShopResponseToleranceMapTHREEGRAMS) Validate(formats strfmt.Registry) e return nil } +// ContextValidate validates this shop response tolerance map t h r e e g RAM s based on context it is used +func (m *ShopResponseToleranceMapTHREEGRAMS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapTHREEGRAMS) MarshalBinary() ([]byte, error) { if m == nil { @@ -2467,45 +3396,59 @@ func (m *ShopResponseToleranceMapTHREEGRAMS) UnmarshalBinary(b []byte) error { type ShopResponseToleranceMapTWOGRAMS struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486903 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enabled + // Example: true Enabled bool `json:"enabled,omitempty"` // end weight + // Example: 2.1 EndWeight float64 `json:"endWeight,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb0a ID string `json:"id,omitempty"` // modified + // Example: 1551488486903 Modified int64 `json:"modified,omitempty"` // name + // Example: 2 Grams Name string `json:"name,omitempty"` // priority + // Example: 2 Priority float64 `json:"priority,omitempty"` // start weight + // Example: 2 StartWeight float64 `json:"startWeight,omitempty"` // unit value + // Example: 2 UnitValue float64 `json:"unitValue,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // weight key + // Example: TWO_GRAMS WeightKey string `json:"weightKey,omitempty"` // weight value + // Example: 2 WeightValue float64 `json:"weightValue,omitempty"` } @@ -2514,6 +3457,11 @@ func (m *ShopResponseToleranceMapTWOGRAMS) Validate(formats strfmt.Registry) err return nil } +// ContextValidate validates this shop response tolerance map t w o g RAM s based on context it is used +func (m *ShopResponseToleranceMapTWOGRAMS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ShopResponseToleranceMapTWOGRAMS) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/transaction_by_id_response.go b/api/blaze/blaze_models/transaction_by_id_response.go index a958eb7..f9bdcc8 100644 --- a/api/blaze/blaze_models/transaction_by_id_response.go +++ b/api/blaze/blaze_models/transaction_by_id_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,84 +24,109 @@ import ( type TransactionByIDResponse struct { // active + // Example: false Active bool `json:"active,omitempty"` // address update + // Example: false AddressUpdate bool `json:"addressUpdate,omitempty"` // assigned + // Example: true Assigned bool `json:"assigned,omitempty"` // assigned employee Id + // Example: 5cabd4ba6218d148395b406f AssignedEmployeeID string `json:"assignedEmployeeId,omitempty"` // cart Cart *TransactionByIDResponseCart `json:"cart,omitempty"` // checkin time + // Example: 1585432659695 CheckinTime int64 `json:"checkinTime,omitempty"` // checkout type + // Example: Direct CheckoutType string `json:"checkoutType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // complete after + // Example: 1585441800000 CompleteAfter int64 `json:"completeAfter,omitempty"` // completed time + // Example: 1585440892887 CompletedTime int64 `json:"completedTime,omitempty"` // create onfleet task + // Example: true CreateOnfleetTask bool `json:"createOnfleetTask,omitempty"` // create tookan task + // Example: false CreateTookanTask bool `json:"createTookanTask,omitempty"` // created + // Example: 1585432659695 Created int64 `json:"created,omitempty"` // created by Id + // Example: 5d1109b9874b44081f07df8f CreatedByID string `json:"createdById,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // delivery address DeliveryAddress *TransactionByIDResponseDeliveryAddress `json:"deliveryAddress,omitempty"` // delivery date + // Example: 1585443600000 DeliveryDate int64 `json:"deliveryDate,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // end route date + // Example: 1585440891404 EndRouteDate int64 `json:"endRouteDate,omitempty"` // end time + // Example: 1585440891404 EndTime int64 `json:"endTime,omitempty"` // eta + // Example: 0 Eta float64 `json:"eta,omitempty"` // fulfilling fulfillment + // Example: false FulfillingFulfillment bool `json:"fulfillingFulfillment,omitempty"` // fulfillment step + // Example: Prepare FulfillmentStep string `json:"fulfillmentStep,omitempty"` // id + // Example: 5e7fc85343383208d7fbac3e ID string `json:"id,omitempty"` // loc + // Example: [-118.05688211705355,33.80187413192708] Loc []float64 `json:"loc"` // locked + // Example: false Locked bool `json:"locked,omitempty"` // member Id + // Example: 5e7fc80143383208d7fba673 MemberID string `json:"memberId,omitempty"` // member signature @@ -110,129 +136,169 @@ type TransactionByIDResponse struct { Memo string `json:"memo,omitempty"` // metrc delivery submit status + // Example: None MetrcDeliverySubmitStatus string `json:"metrcDeliverySubmitStatus,omitempty"` // metrc delivery submit time + // Example: 0 MetrcDeliverySubmitTime int64 `json:"metrcDeliverySubmitTime,omitempty"` // metrc Id + // Example: 17281252 MetrcID float64 `json:"metrcId,omitempty"` // metrc sale time + // Example: 2020-03-29T00:14:52.887Z MetrcSaleTime string `json:"metrcSaleTime,omitempty"` // metrc submission complete time + // Example: 0 MetrcSubmissionCompleteTime int64 `json:"metrcSubmissionCompleteTime,omitempty"` // metrc submission delete time + // Example: 0 MetrcSubmissionDeleteTime int64 `json:"metrcSubmissionDeleteTime,omitempty"` // mileage + // Example: 0 Mileage float64 `json:"mileage,omitempty"` // mileage calculated + // Example: true MileageCalculated bool `json:"mileageCalculated,omitempty"` // modified + // Example: 1585440893789 Modified int64 `json:"modified,omitempty"` // on fleet error OnFleetError string `json:"onFleetError,omitempty"` // on fleet task Id + // Example: o7XchVifXLXF40qHK1LnVijP OnFleetTaskID string `json:"onFleetTaskId,omitempty"` // order tags + // Example: ["REC Verified","Delivery"] OrderTags []string `json:"orderTags"` // override inventory Id + // Example: 5c7e8c7b722ed607e61edb41 OverrideInventoryID string `json:"overrideInventoryId,omitempty"` // packed by + // Example: 5d9384eca660c70822e3b1d0 PackedBy string `json:"packedBy,omitempty"` // packed date + // Example: 1585432972448 PackedDate float64 `json:"packedDate,omitempty"` // paid + // Example: true Paid bool `json:"paid,omitempty"` // paying with payment card + // Example: false PayingWithPaymentCard bool `json:"payingWithPaymentCard,omitempty"` // payment edited time + // Example: 0 PaymentEditedTime int64 `json:"paymentEditedTime,omitempty"` // points earned + // Example: 0 PointsEarned float64 `json:"pointsEarned,omitempty"` // prepared by + // Example: 5d1109b9874b44081f07df8f PreparedBy string `json:"preparedBy,omitempty"` // preparing fulfillment + // Example: false PreparingFulfillment bool `json:"preparingFulfillment,omitempty"` // priority + // Example: 14309 Priority float64 `json:"priority,omitempty"` // processed time + // Example: 1585440892887 ProcessedTime int64 `json:"processedTime,omitempty"` // queue type + // Example: Delivery QueueType string `json:"queueType,omitempty"` // refund payment options + // Example: ["Credit","StoreCredit"] RefundPaymentOptions []string `json:"refundPaymentOptions"` // routing + // Example: false Routing bool `json:"routing,omitempty"` // seller Id + // Example: 5d1655750f9c6f07f744a78a SellerID string `json:"sellerId,omitempty"` // seller terminal Id + // Example: 5d291e02bd20bf0800b3e816 SellerTerminalID string `json:"sellerTerminalId,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // short Id + // Example: 457d176d ShortID string `json:"shortId,omitempty"` // start route date + // Example: 1585432659695 StartRouteDate float64 `json:"startRouteDate,omitempty"` // start time + // Example: 1585440863815 StartTime int64 `json:"startTime,omitempty"` // state + // Example: 1 State float64 `json:"state,omitempty"` // status + // Example: Completed Status string `json:"status,omitempty"` // terminal Id TerminalID string `json:"terminalId,omitempty"` // time zone + // Example: America/Los_Angeles TimeZone string `json:"timeZone,omitempty"` // trace submit status + // Example: Completed TraceSubmitStatus string `json:"traceSubmitStatus,omitempty"` // tracking status + // Example: NotStarted TrackingStatus string `json:"trackingStatus,omitempty"` // trans no + // Example: 14309 TransNo string `json:"transNo,omitempty"` // trans type + // Example: Sale TransType string `json:"transType,omitempty"` // transaction refund status + // Example: None TransactionRefundStatus string `json:"transactionRefundStatus,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -259,7 +325,6 @@ func (m *TransactionByIDResponse) Validate(formats strfmt.Registry) error { } func (m *TransactionByIDResponse) validateCart(formats strfmt.Registry) error { - if swag.IsZero(m.Cart) { // not required return nil } @@ -277,7 +342,6 @@ func (m *TransactionByIDResponse) validateCart(formats strfmt.Registry) error { } func (m *TransactionByIDResponse) validateDeliveryAddress(formats strfmt.Registry) error { - if swag.IsZero(m.DeliveryAddress) { // not required return nil } @@ -295,7 +359,6 @@ func (m *TransactionByIDResponse) validateDeliveryAddress(formats strfmt.Registr } func (m *TransactionByIDResponse) validateMemberSignature(formats strfmt.Registry) error { - if swag.IsZero(m.MemberSignature) { // not required return nil } @@ -312,6 +375,70 @@ func (m *TransactionByIDResponse) validateMemberSignature(formats strfmt.Registr return nil } +// ContextValidate validate this transaction by Id response based on the context it is used +func (m *TransactionByIDResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCart(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDeliveryAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemberSignature(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionByIDResponse) contextValidateCart(ctx context.Context, formats strfmt.Registry) error { + + if m.Cart != nil { + if err := m.Cart.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponse) contextValidateDeliveryAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.DeliveryAddress != nil { + if err := m.DeliveryAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deliveryAddress") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponse) contextValidateMemberSignature(ctx context.Context, formats strfmt.Registry) error { + + if m.MemberSignature != nil { + if err := m.MemberSignature.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memberSignature") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -336,87 +463,112 @@ func (m *TransactionByIDResponse) UnmarshalBinary(b []byte) error { type TransactionByIDResponseCart struct { // adjustment amount + // Example: 0 AdjustmentAmount float64 `json:"adjustmentAmount,omitempty"` // after tax discount + // Example: 0 AfterTaxDiscount float64 `json:"afterTaxDiscount,omitempty"` // after tax discount notes AfterTaxDiscountNotes string `json:"afterTaxDiscountNotes,omitempty"` // applied after tax discount + // Example: 0 AppliedAfterTaxDiscount float64 `json:"appliedAfterTaxDiscount,omitempty"` // balance due + // Example: 0 BalanceDue float64 `json:"balanceDue,omitempty"` // calc cart discount + // Example: 5.4 CalcCartDiscount float64 `json:"calcCartDiscount,omitempty"` // cart discount notes CartDiscountNotes string `json:"cartDiscountNotes,omitempty"` // cash received + // Example: 0 CashReceived float64 `json:"cashReceived,omitempty"` // change due + // Example: 0 ChangeDue float64 `json:"changeDue,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: MedicinalThirdParty ConsumerType string `json:"consumerType,omitempty"` // created + // Example: 1585432659695 Created int64 `json:"created,omitempty"` // credit card fee + // Example: 0 CreditCardFee float64 `json:"creditCardFee,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // delivery discount + // Example: 0 DeliveryDiscount float64 `json:"deliveryDiscount,omitempty"` // delivery discount type + // Example: Cash DeliveryDiscountType string `json:"deliveryDiscountType,omitempty"` // delivery fee + // Example: 0 DeliveryFee float64 `json:"deliveryFee,omitempty"` // discount + // Example: 5.4 Discount float64 `json:"discount,omitempty"` // discount type + // Example: Cash DiscountType string `json:"discountType,omitempty"` // enable credit card fee + // Example: false EnableCreditCardFee bool `json:"enableCreditCardFee,omitempty"` // enable delivery fee + // Example: false EnableDeliveryFee bool `json:"enableDeliveryFee,omitempty"` // final refund amt + // Example: 0 FinalRefundAmt float64 `json:"finalRefundAmt,omitempty"` // id + // Example: 5e7fc85343383208d7fbac3f ID string `json:"id,omitempty"` // items Items []*TransactionByIDResponseCartItemsItems0 `json:"items"` // modified + // Example: 1585440891476 Modified int64 `json:"modified,omitempty"` // payment option + // Example: Credit PaymentOption string `json:"paymentOption,omitempty"` // payment type + // Example: Full PaymentType string `json:"paymentType,omitempty"` // point spent + // Example: 0 PointSpent float64 `json:"pointSpent,omitempty"` // promo code @@ -429,63 +581,80 @@ type TransactionByIDResponseCart struct { PromotionReqs []*TransactionByIDResponseCartPromotionReqsItems0 `json:"promotionReqs"` // refund amount + // Example: 0 RefundAmount float64 `json:"refundAmount,omitempty"` // refund option + // Example: Void RefundOption string `json:"refundOption,omitempty"` // refund order item requests RefundOrderItemRequests []string `json:"refundOrderItemRequests"` // request refund amt + // Example: 0 RequestRefundAmt float64 `json:"requestRefundAmt,omitempty"` // round amt + // Example: 0 RoundAmt float64 `json:"roundAmt,omitempty"` // storage location + // Example: CashDrawer StorageLocation string `json:"storageLocation,omitempty"` // sub total + // Example: 334 SubTotal float64 `json:"subTotal,omitempty"` // sub total discount + // Example: 334 SubTotalDiscount float64 `json:"subTotalDiscount,omitempty"` // tax + // Example: 0.08 Tax float64 `json:"tax,omitempty"` // tax result TaxResult *TransactionByIDResponseCartTaxResult `json:"taxResult,omitempty"` // tax round off type + // Example: ONE_CENT TaxRoundOffType string `json:"taxRoundOffType,omitempty"` // tax table TaxTable *TransactionByIDResponseCartTaxTable `json:"taxTable,omitempty"` // tip amount + // Example: 0 TipAmount float64 `json:"tipAmount,omitempty"` // total + // Example: 430 Total float64 `json:"total,omitempty"` // total a l excise tax + // Example: 0 TotalALExciseTax float64 `json:"totalALExciseTax,omitempty"` // total calc tax + // Example: 96 TotalCalcTax float64 `json:"totalCalcTax,omitempty"` // total discount + // Example: 0 TotalDiscount float64 `json:"totalDiscount,omitempty"` // total excise tax + // Example: 0 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -520,7 +689,6 @@ func (m *TransactionByIDResponseCart) Validate(formats strfmt.Registry) error { } func (m *TransactionByIDResponseCart) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -545,7 +713,6 @@ func (m *TransactionByIDResponseCart) validateItems(formats strfmt.Registry) err } func (m *TransactionByIDResponseCart) validatePromotionReqLogs(formats strfmt.Registry) error { - if swag.IsZero(m.PromotionReqLogs) { // not required return nil } @@ -570,7 +737,6 @@ func (m *TransactionByIDResponseCart) validatePromotionReqLogs(formats strfmt.Re } func (m *TransactionByIDResponseCart) validatePromotionReqs(formats strfmt.Registry) error { - if swag.IsZero(m.PromotionReqs) { // not required return nil } @@ -595,7 +761,6 @@ func (m *TransactionByIDResponseCart) validatePromotionReqs(formats strfmt.Regis } func (m *TransactionByIDResponseCart) validateTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.TaxResult) { // not required return nil } @@ -613,7 +778,6 @@ func (m *TransactionByIDResponseCart) validateTaxResult(formats strfmt.Registry) } func (m *TransactionByIDResponseCart) validateTaxTable(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTable) { // not required return nil } @@ -630,6 +794,118 @@ func (m *TransactionByIDResponseCart) validateTaxTable(formats strfmt.Registry) return nil } +// ContextValidate validate this transaction by ID response cart based on the context it is used +func (m *TransactionByIDResponseCart) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePromotionReqLogs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePromotionReqs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTable(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionByIDResponseCart) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionByIDResponseCart) contextValidatePromotionReqLogs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PromotionReqLogs); i++ { + + if m.PromotionReqLogs[i] != nil { + if err := m.PromotionReqLogs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "promotionReqLogs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionByIDResponseCart) contextValidatePromotionReqs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PromotionReqs); i++ { + + if m.PromotionReqs[i] != nil { + if err := m.PromotionReqs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "promotionReqs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionByIDResponseCart) contextValidateTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxResult != nil { + if err := m.TaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxResult") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCart) contextValidateTaxTable(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxTable != nil { + if err := m.TaxTable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCart) MarshalBinary() ([]byte, error) { if m == nil { @@ -654,102 +930,132 @@ func (m *TransactionByIDResponseCart) UnmarshalBinary(b []byte) error { type TransactionByIDResponseCartItemsItems0 struct { // available discount qty + // Example: 0 AvailableDiscountQty float64 `json:"availableDiscountQty,omitempty"` // calc cultivation tax + // Example: 0 CalcCultivationTax float64 `json:"calcCultivationTax,omitempty"` // calc discount + // Example: 0 CalcDiscount float64 `json:"calcDiscount,omitempty"` // calc pre tax + // Example: 0 CalcPreTax float64 `json:"calcPreTax,omitempty"` // calc tax + // Example: 4.0522 CalcTax float64 `json:"calcTax,omitempty"` // cogs + // Example: 7 Cogs float64 `json:"cogs,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // cost + // Example: 20.99 Cost float64 `json:"cost,omitempty"` // created + // Example: 1585432681221 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // discount + // Example: 0 Discount float64 `json:"discount,omitempty"` // discount notes DiscountNotes string `json:"discountNotes,omitempty"` // discount type + // Example: Cash DiscountType string `json:"discountType,omitempty"` // discounted qty + // Example: 0 DiscountedQty float64 `json:"discountedQty,omitempty"` // excise tax + // Example: 0.3686 ExciseTax float64 `json:"exciseTax,omitempty"` // final price + // Example: 20.99 FinalPrice float64 `json:"finalPrice,omitempty"` // finalized + // Example: false Finalized bool `json:"finalized,omitempty"` // fulfilled + // Example: true Fulfilled bool `json:"fulfilled,omitempty"` // id + // Example: 5e7fc86913d34108c8fc6e6d ID string `json:"id,omitempty"` // ignore mix match + // Example: false IgnoreMixMatch bool `json:"ignoreMixMatch,omitempty"` // mix matched + // Example: false MixMatched bool `json:"mixMatched,omitempty"` // modified + // Example: 1585440891572 Modified int64 `json:"modified,omitempty"` // order item Id + // Example: 2022a978-4995-415d-9d8f-2cbf22766028 OrderItemID string `json:"orderItemId,omitempty"` // orig quantity + // Example: 1 OrigQuantity float64 `json:"origQuantity,omitempty"` // override price + // Example: 0 OverridePrice float64 `json:"overridePrice,omitempty"` // per unit refund amt + // Example: 0 PerUnitRefundAmt float64 `json:"perUnitRefundAmt,omitempty"` // prepared qty + // Example: 0 PreparedQty float64 `json:"preparedQty,omitempty"` // product Id + // Example: 5de977fafe67a6082e6f2b26 ProductID string `json:"productId,omitempty"` // promotion reqs PromotionReqs []float64 `json:"promotionReqs"` // quantity + // Example: 10 Quantity float64 `json:"quantity,omitempty"` // quantity logs QuantityLogs []*TransactionByIDResponseCartItemsItems0QuantityLogsItems0 `json:"quantityLogs"` // status + // Example: Active Status string `json:"status,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax result @@ -759,27 +1065,35 @@ type TransactionByIDResponseCartItemsItems0 struct { TaxTable *TransactionByIDResponseCartItemsItems0TaxTable `json:"taxTable,omitempty"` // tax type + // Example: Inherit TaxType string `json:"taxType,omitempty"` // total refund amount + // Example: 0 TotalRefundAmount float64 `json:"totalRefundAmount,omitempty"` // total refund qty + // Example: 0 TotalRefundQty float64 `json:"totalRefundQty,omitempty"` // unit price + // Example: 20.99 UnitPrice float64 `json:"unitPrice,omitempty"` // unit qty + // Example: 0 UnitQty float64 `json:"unitQty,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // use unit qty + // Example: false UseUnitQty bool `json:"useUnitQty,omitempty"` // weight key + // Example: UNIT WeightKey string `json:"weightKey,omitempty"` } @@ -806,7 +1120,6 @@ func (m *TransactionByIDResponseCartItemsItems0) Validate(formats strfmt.Registr } func (m *TransactionByIDResponseCartItemsItems0) validateQuantityLogs(formats strfmt.Registry) error { - if swag.IsZero(m.QuantityLogs) { // not required return nil } @@ -831,7 +1144,6 @@ func (m *TransactionByIDResponseCartItemsItems0) validateQuantityLogs(formats st } func (m *TransactionByIDResponseCartItemsItems0) validateTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.TaxResult) { // not required return nil } @@ -849,7 +1161,6 @@ func (m *TransactionByIDResponseCartItemsItems0) validateTaxResult(formats strfm } func (m *TransactionByIDResponseCartItemsItems0) validateTaxTable(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTable) { // not required return nil } @@ -866,6 +1177,74 @@ func (m *TransactionByIDResponseCartItemsItems0) validateTaxTable(formats strfmt return nil } +// ContextValidate validate this transaction by ID response cart items items0 based on the context it is used +func (m *TransactionByIDResponseCartItemsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateQuantityLogs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTable(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0) contextValidateQuantityLogs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.QuantityLogs); i++ { + + if m.QuantityLogs[i] != nil { + if err := m.QuantityLogs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quantityLogs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0) contextValidateTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxResult != nil { + if err := m.TaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxResult") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0) contextValidateTaxTable(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxTable != nil { + if err := m.TaxTable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -890,15 +1269,19 @@ func (m *TransactionByIDResponseCartItemsItems0) UnmarshalBinary(b []byte) error type TransactionByIDResponseCartItemsItems0QuantityLogsItems0 struct { // batch Id + // Example: 5cacc1bb6218d174d3f17b31 BatchID string `json:"batchId,omitempty"` // id + // Example: 1a7002e4-ac24-43a3-a84e-2c8af39aaa2a_5cabd4ba6218d148395b4067_5cacc1bb6218d174d3f17b31 ID string `json:"id,omitempty"` // inventory Id + // Example: 5cabd4ba6218d148395b4067 InventoryID string `json:"inventoryId,omitempty"` // quantity + // Example: 10 Quantity float64 `json:"quantity,omitempty"` } @@ -907,6 +1290,11 @@ func (m *TransactionByIDResponseCartItemsItems0QuantityLogsItems0) Validate(form return nil } +// ContextValidate validates this transaction by ID response cart items items0 quantity logs items0 based on context it is used +func (m *TransactionByIDResponseCartItemsItems0QuantityLogsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0QuantityLogsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -931,63 +1319,82 @@ func (m *TransactionByIDResponseCartItemsItems0QuantityLogsItems0) UnmarshalBina type TransactionByIDResponseCartItemsItems0TaxResult struct { // created + // Example: 1554826473345 Created int64 `json:"created,omitempty"` // cultivation tax result CultivationTaxResult *TransactionByIDResponseCartItemsItems0TaxResultCultivationTaxResult `json:"cultivationTaxResult,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cacc4e96218d174d3f17c3a ID string `json:"id,omitempty"` // modified + // Example: 1554826473345 Modified int64 `json:"modified,omitempty"` // total a l excise tax + // Example: 96 TotalALExciseTax float64 `json:"totalALExciseTax,omitempty"` // total a l post excise tax + // Example: 96 TotalALPostExciseTax float64 `json:"totalALPostExciseTax,omitempty"` // total city pre tax + // Example: 0 TotalCityPreTax float64 `json:"totalCityPreTax,omitempty"` // total city tax + // Example: 0 TotalCityTax float64 `json:"totalCityTax,omitempty"` // total county pre tax + // Example: 0 TotalCountyPreTax float64 `json:"totalCountyPreTax,omitempty"` // total county tax + // Example: 0 TotalCountyTax float64 `json:"totalCountyTax,omitempty"` // total excise tax + // Example: 0 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // total fed pre tax + // Example: 0 TotalFedPreTax float64 `json:"totalFedPreTax,omitempty"` // total fed tax + // Example: 0 TotalFedTax float64 `json:"totalFedTax,omitempty"` // total n a l pre excise tax + // Example: 0 TotalNALPreExciseTax float64 `json:"totalNALPreExciseTax,omitempty"` // total post calc tax + // Example: 0 TotalPostCalcTax float64 `json:"totalPostCalcTax,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // total state pre tax + // Example: 0 TotalStatePreTax float64 `json:"totalStatePreTax,omitempty"` // total state tax + // Example: 0 TotalStateTax float64 `json:"totalStateTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1006,7 +1413,6 @@ func (m *TransactionByIDResponseCartItemsItems0TaxResult) Validate(formats strfm } func (m *TransactionByIDResponseCartItemsItems0TaxResult) validateCultivationTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.CultivationTaxResult) { // not required return nil } @@ -1023,6 +1429,34 @@ func (m *TransactionByIDResponseCartItemsItems0TaxResult) validateCultivationTax return nil } +// ContextValidate validate this transaction by ID response cart items items0 tax result based on the context it is used +func (m *TransactionByIDResponseCartItemsItems0TaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCultivationTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0TaxResult) contextValidateCultivationTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.CultivationTaxResult != nil { + if err := m.CultivationTaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxResult" + "." + "cultivationTaxResult") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0TaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1047,24 +1481,31 @@ func (m *TransactionByIDResponseCartItemsItems0TaxResult) UnmarshalBinary(b []by type TransactionByIDResponseCartItemsItems0TaxResultCultivationTaxResult struct { // flower tax oz + // Example: 0 FlowerTaxOz float64 `json:"flowerTaxOz,omitempty"` // leaf tax oz + // Example: 0 LeafTaxOz float64 `json:"leafTaxOz,omitempty"` // total cultivation tax + // Example: 0 TotalCultivationTax float64 `json:"totalCultivationTax,omitempty"` // total flower oz + // Example: 0 TotalFlowerOz float64 `json:"totalFlowerOz,omitempty"` // total flower tax + // Example: 0 TotalFlowerTax float64 `json:"totalFlowerTax,omitempty"` // total leaf oz + // Example: 0 TotalLeafOz float64 `json:"totalLeafOz,omitempty"` // total leaf tax + // Example: 0 TotalLeafTax float64 `json:"totalLeafTax,omitempty"` } @@ -1073,6 +1514,11 @@ func (m *TransactionByIDResponseCartItemsItems0TaxResultCultivationTaxResult) Va return nil } +// ContextValidate validates this transaction by ID response cart items items0 tax result cultivation tax result based on context it is used +func (m *TransactionByIDResponseCartItemsItems0TaxResultCultivationTaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0TaxResultCultivationTaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1097,54 +1543,67 @@ func (m *TransactionByIDResponseCartItemsItems0TaxResultCultivationTaxResult) Un type TransactionByIDResponseCartItemsItems0TaxTable struct { // active + // Example: false Active bool `json:"active,omitempty"` // city tax CityTax *TransactionByIDResponseCartItemsItems0TaxTableCityTax `json:"cityTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: MedicinalThirdParty ConsumerType string `json:"consumerType,omitempty"` // county tax CountyTax *TransactionByIDResponseCartItemsItems0TaxTableCountyTax `json:"countyTax,omitempty"` // created + // Example: 1585440891598 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // federal tax FederalTax *TransactionByIDResponseCartItemsItems0TaxTableFederalTax `json:"federalTax,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189e1 ID string `json:"id,omitempty"` // modified + // Example: 1585440891598 Modified int64 `json:"modified,omitempty"` // name + // Example: Medicinal - Third Party Name string `json:"name,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // state tax StateTax *TransactionByIDResponseCartItemsItems0TaxTableStateTax `json:"stateTax,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax type + // Example: Custom TaxType string `json:"taxType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1175,7 +1634,6 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTable) Validate(formats strfmt } func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateCityTax(formats strfmt.Registry) error { - if swag.IsZero(m.CityTax) { // not required return nil } @@ -1193,7 +1651,6 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateCityTax(formats } func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateCountyTax(formats strfmt.Registry) error { - if swag.IsZero(m.CountyTax) { // not required return nil } @@ -1211,7 +1668,6 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateCountyTax(forma } func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateFederalTax(formats strfmt.Registry) error { - if swag.IsZero(m.FederalTax) { // not required return nil } @@ -1229,7 +1685,6 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateFederalTax(form } func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateStateTax(formats strfmt.Registry) error { - if swag.IsZero(m.StateTax) { // not required return nil } @@ -1246,6 +1701,88 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTable) validateStateTax(format return nil } +// ContextValidate validate this transaction by ID response cart items items0 tax table based on the context it is used +func (m *TransactionByIDResponseCartItemsItems0TaxTable) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCityTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountyTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFederalTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStateTax(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0TaxTable) contextValidateCityTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CityTax != nil { + if err := m.CityTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "cityTax") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0TaxTable) contextValidateCountyTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CountyTax != nil { + if err := m.CountyTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "countyTax") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0TaxTable) contextValidateFederalTax(ctx context.Context, formats strfmt.Registry) error { + + if m.FederalTax != nil { + if err := m.FederalTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "federalTax") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartItemsItems0TaxTable) contextValidateStateTax(ctx context.Context, formats strfmt.Registry) error { + + if m.StateTax != nil { + if err := m.StateTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "stateTax") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0TaxTable) MarshalBinary() ([]byte, error) { if m == nil { @@ -1270,48 +1807,63 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTable) UnmarshalBinary(b []byt type TransactionByIDResponseCartItemsItems0TaxTableCityTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891598 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: City DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189e2 ID string `json:"id,omitempty"` // modified + // Example: 1585440891598 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 10 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: City Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1320,6 +1872,11 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableCityTax) Validate(formats return nil } +// ContextValidate validates this transaction by ID response cart items items0 tax table city tax based on context it is used +func (m *TransactionByIDResponseCartItemsItems0TaxTableCityTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0TaxTableCityTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1344,48 +1901,63 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableCityTax) UnmarshalBinary( type TransactionByIDResponseCartItemsItems0TaxTableCountyTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891598 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: County DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189e3 ID string `json:"id,omitempty"` // modified + // Example: 1585440891598 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: County Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1394,6 +1966,11 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableCountyTax) Validate(forma return nil } +// ContextValidate validates this transaction by ID response cart items items0 tax table county tax based on context it is used +func (m *TransactionByIDResponseCartItemsItems0TaxTableCountyTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0TaxTableCountyTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1418,48 +1995,63 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableCountyTax) UnmarshalBinar type TransactionByIDResponseCartItemsItems0TaxTableFederalTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891598 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: Federal DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189e5 ID string `json:"id,omitempty"` // modified + // Example: 1585440891598 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: Federal Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1468,6 +2060,11 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableFederalTax) Validate(form return nil } +// ContextValidate validates this transaction by ID response cart items items0 tax table federal tax based on context it is used +func (m *TransactionByIDResponseCartItemsItems0TaxTableFederalTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0TaxTableFederalTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1492,48 +2089,63 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableFederalTax) UnmarshalBina type TransactionByIDResponseCartItemsItems0TaxTableStateTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891598 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: State DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189e4 ID string `json:"id,omitempty"` // modified + // Example: 1585440891598 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 9.5 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: State Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1542,6 +2154,11 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableStateTax) Validate(format return nil } +// ContextValidate validates this transaction by ID response cart items items0 tax table state tax based on context it is used +func (m *TransactionByIDResponseCartItemsItems0TaxTableStateTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartItemsItems0TaxTableStateTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1566,36 +2183,47 @@ func (m *TransactionByIDResponseCartItemsItems0TaxTableStateTax) UnmarshalBinary type TransactionByIDResponseCartPromotionReqLogsItems0 struct { // amount + // Example: 5.4 Amount float64 `json:"amount,omitempty"` // assigned + // Example: false Assigned bool `json:"assigned,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1585440891535 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189d9 ID string `json:"id,omitempty"` // modified + // Example: 1585440891535 Modified int64 `json:"modified,omitempty"` // promotion Id + // Example: 5da25bd344ce2e084b72fe31 PromotionID string `json:"promotionId,omitempty"` // promotion type + // Example: Cart PromotionType string `json:"promotionType,omitempty"` // stackable + // Example: false Stackable bool `json:"stackable,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1604,6 +2232,11 @@ func (m *TransactionByIDResponseCartPromotionReqLogsItems0) Validate(formats str return nil } +// ContextValidate validates this transaction by ID response cart promotion req logs items0 based on context it is used +func (m *TransactionByIDResponseCartPromotionReqLogsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartPromotionReqLogsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1628,27 +2261,35 @@ func (m *TransactionByIDResponseCartPromotionReqLogsItems0) UnmarshalBinary(b [] type TransactionByIDResponseCartPromotionReqsItems0 struct { // assigned + // Example: true Assigned bool `json:"assigned,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1585440891508 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189d4 ID string `json:"id,omitempty"` // modified + // Example: 1585440891508 Modified int64 `json:"modified,omitempty"` // promotion Id + // Example: 5da25bd344ce2e084b72fe31 PromotionID string `json:"promotionId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1657,6 +2298,11 @@ func (m *TransactionByIDResponseCartPromotionReqsItems0) Validate(formats strfmt return nil } +// ContextValidate validates this transaction by ID response cart promotion reqs items0 based on context it is used +func (m *TransactionByIDResponseCartPromotionReqsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartPromotionReqsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1681,66 +2327,85 @@ func (m *TransactionByIDResponseCartPromotionReqsItems0) UnmarshalBinary(b []byt type TransactionByIDResponseCartTaxResult struct { // created + // Example: 1585440891598 Created int64 `json:"created,omitempty"` // cultivation tax result CultivationTaxResult *TransactionByIDResponseCartTaxResultCultivationTaxResult `json:"cultivationTaxResult,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189ec ID string `json:"id,omitempty"` // modified + // Example: 1585440891598 Modified int64 `json:"modified,omitempty"` // tax mapping info TaxMappingInfo *TransactionByIDResponseCartTaxResultTaxMappingInfo `json:"taxMappingInfo,omitempty"` // total a l excise tax + // Example: 0 TotalALExciseTax float64 `json:"totalALExciseTax,omitempty"` // total a l post excise tax + // Example: 4.05 TotalALPostExciseTax float64 `json:"totalALPostExciseTax,omitempty"` // total city pre tax + // Example: 0 TotalCityPreTax float64 `json:"totalCityPreTax,omitempty"` // total city tax + // Example: 5.26 TotalCityTax float64 `json:"totalCityTax,omitempty"` // total county pre tax + // Example: 0 TotalCountyPreTax float64 `json:"totalCountyPreTax,omitempty"` // total county tax + // Example: 0 TotalCountyTax float64 `json:"totalCountyTax,omitempty"` // total excise tax + // Example: 0 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // total fed pre tax + // Example: 0 TotalFedPreTax float64 `json:"totalFedPreTax,omitempty"` // total fed tax + // Example: 0 TotalFedTax float64 `json:"totalFedTax,omitempty"` // total n a l pre excise tax + // Example: 0 TotalNALPreExciseTax float64 `json:"totalNALPreExciseTax,omitempty"` // total post calc tax + // Example: 14.31 TotalPostCalcTax float64 `json:"totalPostCalcTax,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // total state pre tax + // Example: 0 TotalStatePreTax float64 `json:"totalStatePreTax,omitempty"` // total state tax + // Example: 5 TotalStateTax float64 `json:"totalStateTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1763,7 +2428,6 @@ func (m *TransactionByIDResponseCartTaxResult) Validate(formats strfmt.Registry) } func (m *TransactionByIDResponseCartTaxResult) validateCultivationTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.CultivationTaxResult) { // not required return nil } @@ -1781,7 +2445,6 @@ func (m *TransactionByIDResponseCartTaxResult) validateCultivationTaxResult(form } func (m *TransactionByIDResponseCartTaxResult) validateTaxMappingInfo(formats strfmt.Registry) error { - if swag.IsZero(m.TaxMappingInfo) { // not required return nil } @@ -1798,6 +2461,52 @@ func (m *TransactionByIDResponseCartTaxResult) validateTaxMappingInfo(formats st return nil } +// ContextValidate validate this transaction by ID response cart tax result based on the context it is used +func (m *TransactionByIDResponseCartTaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCultivationTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxMappingInfo(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionByIDResponseCartTaxResult) contextValidateCultivationTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.CultivationTaxResult != nil { + if err := m.CultivationTaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxResult" + "." + "cultivationTaxResult") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartTaxResult) contextValidateTaxMappingInfo(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxMappingInfo != nil { + if err := m.TaxMappingInfo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxResult" + "." + "taxMappingInfo") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1822,33 +2531,43 @@ func (m *TransactionByIDResponseCartTaxResult) UnmarshalBinary(b []byte) error { type TransactionByIDResponseCartTaxResultCultivationTaxResult struct { // flower tax oz + // Example: 0 FlowerTaxOz float64 `json:"flowerTaxOz,omitempty"` // leaf tax oz + // Example: 0 LeafTaxOz float64 `json:"leafTaxOz,omitempty"` // plant tax oz + // Example: 0 PlantTaxOz float64 `json:"plantTaxOz,omitempty"` // total cultivation tax + // Example: 0 TotalCultivationTax float64 `json:"totalCultivationTax,omitempty"` // total flower oz + // Example: 0 TotalFlowerOz float64 `json:"totalFlowerOz,omitempty"` // total flower tax + // Example: 0 TotalFlowerTax float64 `json:"totalFlowerTax,omitempty"` // total leaf oz + // Example: 0 TotalLeafOz float64 `json:"totalLeafOz,omitempty"` // total leaf tax + // Example: 0 TotalLeafTax float64 `json:"totalLeafTax,omitempty"` // total plant oz + // Example: 0 TotalPlantOz float64 `json:"totalPlantOz,omitempty"` // total plant tax + // Example: 0 TotalPlantTax float64 `json:"totalPlantTax,omitempty"` } @@ -1857,6 +2576,11 @@ func (m *TransactionByIDResponseCartTaxResultCultivationTaxResult) Validate(form return nil } +// ContextValidate validates this transaction by ID response cart tax result cultivation tax result based on context it is used +func (m *TransactionByIDResponseCartTaxResultCultivationTaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxResultCultivationTaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1881,15 +2605,19 @@ func (m *TransactionByIDResponseCartTaxResultCultivationTaxResult) UnmarshalBina type TransactionByIDResponseCartTaxResultTaxMappingInfo struct { // city + // Example: City City string `json:"City,omitempty"` // county + // Example: County County string `json:"County,omitempty"` // federal + // Example: Federal Federal string `json:"Federal,omitempty"` // state + // Example: State State string `json:"State,omitempty"` } @@ -1898,6 +2626,11 @@ func (m *TransactionByIDResponseCartTaxResultTaxMappingInfo) Validate(formats st return nil } +// ContextValidate validates this transaction by ID response cart tax result tax mapping info based on context it is used +func (m *TransactionByIDResponseCartTaxResultTaxMappingInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxResultTaxMappingInfo) MarshalBinary() ([]byte, error) { if m == nil { @@ -1922,54 +2655,67 @@ func (m *TransactionByIDResponseCartTaxResultTaxMappingInfo) UnmarshalBinary(b [ type TransactionByIDResponseCartTaxTable struct { // active + // Example: false Active bool `json:"active,omitempty"` // city tax CityTax *TransactionByIDResponseCartTaxTableCityTax `json:"cityTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: MedicinalThirdParty ConsumerType string `json:"consumerType,omitempty"` // county tax CountyTax *TransactionByIDResponseCartTaxTableCountyTax `json:"countyTax,omitempty"` // created + // Example: 1585440891480 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // federal tax FederalTax *TransactionByIDResponseCartTaxTableFederalTax `json:"federalTax,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189cf ID string `json:"id,omitempty"` // modified + // Example: 1585440891480 Modified int64 `json:"modified,omitempty"` // name + // Example: Medicinal - Third Party Name string `json:"name,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // state tax StateTax *TransactionByIDResponseCartTaxTableStateTax `json:"stateTax,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax type + // Example: Custom TaxType string `json:"taxType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2000,7 +2746,6 @@ func (m *TransactionByIDResponseCartTaxTable) Validate(formats strfmt.Registry) } func (m *TransactionByIDResponseCartTaxTable) validateCityTax(formats strfmt.Registry) error { - if swag.IsZero(m.CityTax) { // not required return nil } @@ -2018,7 +2763,6 @@ func (m *TransactionByIDResponseCartTaxTable) validateCityTax(formats strfmt.Reg } func (m *TransactionByIDResponseCartTaxTable) validateCountyTax(formats strfmt.Registry) error { - if swag.IsZero(m.CountyTax) { // not required return nil } @@ -2036,7 +2780,6 @@ func (m *TransactionByIDResponseCartTaxTable) validateCountyTax(formats strfmt.R } func (m *TransactionByIDResponseCartTaxTable) validateFederalTax(formats strfmt.Registry) error { - if swag.IsZero(m.FederalTax) { // not required return nil } @@ -2054,7 +2797,6 @@ func (m *TransactionByIDResponseCartTaxTable) validateFederalTax(formats strfmt. } func (m *TransactionByIDResponseCartTaxTable) validateStateTax(formats strfmt.Registry) error { - if swag.IsZero(m.StateTax) { // not required return nil } @@ -2071,6 +2813,88 @@ func (m *TransactionByIDResponseCartTaxTable) validateStateTax(formats strfmt.Re return nil } +// ContextValidate validate this transaction by ID response cart tax table based on the context it is used +func (m *TransactionByIDResponseCartTaxTable) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCityTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountyTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFederalTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStateTax(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionByIDResponseCartTaxTable) contextValidateCityTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CityTax != nil { + if err := m.CityTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "cityTax") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartTaxTable) contextValidateCountyTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CountyTax != nil { + if err := m.CountyTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "countyTax") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartTaxTable) contextValidateFederalTax(ctx context.Context, formats strfmt.Registry) error { + + if m.FederalTax != nil { + if err := m.FederalTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "federalTax") + } + return err + } + } + + return nil +} + +func (m *TransactionByIDResponseCartTaxTable) contextValidateStateTax(ctx context.Context, formats strfmt.Registry) error { + + if m.StateTax != nil { + if err := m.StateTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "stateTax") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxTable) MarshalBinary() ([]byte, error) { if m == nil { @@ -2095,48 +2919,63 @@ func (m *TransactionByIDResponseCartTaxTable) UnmarshalBinary(b []byte) error { type TransactionByIDResponseCartTaxTableCityTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891480 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: City DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189d0 ID string `json:"id,omitempty"` // modified + // Example: 1585440891480 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 10 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: City Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2145,6 +2984,11 @@ func (m *TransactionByIDResponseCartTaxTableCityTax) Validate(formats strfmt.Reg return nil } +// ContextValidate validates this transaction by ID response cart tax table city tax based on context it is used +func (m *TransactionByIDResponseCartTaxTableCityTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxTableCityTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2169,48 +3013,63 @@ func (m *TransactionByIDResponseCartTaxTableCityTax) UnmarshalBinary(b []byte) e type TransactionByIDResponseCartTaxTableCountyTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891480 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: County DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189d1 ID string `json:"id,omitempty"` // modified + // Example: 1585440891480 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: County Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2219,6 +3078,11 @@ func (m *TransactionByIDResponseCartTaxTableCountyTax) Validate(formats strfmt.R return nil } +// ContextValidate validates this transaction by ID response cart tax table county tax based on context it is used +func (m *TransactionByIDResponseCartTaxTableCountyTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxTableCountyTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2243,48 +3107,63 @@ func (m *TransactionByIDResponseCartTaxTableCountyTax) UnmarshalBinary(b []byte) type TransactionByIDResponseCartTaxTableFederalTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891480 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: Federal DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189d3 ID string `json:"id,omitempty"` // modified + // Example: 1585440891480 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: Federal Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2293,6 +3172,11 @@ func (m *TransactionByIDResponseCartTaxTableFederalTax) Validate(formats strfmt. return nil } +// ContextValidate validates this transaction by ID response cart tax table federal tax based on context it is used +func (m *TransactionByIDResponseCartTaxTableFederalTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxTableFederalTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2317,48 +3201,63 @@ func (m *TransactionByIDResponseCartTaxTableFederalTax) UnmarshalBinary(b []byte type TransactionByIDResponseCartTaxTableStateTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1585440891480 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // display name + // Example: State DisplayName string `json:"displayName,omitempty"` // id + // Example: 5e7fe87be26bf108c9d189d2 ID string `json:"id,omitempty"` // modified + // Example: 1585440891480 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 9.5 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: State Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2367,6 +3266,11 @@ func (m *TransactionByIDResponseCartTaxTableStateTax) Validate(formats strfmt.Re return nil } +// ContextValidate validates this transaction by ID response cart tax table state tax based on context it is used +func (m *TransactionByIDResponseCartTaxTableStateTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseCartTaxTableStateTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2391,39 +3295,50 @@ func (m *TransactionByIDResponseCartTaxTableStateTax) UnmarshalBinary(b []byte) type TransactionByIDResponseDeliveryAddress struct { // address + // Example: 4331 Green Avenue Address string `json:"address,omitempty"` // address line2 AddressLine2 string `json:"addressLine2,omitempty"` // city + // Example: Los Alamitos City string `json:"city,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1585432659695 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5e7fc85343383208d7fbac40 ID string `json:"id,omitempty"` // modified + // Example: 1585432659695 Modified int64 `json:"modified,omitempty"` // state + // Example: CA State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code + // Example: 90720 ZipCode string `json:"zipCode,omitempty"` } @@ -2432,6 +3347,11 @@ func (m *TransactionByIDResponseDeliveryAddress) Validate(formats strfmt.Registr return nil } +// ContextValidate validates this transaction by ID response delivery address based on context it is used +func (m *TransactionByIDResponseDeliveryAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseDeliveryAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -2456,48 +3376,63 @@ func (m *TransactionByIDResponseDeliveryAddress) UnmarshalBinary(b []byte) error type TransactionByIDResponseMemberSignature struct { // active + // Example: true Active bool `json:"active,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1585440877379 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5e7fe86dcdabfe08de901539 ID string `json:"id,omitempty"` // key + // Example: e3ccaa24-63db-410b-b3aa-205259a04f52.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-public.s3.amazonaws.com/e3ccaa24-63db-410b-b3aa-205259a04f52-800x800.png LargeURL string `json:"largeURL,omitempty"` // medium URL + // Example: https://connect-files-public.s3.amazonaws.com/e3ccaa24-63db-410b-b3aa-205259a04f52-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1585440877379 Modified int64 `json:"modified,omitempty"` // name + // Example: file Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://connect-files-public.s3.amazonaws.com/e3ccaa24-63db-410b-b3aa-205259a04f52.png PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-public.s3.amazonaws.com/e3ccaa24-63db-410b-b3aa-205259a04f52-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2506,6 +3441,11 @@ func (m *TransactionByIDResponseMemberSignature) Validate(formats strfmt.Registr return nil } +// ContextValidate validates this transaction by ID response member signature based on context it is used +func (m *TransactionByIDResponseMemberSignature) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionByIDResponseMemberSignature) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/transactions_response.go b/api/blaze/blaze_models/transactions_response.go index 59810cf..b022c02 100644 --- a/api/blaze/blaze_models/transactions_response.go +++ b/api/blaze/blaze_models/transactions_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,12 +24,15 @@ import ( type TransactionsResponse struct { // limit + // Example: 200 Limit float64 `json:"limit,omitempty"` // skip + // Example: 0 Skip float64 `json:"skip,omitempty"` // total + // Example: 138 Total float64 `json:"total,omitempty"` // values @@ -50,7 +54,6 @@ func (m *TransactionsResponse) Validate(formats strfmt.Registry) error { } func (m *TransactionsResponse) validateValues(formats strfmt.Registry) error { - if swag.IsZero(m.Values) { // not required return nil } @@ -74,6 +77,38 @@ func (m *TransactionsResponse) validateValues(formats strfmt.Registry) error { return nil } +// ContextValidate validate this transactions response based on the context it is used +func (m *TransactionsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateValues(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponse) contextValidateValues(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Values); i++ { + + if m.Values[i] != nil { + if err := m.Values[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("values" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -98,183 +133,234 @@ func (m *TransactionsResponse) UnmarshalBinary(b []byte) error { type TransactionsResponseValuesItems0 struct { // active + // Example: false Active bool `json:"active,omitempty"` // assigned employee Id + // Example: 5cba1d65e7198807f4ba7163 AssignedEmployeeID string `json:"assignedEmployeeId,omitempty"` // cart Cart *TransactionsResponseValuesItems0Cart `json:"cart,omitempty"` // checkin time + // Example: 1556055323017 CheckinTime int64 `json:"checkinTime,omitempty"` // checkout type + // Example: Direct CheckoutType string `json:"checkoutType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // completed time + // Example: 1556066738522 CompletedTime int64 `json:"completedTime,omitempty"` // consumer cart Id + // Example: string ConsumerCartID string `json:"consumerCartId,omitempty"` // created + // Example: 1556055323017 Created int64 `json:"created,omitempty"` // created by Id + // Example: 5cb7b8a94cd84907f646e851 CreatedByID string `json:"createdById,omitempty"` // delete note DeleteNote *TransactionsResponseValuesItems0DeleteNote `json:"deleteNote,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // delivery address DeliveryAddress *TransactionsResponseValuesItems0DeliveryAddress `json:"deliveryAddress,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // end route date + // Example: 1556056021575 EndRouteDate float64 `json:"endRouteDate,omitempty"` // end route location + // Example: [33.81258146840503,-116.49588659416557] EndRouteLocation []float64 `json:"endRouteLocation"` // end time + // Example: 1556066737667 EndTime int64 `json:"endTime,omitempty"` // eta + // Example: 0 Eta float64 `json:"eta,omitempty"` // fulfillment step + // Example: Prepare FulfillmentStep string `json:"fulfillmentStep,omitempty"` // id + // Example: 5cbf851b33b485082543b7a1 ID string `json:"id,omitempty"` // loc + // Example: [-118.58774266216771,34.37550086531264] Loc []float64 `json:"loc"` // locked + // Example: false Locked bool `json:"locked,omitempty"` // member Member *TransactionsResponseValuesItems0Member `json:"member,omitempty"` // member Id + // Example: 5cbf84e233b485082543b67d MemberID string `json:"memberId,omitempty"` // member signature MemberSignature *TransactionsResponseValuesItems0MemberSignature `json:"memberSignature,omitempty"` // memo + // Example: string Memo string `json:"memo,omitempty"` // metrc Id + // Example: string MetrcID int64 `json:"metrcId,omitempty"` // metrc sale time + // Example: 2019-04-24T00:45:38.522Z MetrcSaleTime string `json:"metrcSaleTime,omitempty"` // mileage + // Example: 0 Mileage float64 `json:"mileage,omitempty"` // mileage calculated + // Example: true MileageCalculated bool `json:"mileageCalculated,omitempty"` // modified + // Example: 1556503061612 Modified int64 `json:"modified,omitempty"` // note Note *TransactionsResponseValuesItems0Note `json:"note,omitempty"` // override inventory Id + // Example: 5c9fe425e0faca07db94b990 OverrideInventoryID string `json:"overrideInventoryId,omitempty"` // paid + // Example: false Paid bool `json:"paid,omitempty"` // paid time + // Example: 1556066738522 PaidTime int64 `json:"paidTime,omitempty"` // parentitem number + // Example: 5cd329d5e0faca07d2832c88 ParentitemNumber string `json:"parentitemNumber,omitempty"` // payment card payments PaymentCardPayments []*TransactionsResponseValuesItems0PaymentCardPaymentsItems0 `json:"paymentCardPayments"` // points earned + // Example: 90 PointsEarned float64 `json:"pointsEarned,omitempty"` // priority + // Example: 71 Priority float64 `json:"priority,omitempty"` // processed time + // Example: 1556066738522 ProcessedTime int64 `json:"processedTime,omitempty"` // queue type + // Example: Delivery QueueType string `json:"queueType,omitempty"` // routing + // Example: false Routing bool `json:"routing,omitempty"` // seller Seller *TransactionsResponseValuesItems0Seller `json:"seller,omitempty"` // seller Id + // Example: 5cba1d65e7198807f4ba7163 SellerID string `json:"sellerId,omitempty"` // seller terminal Id + // Example: 5c82b3944442190831bca731 SellerTerminalID string `json:"sellerTerminalId,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // source + // Example: string Source string `json:"source,omitempty"` // start route date + // Example: 1556056023752 StartRouteDate float64 `json:"startRouteDate,omitempty"` // start route location + // Example: [33.81258146840503,-116.49588659416557] StartRouteLocation []float64 `json:"startRouteLocation"` // start time + // Example: 1556066674249 StartTime int64 `json:"startTime,omitempty"` // status + // Example: Completed Status string `json:"status,omitempty"` // terminal Id TerminalID string `json:"terminalId,omitempty"` // time zone + // Example: America/Los_Angeles TimeZone string `json:"timeZone,omitempty"` // trace message + // Example: string TraceMessage string `json:"traceMessage,omitempty"` // trace submit status + // Example: None TraceSubmitStatus string `json:"traceSubmitStatus,omitempty"` // tracking status + // Example: NotStarted TrackingStatus string `json:"trackingStatus,omitempty"` // trans no + // Example: 71 TransNo string `json:"transNo,omitempty"` // trans type + // Example: Sale TransType string `json:"transType,omitempty"` // transfer shop Id + // Example: string TransferShopID string `json:"transferShopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -321,7 +407,6 @@ func (m *TransactionsResponseValuesItems0) Validate(formats strfmt.Registry) err } func (m *TransactionsResponseValuesItems0) validateCart(formats strfmt.Registry) error { - if swag.IsZero(m.Cart) { // not required return nil } @@ -339,7 +424,6 @@ func (m *TransactionsResponseValuesItems0) validateCart(formats strfmt.Registry) } func (m *TransactionsResponseValuesItems0) validateDeleteNote(formats strfmt.Registry) error { - if swag.IsZero(m.DeleteNote) { // not required return nil } @@ -357,7 +441,6 @@ func (m *TransactionsResponseValuesItems0) validateDeleteNote(formats strfmt.Reg } func (m *TransactionsResponseValuesItems0) validateDeliveryAddress(formats strfmt.Registry) error { - if swag.IsZero(m.DeliveryAddress) { // not required return nil } @@ -375,7 +458,6 @@ func (m *TransactionsResponseValuesItems0) validateDeliveryAddress(formats strfm } func (m *TransactionsResponseValuesItems0) validateMember(formats strfmt.Registry) error { - if swag.IsZero(m.Member) { // not required return nil } @@ -393,7 +475,6 @@ func (m *TransactionsResponseValuesItems0) validateMember(formats strfmt.Registr } func (m *TransactionsResponseValuesItems0) validateMemberSignature(formats strfmt.Registry) error { - if swag.IsZero(m.MemberSignature) { // not required return nil } @@ -411,7 +492,6 @@ func (m *TransactionsResponseValuesItems0) validateMemberSignature(formats strfm } func (m *TransactionsResponseValuesItems0) validateNote(formats strfmt.Registry) error { - if swag.IsZero(m.Note) { // not required return nil } @@ -429,7 +509,6 @@ func (m *TransactionsResponseValuesItems0) validateNote(formats strfmt.Registry) } func (m *TransactionsResponseValuesItems0) validatePaymentCardPayments(formats strfmt.Registry) error { - if swag.IsZero(m.PaymentCardPayments) { // not required return nil } @@ -454,7 +533,6 @@ func (m *TransactionsResponseValuesItems0) validatePaymentCardPayments(formats s } func (m *TransactionsResponseValuesItems0) validateSeller(formats strfmt.Registry) error { - if swag.IsZero(m.Seller) { // not required return nil } @@ -471,6 +549,164 @@ func (m *TransactionsResponseValuesItems0) validateSeller(formats strfmt.Registr return nil } +// ContextValidate validate this transactions response values items0 based on the context it is used +func (m *TransactionsResponseValuesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCart(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDeleteNote(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDeliveryAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMember(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemberSignature(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNote(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePaymentCardPayments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSeller(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidateCart(ctx context.Context, formats strfmt.Registry) error { + + if m.Cart != nil { + if err := m.Cart.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidateDeleteNote(ctx context.Context, formats strfmt.Registry) error { + + if m.DeleteNote != nil { + if err := m.DeleteNote.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deleteNote") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidateDeliveryAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.DeliveryAddress != nil { + if err := m.DeliveryAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deliveryAddress") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidateMember(ctx context.Context, formats strfmt.Registry) error { + + if m.Member != nil { + if err := m.Member.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("member") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidateMemberSignature(ctx context.Context, formats strfmt.Registry) error { + + if m.MemberSignature != nil { + if err := m.MemberSignature.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memberSignature") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidateNote(ctx context.Context, formats strfmt.Registry) error { + + if m.Note != nil { + if err := m.Note.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("note") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidatePaymentCardPayments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PaymentCardPayments); i++ { + + if m.PaymentCardPayments[i] != nil { + if err := m.PaymentCardPayments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("paymentCardPayments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0) contextValidateSeller(ctx context.Context, formats strfmt.Registry) error { + + if m.Seller != nil { + if err := m.Seller.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("seller") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -495,87 +731,114 @@ func (m *TransactionsResponseValuesItems0) UnmarshalBinary(b []byte) error { type TransactionsResponseValuesItems0Cart struct { // adjustment amount + // Example: 0 AdjustmentAmount float64 `json:"adjustmentAmount,omitempty"` // after tax discount + // Example: 0 AfterTaxDiscount float64 `json:"afterTaxDiscount,omitempty"` // applied after tax discount + // Example: 0 AppliedAfterTaxDiscount float64 `json:"appliedAfterTaxDiscount,omitempty"` // balance due + // Example: 0 BalanceDue float64 `json:"balanceDue,omitempty"` // calc cart discount + // Example: 0 CalcCartDiscount float64 `json:"calcCartDiscount,omitempty"` // cash received + // Example: 120 CashReceived float64 `json:"cashReceived,omitempty"` // change due + // Example: -4.92 ChangeDue float64 `json:"changeDue,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: MedicinalThirdParty ConsumerType string `json:"consumerType,omitempty"` // created + // Example: 1556055323017 Created int64 `json:"created,omitempty"` // credit card fee + // Example: 0 CreditCardFee float64 `json:"creditCardFee,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // delivery discount + // Example: 0 DeliveryDiscount float64 `json:"deliveryDiscount,omitempty"` // delivery discount type + // Example: Cash DeliveryDiscountType string `json:"deliveryDiscountType,omitempty"` // delivery fee + // Example: 0 DeliveryFee float64 `json:"deliveryFee,omitempty"` // delivery promotion Id + // Example: string DeliveryPromotionID string `json:"deliveryPromotionId,omitempty"` // discount + // Example: 0 Discount float64 `json:"discount,omitempty"` // discount type + // Example: Percentage DiscountType string `json:"discountType,omitempty"` // enable credit card fee + // Example: false EnableCreditCardFee bool `json:"enableCreditCardFee,omitempty"` // enable delivery fee + // Example: false EnableDeliveryFee bool `json:"enableDeliveryFee,omitempty"` // final refund amt + // Example: 0 FinalRefundAmt float64 `json:"finalRefundAmt,omitempty"` // id + // Example: 5cbf851b33b485082543b7a2 ID string `json:"id,omitempty"` // items Items []*TransactionsResponseValuesItems0CartItemsItems0 `json:"items"` // modified + // Example: 1556066737710 Modified int64 `json:"modified,omitempty"` // payment option + // Example: Cash PaymentOption string `json:"paymentOption,omitempty"` // payment type + // Example: Full PaymentType string `json:"paymentType,omitempty"` // point spent + // Example: 0 PointSpent float64 `json:"pointSpent,omitempty"` // promo code + // Example: string PromoCode string `json:"promoCode,omitempty"` // promotion req logs @@ -585,30 +848,38 @@ type TransactionsResponseValuesItems0Cart struct { PromotionReqs []*TransactionsResponseValuesItems0CartPromotionReqsItems0 `json:"promotionReqs"` // refund amount + // Example: 0 RefundAmount float64 `json:"refundAmount,omitempty"` // refund option + // Example: Void RefundOption string `json:"refundOption,omitempty"` // refund order item requests RefundOrderItemRequests []*TransactionsResponseValuesItems0CartRefundOrderItemRequestsItems0 `json:"refundOrderItemRequests"` // request refund amt + // Example: 0 RequestRefundAmt float64 `json:"requestRefundAmt,omitempty"` // round amt + // Example: 0 RoundAmt float64 `json:"roundAmt,omitempty"` // storage location + // Example: CashDrawer StorageLocation string `json:"storageLocation,omitempty"` // sub total + // Example: 90 SubTotal float64 `json:"subTotal,omitempty"` // sub total discount + // Example: 90 SubTotalDiscount float64 `json:"subTotalDiscount,omitempty"` // tax + // Example: 0.08 Tax float64 `json:"tax,omitempty"` // tax result @@ -618,24 +889,31 @@ type TransactionsResponseValuesItems0Cart struct { TaxTable *TransactionsResponseValuesItems0CartTaxTable `json:"taxTable,omitempty"` // total + // Example: 115.08 Total float64 `json:"total,omitempty"` // total a l excise tax + // Example: 0 TotalALExciseTax float64 `json:"totalALExciseTax,omitempty"` // total calc tax + // Example: 25.08 TotalCalcTax float64 `json:"totalCalcTax,omitempty"` // total discount + // Example: 0 TotalDiscount float64 `json:"totalDiscount,omitempty"` // total excise tax + // Example: 0 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -674,7 +952,6 @@ func (m *TransactionsResponseValuesItems0Cart) Validate(formats strfmt.Registry) } func (m *TransactionsResponseValuesItems0Cart) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -699,7 +976,6 @@ func (m *TransactionsResponseValuesItems0Cart) validateItems(formats strfmt.Regi } func (m *TransactionsResponseValuesItems0Cart) validatePromotionReqLogs(formats strfmt.Registry) error { - if swag.IsZero(m.PromotionReqLogs) { // not required return nil } @@ -724,7 +1000,6 @@ func (m *TransactionsResponseValuesItems0Cart) validatePromotionReqLogs(formats } func (m *TransactionsResponseValuesItems0Cart) validatePromotionReqs(formats strfmt.Registry) error { - if swag.IsZero(m.PromotionReqs) { // not required return nil } @@ -749,7 +1024,6 @@ func (m *TransactionsResponseValuesItems0Cart) validatePromotionReqs(formats str } func (m *TransactionsResponseValuesItems0Cart) validateRefundOrderItemRequests(formats strfmt.Registry) error { - if swag.IsZero(m.RefundOrderItemRequests) { // not required return nil } @@ -774,7 +1048,6 @@ func (m *TransactionsResponseValuesItems0Cart) validateRefundOrderItemRequests(f } func (m *TransactionsResponseValuesItems0Cart) validateTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.TaxResult) { // not required return nil } @@ -792,7 +1065,6 @@ func (m *TransactionsResponseValuesItems0Cart) validateTaxResult(formats strfmt. } func (m *TransactionsResponseValuesItems0Cart) validateTaxTable(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTable) { // not required return nil } @@ -809,6 +1081,140 @@ func (m *TransactionsResponseValuesItems0Cart) validateTaxTable(formats strfmt.R return nil } +// ContextValidate validate this transactions response values items0 cart based on the context it is used +func (m *TransactionsResponseValuesItems0Cart) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePromotionReqLogs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePromotionReqs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRefundOrderItemRequests(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTable(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0Cart) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Cart) contextValidatePromotionReqLogs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PromotionReqLogs); i++ { + + if m.PromotionReqLogs[i] != nil { + if err := m.PromotionReqLogs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "promotionReqLogs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Cart) contextValidatePromotionReqs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PromotionReqs); i++ { + + if m.PromotionReqs[i] != nil { + if err := m.PromotionReqs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "promotionReqs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Cart) contextValidateRefundOrderItemRequests(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.RefundOrderItemRequests); i++ { + + if m.RefundOrderItemRequests[i] != nil { + if err := m.RefundOrderItemRequests[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "refundOrderItemRequests" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Cart) contextValidateTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxResult != nil { + if err := m.TaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxResult") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Cart) contextValidateTaxTable(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxTable != nil { + if err := m.TaxTable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0Cart) MarshalBinary() ([]byte, error) { if m == nil { @@ -833,126 +1239,165 @@ func (m *TransactionsResponseValuesItems0Cart) UnmarshalBinary(b []byte) error { type TransactionsResponseValuesItems0CartItemsItems0 struct { // available discount qty + // Example: 0 AvailableDiscountQty float64 `json:"availableDiscountQty,omitempty"` // batch Id + // Example: 5c9fe425e0faca07db94b990 BatchID string `json:"batchId,omitempty"` // batch sku + // Example: 0 BatchSku string `json:"batchSku,omitempty"` // calc cultivation tax + // Example: 0 CalcCultivationTax float64 `json:"calcCultivationTax,omitempty"` // calc discount + // Example: 0 CalcDiscount float64 `json:"calcDiscount,omitempty"` // calc pre tax + // Example: 0 CalcPreTax float64 `json:"calcPreTax,omitempty"` // calc tax + // Example: 8.3147 CalcTax float64 `json:"calcTax,omitempty"` // cogs + // Example: 69.1 Cogs float64 `json:"cogs,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // cost + // Example: 45 Cost float64 `json:"cost,omitempty"` // created + // Example: 1556055338248 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // discount + // Example: 0 Discount float64 `json:"discount,omitempty"` // discount type + // Example: Cash DiscountType string `json:"discountType,omitempty"` // discounted qty + // Example: 0 DiscountedQty float64 `json:"discountedQty,omitempty"` // exchange amount + // Example: 0 ExchangeAmount float64 `json:"exchangeAmount,omitempty"` // exchange qty + // Example: 0 ExchangeQty float64 `json:"exchangeQty,omitempty"` // excise tax + // Example: 0.7135 ExciseTax float64 `json:"exciseTax,omitempty"` // final price + // Example: 45 FinalPrice float64 `json:"finalPrice,omitempty"` // finalized + // Example: false Finalized bool `json:"finalized,omitempty"` // fulfilled + // Example: true Fulfilled bool `json:"fulfilled,omitempty"` // id + // Example: 5cbf852a1d5dbc081de754fa ID string `json:"id,omitempty"` // ignore mix match + // Example: false IgnoreMixMatch bool `json:"ignoreMixMatch,omitempty"` // mix matched + // Example: false MixMatched bool `json:"mixMatched,omitempty"` // modified + // Example: 1556066737723 Modified int64 `json:"modified,omitempty"` // order item Id + // Example: 6c569a3e-1641-46ed-a0cd-7a5eed7064a7 OrderItemID string `json:"orderItemId,omitempty"` // orig quantity + // Example: 1 OrigQuantity float64 `json:"origQuantity,omitempty"` // override price + // Example: 0 OverridePrice float64 `json:"overridePrice,omitempty"` // per unit refund amt + // Example: 0 PerUnitRefundAmt float64 `json:"perUnitRefundAmt,omitempty"` // prepackage + // Example: 5c9fe425e0faca07db94b990 Prepackage string `json:"prepackage,omitempty"` // prepackage Id + // Example: 5c9fe425e0faca07db94b990 PrepackageID string `json:"prepackageId,omitempty"` // prepackage item Id + // Example: 5c9fe425e0faca07db94b990 PrepackageItemID string `json:"prepackageItemId,omitempty"` // prepackage product item + // Example: 5c9fe425e0faca07db94b990 PrepackageProductItem string `json:"prepackageProductItem,omitempty"` // prepared qty + // Example: 0 PreparedQty float64 `json:"preparedQty,omitempty"` // product + // Example: 0 Product float64 `json:"product,omitempty"` // product Id + // Example: 5cbb4dec90427708240820c3 ProductID string `json:"productId,omitempty"` // promotion reqs PromotionReqs []*TransactionsResponseValuesItems0CartItemsItems0PromotionReqsItems0 `json:"promotionReqs"` // quantity + // Example: 1 Quantity float64 `json:"quantity,omitempty"` // quantity logs QuantityLogs []*TransactionsResponseValuesItems0CartItemsItems0QuantityLogsItems0 `json:"quantityLogs"` // status + // Example: Active Status string `json:"status,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax result @@ -962,30 +1407,39 @@ type TransactionsResponseValuesItems0CartItemsItems0 struct { TaxTable *TransactionsResponseValuesItems0CartItemsItems0TaxTable `json:"taxTable,omitempty"` // tax type + // Example: Inherit TaxType string `json:"taxType,omitempty"` // total refund amount + // Example: 0 TotalRefundAmount float64 `json:"totalRefundAmount,omitempty"` // total refund qty + // Example: 1 TotalRefundQty float64 `json:"totalRefundQty,omitempty"` // txn line ID + // Example: 0 TxnLineID float64 `json:"txnLineID,omitempty"` // unit price + // Example: 45 UnitPrice float64 `json:"unitPrice,omitempty"` // unit qty + // Example: 0 UnitQty float64 `json:"unitQty,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // use unit qty + // Example: false UseUnitQty bool `json:"useUnitQty,omitempty"` // weight key + // Example: UNIT WeightKey string `json:"weightKey,omitempty"` } @@ -1016,7 +1470,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0) Validate(formats strfm } func (m *TransactionsResponseValuesItems0CartItemsItems0) validatePromotionReqs(formats strfmt.Registry) error { - if swag.IsZero(m.PromotionReqs) { // not required return nil } @@ -1041,7 +1494,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0) validatePromotionReqs( } func (m *TransactionsResponseValuesItems0CartItemsItems0) validateQuantityLogs(formats strfmt.Registry) error { - if swag.IsZero(m.QuantityLogs) { // not required return nil } @@ -1066,7 +1518,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0) validateQuantityLogs(f } func (m *TransactionsResponseValuesItems0CartItemsItems0) validateTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.TaxResult) { // not required return nil } @@ -1084,7 +1535,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0) validateTaxResult(form } func (m *TransactionsResponseValuesItems0CartItemsItems0) validateTaxTable(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTable) { // not required return nil } @@ -1101,6 +1551,96 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0) validateTaxTable(forma return nil } +// ContextValidate validate this transactions response values items0 cart items items0 based on the context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePromotionReqs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQuantityLogs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTable(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0) contextValidatePromotionReqs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PromotionReqs); i++ { + + if m.PromotionReqs[i] != nil { + if err := m.PromotionReqs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("promotionReqs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0) contextValidateQuantityLogs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.QuantityLogs); i++ { + + if m.QuantityLogs[i] != nil { + if err := m.QuantityLogs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quantityLogs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0) contextValidateTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxResult != nil { + if err := m.TaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxResult") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0) contextValidateTaxTable(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxTable != nil { + if err := m.TaxTable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1125,27 +1665,35 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0) UnmarshalBinary(b []by type TransactionsResponseValuesItems0CartItemsItems0PromotionReqsItems0 struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556440873514 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cc567291d31b9081bed54fa ID string `json:"id,omitempty"` // modified + // Example: 1556440873514 Modified int64 `json:"modified,omitempty"` // promotion Id + // Example: 5cc521e25fecd30808bc1c97 PromotionID string `json:"promotionId,omitempty"` // reward Id + // Example: 5c9fe425e0faca07db94b990 RewardID string `json:"rewardId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1154,6 +1702,11 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0PromotionReqsItems0) Val return nil } +// ContextValidate validates this transactions response values items0 cart items items0 promotion reqs items0 based on context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0PromotionReqsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0PromotionReqsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1178,18 +1731,23 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0PromotionReqsItems0) Unm type TransactionsResponseValuesItems0CartItemsItems0QuantityLogsItems0 struct { // batch Id + // Example: 5cbea8d5f3a077080f237ce3 BatchID string `json:"batchId,omitempty"` // id + // Example: 6c569a3e-1641-46ed-a0cd-7a5eed7064a7_5c9fe425e0faca07db94b990_5cbea8d5f3a077080f237ce3 ID string `json:"id,omitempty"` // inventory Id + // Example: 5c9fe425e0faca07db94b990 InventoryID string `json:"inventoryId,omitempty"` // prepackage item Id + // Example: 5c9fe425e0faca07db94b990 PrepackageItemID string `json:"prepackageItemId,omitempty"` // quantity + // Example: 1 Quantity float64 `json:"quantity,omitempty"` } @@ -1198,6 +1756,11 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0QuantityLogsItems0) Vali return nil } +// ContextValidate validates this transactions response values items0 cart items items0 quantity logs items0 based on context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0QuantityLogsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0QuantityLogsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1222,63 +1785,82 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0QuantityLogsItems0) Unma type TransactionsResponseValuesItems0CartItemsItems0TaxResult struct { // created + // Example: 1556066737751 Created int64 `json:"created,omitempty"` // cultivation tax result CultivationTaxResult *TransactionsResponseValuesItems0CartItemsItems0TaxResultCultivationTaxResult `json:"cultivationTaxResult,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbfb1b176dded08124111a8 ID string `json:"id,omitempty"` // modified + // Example: 1556066737751 Modified int64 `json:"modified,omitempty"` // total a l excise tax + // Example: 4.224 TotalALExciseTax float64 `json:"totalALExciseTax,omitempty"` // total a l post excise tax + // Example: 4.224 TotalALPostExciseTax float64 `json:"totalALPostExciseTax,omitempty"` // total city pre tax + // Example: 0 TotalCityPreTax float64 `json:"totalCityPreTax,omitempty"` // total city tax + // Example: 4.9224 TotalCityTax float64 `json:"totalCityTax,omitempty"` // total county pre tax + // Example: 0 TotalCountyPreTax float64 `json:"totalCountyPreTax,omitempty"` // total county tax + // Example: 0.1354 TotalCountyTax float64 `json:"totalCountyTax,omitempty"` // total excise tax + // Example: 0 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // total fed pre tax + // Example: 0 TotalFedPreTax float64 `json:"totalFedPreTax,omitempty"` // total fed tax + // Example: 0 TotalFedTax float64 `json:"totalFedTax,omitempty"` // total n a l pre excise tax + // Example: 0 TotalNALPreExciseTax float64 `json:"totalNALPreExciseTax,omitempty"` // total post calc tax + // Example: 8.3147 TotalPostCalcTax float64 `json:"totalPostCalcTax,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // total state pre tax + // Example: 0 TotalStatePreTax float64 `json:"totalStatePreTax,omitempty"` // total state tax + // Example: 3.2569 TotalStateTax float64 `json:"totalStateTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1297,7 +1879,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResult) Validate(form } func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResult) validateCultivationTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.CultivationTaxResult) { // not required return nil } @@ -1314,6 +1895,34 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResult) validateCulti return nil } +// ContextValidate validate this transactions response values items0 cart items items0 tax result based on the context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCultivationTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResult) contextValidateCultivationTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.CultivationTaxResult != nil { + if err := m.CultivationTaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxResult" + "." + "cultivationTaxResult") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1338,24 +1947,31 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResult) UnmarshalBina type TransactionsResponseValuesItems0CartItemsItems0TaxResultCultivationTaxResult struct { // flower tax oz + // Example: 0 FlowerTaxOz float64 `json:"flowerTaxOz,omitempty"` // leaf tax oz + // Example: 0 LeafTaxOz float64 `json:"leafTaxOz,omitempty"` // total cultivation tax + // Example: 0 TotalCultivationTax float64 `json:"totalCultivationTax,omitempty"` // total flower oz + // Example: 0 TotalFlowerOz float64 `json:"totalFlowerOz,omitempty"` // total flower tax + // Example: 0 TotalFlowerTax float64 `json:"totalFlowerTax,omitempty"` // total leaf oz + // Example: 0 TotalLeafOz float64 `json:"totalLeafOz,omitempty"` // total leaf tax + // Example: 0 TotalLeafTax float64 `json:"totalLeafTax,omitempty"` } @@ -1364,6 +1980,11 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResultCultivationTaxR return nil } +// ContextValidate validates this transactions response values items0 cart items items0 tax result cultivation tax result based on context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResultCultivationTaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResultCultivationTaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -1388,54 +2009,67 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxResultCultivationTaxR type TransactionsResponseValuesItems0CartItemsItems0TaxTable struct { // active + // Example: false Active bool `json:"active,omitempty"` // city tax CityTax *TransactionsResponseValuesItems0CartItemsItems0TaxTableCityTax `json:"cityTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: MedicinalThirdParty ConsumerType string `json:"consumerType,omitempty"` // county tax CountyTax *TransactionsResponseValuesItems0CartItemsItems0TaxTableCountyTax `json:"countyTax,omitempty"` // created + // Example: 1556066737751 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // federal tax FederalTax *TransactionsResponseValuesItems0CartItemsItems0TaxTableFederalTax `json:"federalTax,omitempty"` // id + // Example: 5cbfb1b176dded08124111a9 ID string `json:"id,omitempty"` // modified + // Example: 1556066737751 Modified int64 `json:"modified,omitempty"` // name + // Example: Medicinal - Third Party Name string `json:"name,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // state tax StateTax *TransactionsResponseValuesItems0CartItemsItems0TaxTableStateTax `json:"stateTax,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax type + // Example: Custom TaxType string `json:"taxType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1466,7 +2100,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) Validate(forma } func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateCityTax(formats strfmt.Registry) error { - if swag.IsZero(m.CityTax) { // not required return nil } @@ -1484,7 +2117,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateCityTa } func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateCountyTax(formats strfmt.Registry) error { - if swag.IsZero(m.CountyTax) { // not required return nil } @@ -1502,7 +2134,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateCounty } func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateFederalTax(formats strfmt.Registry) error { - if swag.IsZero(m.FederalTax) { // not required return nil } @@ -1520,7 +2151,6 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateFedera } func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateStateTax(formats strfmt.Registry) error { - if swag.IsZero(m.StateTax) { // not required return nil } @@ -1537,6 +2167,88 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) validateStateT return nil } +// ContextValidate validate this transactions response values items0 cart items items0 tax table based on the context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCityTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountyTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFederalTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStateTax(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) contextValidateCityTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CityTax != nil { + if err := m.CityTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "cityTax") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) contextValidateCountyTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CountyTax != nil { + if err := m.CountyTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "countyTax") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) contextValidateFederalTax(ctx context.Context, formats strfmt.Registry) error { + + if m.FederalTax != nil { + if err := m.FederalTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "federalTax") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) contextValidateStateTax(ctx context.Context, formats strfmt.Registry) error { + + if m.StateTax != nil { + if err := m.StateTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxTable" + "." + "stateTax") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) MarshalBinary() ([]byte, error) { if m == nil { @@ -1561,45 +2273,59 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTable) UnmarshalBinar type TransactionsResponseValuesItems0CartItemsItems0TaxTableCityTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737751 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111aa ID string `json:"id,omitempty"` // modified + // Example: 1556066737751 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 10 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: City Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1608,6 +2334,11 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCityTax) Validat return nil } +// ContextValidate validates this transactions response values items0 cart items items0 tax table city tax based on context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCityTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCityTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1632,45 +2363,59 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCityTax) Unmarsh type TransactionsResponseValuesItems0CartItemsItems0TaxTableCountyTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737751 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111ab ID string `json:"id,omitempty"` // modified + // Example: 1556066737751 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0.25 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: County Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1679,6 +2424,11 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCountyTax) Valid return nil } +// ContextValidate validates this transactions response values items0 cart items items0 tax table county tax based on context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCountyTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCountyTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1703,45 +2453,59 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableCountyTax) Unmar type TransactionsResponseValuesItems0CartItemsItems0TaxTableFederalTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737751 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111ad ID string `json:"id,omitempty"` // modified + // Example: 1556066737751 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: Federal Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1750,6 +2514,11 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableFederalTax) Vali return nil } +// ContextValidate validates this transactions response values items0 cart items items0 tax table federal tax based on context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableFederalTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableFederalTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1774,45 +2543,59 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableFederalTax) Unma type TransactionsResponseValuesItems0CartItemsItems0TaxTableStateTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737751 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111ac ID string `json:"id,omitempty"` // modified + // Example: 1556066737751 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 6 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: State Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1821,6 +2604,11 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableStateTax) Valida return nil } +// ContextValidate validates this transactions response values items0 cart items items0 tax table state tax based on context it is used +func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableStateTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableStateTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -1845,33 +2633,43 @@ func (m *TransactionsResponseValuesItems0CartItemsItems0TaxTableStateTax) Unmars type TransactionsResponseValuesItems0CartPromotionReqLogsItems0 struct { // amount + // Example: 12 Amount float64 `json:"amount,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556233486913 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cc23d0efbbb0e08264c3cc7 ID string `json:"id,omitempty"` // modified + // Example: 1556233486913 Modified int64 `json:"modified,omitempty"` // promotion Id + // Example: 5cbf6612e0faca07f6364ed1 PromotionID string `json:"promotionId,omitempty"` // promotion type + // Example: Cart PromotionType string `json:"promotionType,omitempty"` // reward Id + // Example: string RewardID string `json:"rewardId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1880,6 +2678,11 @@ func (m *TransactionsResponseValuesItems0CartPromotionReqLogsItems0) Validate(fo return nil } +// ContextValidate validates this transactions response values items0 cart promotion req logs items0 based on context it is used +func (m *TransactionsResponseValuesItems0CartPromotionReqLogsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartPromotionReqLogsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1904,27 +2707,35 @@ func (m *TransactionsResponseValuesItems0CartPromotionReqLogsItems0) UnmarshalBi type TransactionsResponseValuesItems0CartPromotionReqsItems0 struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556233486896 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cc23d0efbbb0e08264c3cc2 ID string `json:"id,omitempty"` // modified + // Example: 1556233486896 Modified int64 `json:"modified,omitempty"` // promotion Id + // Example: 5cbf6612e0faca07f6364ed1 PromotionID string `json:"promotionId,omitempty"` // reward Id + // Example: string RewardID string `json:"rewardId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -1933,6 +2744,11 @@ func (m *TransactionsResponseValuesItems0CartPromotionReqsItems0) Validate(forma return nil } +// ContextValidate validates this transactions response values items0 cart promotion reqs items0 based on context it is used +func (m *TransactionsResponseValuesItems0CartPromotionReqsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartPromotionReqsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1957,12 +2773,15 @@ func (m *TransactionsResponseValuesItems0CartPromotionReqsItems0) UnmarshalBinar type TransactionsResponseValuesItems0CartRefundOrderItemRequestsItems0 struct { // order item Id + // Example: 6c569a3e-1641-46ed-a0cd-7a5eed7064a7 OrderItemID string `json:"orderItemId,omitempty"` // quantity + // Example: 1 Quantity float64 `json:"quantity,omitempty"` // refund amt + // Example: 45 RefundAmt float64 `json:"refundAmt,omitempty"` } @@ -1971,6 +2790,11 @@ func (m *TransactionsResponseValuesItems0CartRefundOrderItemRequestsItems0) Vali return nil } +// ContextValidate validates this transactions response values items0 cart refund order item requests items0 based on context it is used +func (m *TransactionsResponseValuesItems0CartRefundOrderItemRequestsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartRefundOrderItemRequestsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -1995,63 +2819,82 @@ func (m *TransactionsResponseValuesItems0CartRefundOrderItemRequestsItems0) Unma type TransactionsResponseValuesItems0CartTaxResult struct { // created + // Example: 1556066737751 Created int64 `json:"created,omitempty"` // cultivation tax result CultivationTaxResult *TransactionsResponseValuesItems0CartTaxResultCultivationTaxResult `json:"cultivationTaxResult,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbfb1b176dded08124111b4 ID string `json:"id,omitempty"` // modified + // Example: 1556066737751 Modified int64 `json:"modified,omitempty"` // total a l excise tax + // Example: 0 TotalALExciseTax float64 `json:"totalALExciseTax,omitempty"` // total a l post excise tax + // Example: 8.45 TotalALPostExciseTax float64 `json:"totalALPostExciseTax,omitempty"` // total city pre tax + // Example: 0 TotalCityPreTax float64 `json:"totalCityPreTax,omitempty"` // total city tax + // Example: 9.84 TotalCityTax float64 `json:"totalCityTax,omitempty"` // total county pre tax + // Example: 0 TotalCountyPreTax float64 `json:"totalCountyPreTax,omitempty"` // total county tax + // Example: 0.27 TotalCountyTax float64 `json:"totalCountyTax,omitempty"` // total excise tax + // Example: 0 TotalExciseTax float64 `json:"totalExciseTax,omitempty"` // total fed pre tax + // Example: 0 TotalFedPreTax float64 `json:"totalFedPreTax,omitempty"` // total fed tax + // Example: 0 TotalFedTax float64 `json:"totalFedTax,omitempty"` // total n a l pre excise tax + // Example: 0 TotalNALPreExciseTax float64 `json:"totalNALPreExciseTax,omitempty"` // total post calc tax + // Example: 25.08 TotalPostCalcTax float64 `json:"totalPostCalcTax,omitempty"` // total pre calc tax + // Example: 0 TotalPreCalcTax float64 `json:"totalPreCalcTax,omitempty"` // total state pre tax + // Example: 0 TotalStatePreTax float64 `json:"totalStatePreTax,omitempty"` // total state tax + // Example: 6.51 TotalStateTax float64 `json:"totalStateTax,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2070,7 +2913,6 @@ func (m *TransactionsResponseValuesItems0CartTaxResult) Validate(formats strfmt. } func (m *TransactionsResponseValuesItems0CartTaxResult) validateCultivationTaxResult(formats strfmt.Registry) error { - if swag.IsZero(m.CultivationTaxResult) { // not required return nil } @@ -2087,6 +2929,34 @@ func (m *TransactionsResponseValuesItems0CartTaxResult) validateCultivationTaxRe return nil } +// ContextValidate validate this transactions response values items0 cart tax result based on the context it is used +func (m *TransactionsResponseValuesItems0CartTaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCultivationTaxResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0CartTaxResult) contextValidateCultivationTaxResult(ctx context.Context, formats strfmt.Registry) error { + + if m.CultivationTaxResult != nil { + if err := m.CultivationTaxResult.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxResult" + "." + "cultivationTaxResult") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartTaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -2111,24 +2981,31 @@ func (m *TransactionsResponseValuesItems0CartTaxResult) UnmarshalBinary(b []byte type TransactionsResponseValuesItems0CartTaxResultCultivationTaxResult struct { // flower tax oz + // Example: 0 FlowerTaxOz float64 `json:"flowerTaxOz,omitempty"` // leaf tax oz + // Example: 0 LeafTaxOz float64 `json:"leafTaxOz,omitempty"` // total cultivation tax + // Example: 0 TotalCultivationTax float64 `json:"totalCultivationTax,omitempty"` // total flower oz + // Example: 0 TotalFlowerOz float64 `json:"totalFlowerOz,omitempty"` // total flower tax + // Example: 0 TotalFlowerTax float64 `json:"totalFlowerTax,omitempty"` // total leaf oz + // Example: 0 TotalLeafOz float64 `json:"totalLeafOz,omitempty"` // total leaf tax + // Example: 0 TotalLeafTax float64 `json:"totalLeafTax,omitempty"` } @@ -2137,6 +3014,11 @@ func (m *TransactionsResponseValuesItems0CartTaxResultCultivationTaxResult) Vali return nil } +// ContextValidate validates this transactions response values items0 cart tax result cultivation tax result based on context it is used +func (m *TransactionsResponseValuesItems0CartTaxResultCultivationTaxResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartTaxResultCultivationTaxResult) MarshalBinary() ([]byte, error) { if m == nil { @@ -2161,54 +3043,67 @@ func (m *TransactionsResponseValuesItems0CartTaxResultCultivationTaxResult) Unma type TransactionsResponseValuesItems0CartTaxTable struct { // active + // Example: false Active bool `json:"active,omitempty"` // city tax CityTax *TransactionsResponseValuesItems0CartTaxTableCityTax `json:"cityTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: MedicinalThirdParty ConsumerType string `json:"consumerType,omitempty"` // county tax CountyTax *TransactionsResponseValuesItems0CartTaxTableCountyTax `json:"countyTax,omitempty"` // created + // Example: 1556066737713 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // federal tax FederalTax *TransactionsResponseValuesItems0CartTaxTableFederalTax `json:"federalTax,omitempty"` // id + // Example: 5cbfb1b176dded08124111a1 ID string `json:"id,omitempty"` // modified + // Example: 1556066737713 Modified int64 `json:"modified,omitempty"` // name + // Example: Medicinal - Third Party Name string `json:"name,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // state tax StateTax *TransactionsResponseValuesItems0CartTaxTableStateTax `json:"stateTax,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax type + // Example: Custom TaxType string `json:"taxType,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2239,7 +3134,6 @@ func (m *TransactionsResponseValuesItems0CartTaxTable) Validate(formats strfmt.R } func (m *TransactionsResponseValuesItems0CartTaxTable) validateCityTax(formats strfmt.Registry) error { - if swag.IsZero(m.CityTax) { // not required return nil } @@ -2257,7 +3151,6 @@ func (m *TransactionsResponseValuesItems0CartTaxTable) validateCityTax(formats s } func (m *TransactionsResponseValuesItems0CartTaxTable) validateCountyTax(formats strfmt.Registry) error { - if swag.IsZero(m.CountyTax) { // not required return nil } @@ -2275,7 +3168,6 @@ func (m *TransactionsResponseValuesItems0CartTaxTable) validateCountyTax(formats } func (m *TransactionsResponseValuesItems0CartTaxTable) validateFederalTax(formats strfmt.Registry) error { - if swag.IsZero(m.FederalTax) { // not required return nil } @@ -2293,7 +3185,6 @@ func (m *TransactionsResponseValuesItems0CartTaxTable) validateFederalTax(format } func (m *TransactionsResponseValuesItems0CartTaxTable) validateStateTax(formats strfmt.Registry) error { - if swag.IsZero(m.StateTax) { // not required return nil } @@ -2310,6 +3201,88 @@ func (m *TransactionsResponseValuesItems0CartTaxTable) validateStateTax(formats return nil } +// ContextValidate validate this transactions response values items0 cart tax table based on the context it is used +func (m *TransactionsResponseValuesItems0CartTaxTable) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCityTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountyTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFederalTax(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStateTax(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0CartTaxTable) contextValidateCityTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CityTax != nil { + if err := m.CityTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "cityTax") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartTaxTable) contextValidateCountyTax(ctx context.Context, formats strfmt.Registry) error { + + if m.CountyTax != nil { + if err := m.CountyTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "countyTax") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartTaxTable) contextValidateFederalTax(ctx context.Context, formats strfmt.Registry) error { + + if m.FederalTax != nil { + if err := m.FederalTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "federalTax") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0CartTaxTable) contextValidateStateTax(ctx context.Context, formats strfmt.Registry) error { + + if m.StateTax != nil { + if err := m.StateTax.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cart" + "." + "taxTable" + "." + "stateTax") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartTaxTable) MarshalBinary() ([]byte, error) { if m == nil { @@ -2334,45 +3307,59 @@ func (m *TransactionsResponseValuesItems0CartTaxTable) UnmarshalBinary(b []byte) type TransactionsResponseValuesItems0CartTaxTableCityTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737713 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111a2 ID string `json:"id,omitempty"` // modified + // Example: 1556066737713 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 10 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: City Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2381,6 +3368,11 @@ func (m *TransactionsResponseValuesItems0CartTaxTableCityTax) Validate(formats s return nil } +// ContextValidate validates this transactions response values items0 cart tax table city tax based on context it is used +func (m *TransactionsResponseValuesItems0CartTaxTableCityTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartTaxTableCityTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2405,45 +3397,59 @@ func (m *TransactionsResponseValuesItems0CartTaxTableCityTax) UnmarshalBinary(b type TransactionsResponseValuesItems0CartTaxTableCountyTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737713 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111a3 ID string `json:"id,omitempty"` // modified + // Example: 1556066737713 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0.25 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: County Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2452,6 +3458,11 @@ func (m *TransactionsResponseValuesItems0CartTaxTableCountyTax) Validate(formats return nil } +// ContextValidate validates this transactions response values items0 cart tax table county tax based on context it is used +func (m *TransactionsResponseValuesItems0CartTaxTableCountyTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartTaxTableCountyTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2476,45 +3487,59 @@ func (m *TransactionsResponseValuesItems0CartTaxTableCountyTax) UnmarshalBinary( type TransactionsResponseValuesItems0CartTaxTableFederalTax struct { // active + // Example: false Active bool `json:"active,omitempty"` // active excise tax + // Example: false ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: false Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737713 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111a5 ID string `json:"id,omitempty"` // modified + // Example: 1556066737713 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 0 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: Federal Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2523,6 +3548,11 @@ func (m *TransactionsResponseValuesItems0CartTaxTableFederalTax) Validate(format return nil } +// ContextValidate validates this transactions response values items0 cart tax table federal tax based on context it is used +func (m *TransactionsResponseValuesItems0CartTaxTableFederalTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartTaxTableFederalTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2547,45 +3577,59 @@ func (m *TransactionsResponseValuesItems0CartTaxTableFederalTax) UnmarshalBinary type TransactionsResponseValuesItems0CartTaxTableStateTax struct { // active + // Example: true Active bool `json:"active,omitempty"` // active excise tax + // Example: true ActiveExciseTax bool `json:"activeExciseTax,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // compound + // Example: true Compound bool `json:"compound,omitempty"` // created + // Example: 1556066737713 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // id + // Example: 5cbfb1b176dded08124111a4 ID string `json:"id,omitempty"` // modified + // Example: 1556066737713 Modified int64 `json:"modified,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // tax order + // Example: PostTaxed TaxOrder string `json:"taxOrder,omitempty"` // tax rate + // Example: 6 TaxRate float64 `json:"taxRate,omitempty"` // territory + // Example: State Territory string `json:"territory,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2594,6 +3638,11 @@ func (m *TransactionsResponseValuesItems0CartTaxTableStateTax) Validate(formats return nil } +// ContextValidate validates this transactions response values items0 cart tax table state tax based on context it is used +func (m *TransactionsResponseValuesItems0CartTaxTableStateTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0CartTaxTableStateTax) MarshalBinary() ([]byte, error) { if m == nil { @@ -2618,30 +3667,39 @@ func (m *TransactionsResponseValuesItems0CartTaxTableStateTax) UnmarshalBinary(b type TransactionsResponseValuesItems0DeleteNote struct { // created + // Example: 1557363743758 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enable on fleet + // Example: false EnableOnFleet bool `json:"enableOnFleet,omitempty"` // id + // Example: 5cd37c1f819d9e27ca3ed854 ID string `json:"id,omitempty"` // message + // Example: Duplicate Transaction Message string `json:"message,omitempty"` // modified + // Example: 1557363743758 Modified int64 `json:"modified,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // writer Id + // Example: string WriterID string `json:"writerId,omitempty"` // writer name + // Example: string WriterName string `json:"writerName,omitempty"` } @@ -2650,6 +3708,11 @@ func (m *TransactionsResponseValuesItems0DeleteNote) Validate(formats strfmt.Reg return nil } +// ContextValidate validates this transactions response values items0 delete note based on context it is used +func (m *TransactionsResponseValuesItems0DeleteNote) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0DeleteNote) MarshalBinary() ([]byte, error) { if m == nil { @@ -2674,39 +3737,50 @@ func (m *TransactionsResponseValuesItems0DeleteNote) UnmarshalBinary(b []byte) e type TransactionsResponseValuesItems0DeliveryAddress struct { // address + // Example: 25016 River Walk Ln. Address string `json:"address,omitempty"` // address line1 AddressLine1 string `json:"addressLine1,omitempty"` // city + // Example: Santa Clarita City string `json:"city,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1556066737667 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbfb1b176dded081241118e ID string `json:"id,omitempty"` // modified + // Example: 1556066737667 Modified int64 `json:"modified,omitempty"` // state + // Example: CA State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code + // Example: 91383 ZipCode string `json:"zipCode,omitempty"` } @@ -2715,6 +3789,11 @@ func (m *TransactionsResponseValuesItems0DeliveryAddress) Validate(formats strfm return nil } +// ContextValidate validates this transactions response values items0 delivery address based on context it is used +func (m *TransactionsResponseValuesItems0DeliveryAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0DeliveryAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -2742,132 +3821,172 @@ type TransactionsResponseValuesItems0Member struct { Address *TransactionsResponseValuesItems0MemberAddress `json:"address,omitempty"` // agreement expired + // Example: false AgreementExpired bool `json:"agreementExpired,omitempty"` // anonymous + // Example: false Anonymous bool `json:"anonymous,omitempty"` // ban patient + // Example: false BanPatient bool `json:"banPatient,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // consumer type + // Example: AdultUse ConsumerType string `json:"consumerType,omitempty"` // consumer user Id + // Example: 5cd30b53c3226a084423f9ad ConsumerUserID string `json:"consumerUserId,omitempty"` // created + // Example: 1557334153111 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // dl expired + // Example: false DlExpired bool `json:"dlExpired,omitempty"` // dob + // Example: 391158000000 Dob float64 `json:"dob,omitempty"` // email + // Example: rachel_witmer@yahoo.com Email string `json:"email,omitempty"` // email opt in + // Example: true EmailOptIn bool `json:"emailOptIn,omitempty"` // email verified + // Example: false EmailVerified bool `json:"emailVerified,omitempty"` // enable loyalty + // Example: true EnableLoyalty bool `json:"enableLoyalty,omitempty"` // enabled care giver + // Example: false EnabledCareGiver bool `json:"enabledCareGiver,omitempty"` // first name + // Example: Rachel FirstName string `json:"firstName,omitempty"` // id + // Example: 5cd30889e0faca07d2824d83 ID string `json:"id,omitempty"` // identifications Identifications []*TransactionsResponseValuesItems0MemberIdentificationsItems0 `json:"identifications"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // last name + // Example: Whitmer LastName string `json:"lastName,omitempty"` // last visit date + // Example: 1557334153112 LastVisitDate float64 `json:"lastVisitDate,omitempty"` // lifetime points + // Example: 0 LifetimePoints float64 `json:"lifetimePoints,omitempty"` // loyalty points + // Example: 0 LoyaltyPoints float64 `json:"loyaltyPoints,omitempty"` // marketing source + // Example: On Deck MarketingSource string `json:"marketingSource,omitempty"` // medical + // Example: false Medical bool `json:"medical,omitempty"` // member group MemberGroup *TransactionsResponseValuesItems0MemberMemberGroup `json:"memberGroup,omitempty"` // member group Id + // Example: 5c7e8c7b722ed607e61edb25 MemberGroupID string `json:"memberGroupId,omitempty"` // middle name + // Example: string MiddleName string `json:"middleName,omitempty"` // modified + // Example: 1557335083796 Modified int64 `json:"modified,omitempty"` // primary phone + // Example: (630) 294-0678 PrimaryPhone string `json:"primaryPhone,omitempty"` // qb mapping + // Example: string QbMapping string `json:"qbMapping,omitempty"` // recommendation expired + // Example: true RecommendationExpired bool `json:"recommendationExpired,omitempty"` // recommendation expiry left + // Example: 0 RecommendationExpiryLeft float64 `json:"recommendationExpiryLeft,omitempty"` // recommendations Recommendations []*TransactionsResponseValuesItems0MemberRecommendationsItems0 `json:"recommendations"` // region Id + // Example: string RegionID string `json:"regionId,omitempty"` // search text + // Example: rachel whitmer 23708 vía andorra rachel_witmer@yahoo.com (630) 294-0678 delivery SearchText string `json:"searchText,omitempty"` // sex + // Example: 1 Sex float64 `json:"sex,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // start date + // Example: 1557334153112 StartDate float64 `json:"startDate,omitempty"` // status + // Example: Active Status string `json:"status,omitempty"` // text opt in + // Example: true TextOptIn bool `json:"textOptIn,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -2898,7 +4017,6 @@ func (m *TransactionsResponseValuesItems0Member) Validate(formats strfmt.Registr } func (m *TransactionsResponseValuesItems0Member) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -2916,7 +4034,6 @@ func (m *TransactionsResponseValuesItems0Member) validateAddress(formats strfmt. } func (m *TransactionsResponseValuesItems0Member) validateIdentifications(formats strfmt.Registry) error { - if swag.IsZero(m.Identifications) { // not required return nil } @@ -2941,7 +4058,6 @@ func (m *TransactionsResponseValuesItems0Member) validateIdentifications(formats } func (m *TransactionsResponseValuesItems0Member) validateMemberGroup(formats strfmt.Registry) error { - if swag.IsZero(m.MemberGroup) { // not required return nil } @@ -2959,7 +4075,6 @@ func (m *TransactionsResponseValuesItems0Member) validateMemberGroup(formats str } func (m *TransactionsResponseValuesItems0Member) validateRecommendations(formats strfmt.Registry) error { - if swag.IsZero(m.Recommendations) { // not required return nil } @@ -2983,6 +4098,96 @@ func (m *TransactionsResponseValuesItems0Member) validateRecommendations(formats return nil } +// ContextValidate validate this transactions response values items0 member based on the context it is used +func (m *TransactionsResponseValuesItems0Member) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIdentifications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemberGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRecommendations(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0Member) 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("member" + "." + "address") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Member) contextValidateIdentifications(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Identifications); i++ { + + if m.Identifications[i] != nil { + if err := m.Identifications[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("member" + "." + "identifications" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Member) contextValidateMemberGroup(ctx context.Context, formats strfmt.Registry) error { + + if m.MemberGroup != nil { + if err := m.MemberGroup.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("member" + "." + "memberGroup") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Member) contextValidateRecommendations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Recommendations); i++ { + + if m.Recommendations[i] != nil { + if err := m.Recommendations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("member" + "." + "recommendations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0Member) MarshalBinary() ([]byte, error) { if m == nil { @@ -3007,39 +4212,50 @@ func (m *TransactionsResponseValuesItems0Member) UnmarshalBinary(b []byte) error type TransactionsResponseValuesItems0MemberAddress struct { // address + // Example: 23708 Via Andorra Address string `json:"address,omitempty"` // address line1 AddressLine1 string `json:"addressLine1,omitempty"` // city + // Example: Santa Clarita City string `json:"city,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1557335083553 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cd30c2be0faca07d28264a2 ID string `json:"id,omitempty"` // modified + // Example: 1557335083553 Modified int64 `json:"modified,omitempty"` // state + // Example: CA State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code + // Example: 91355 ZipCode string `json:"zipCode,omitempty"` } @@ -3048,6 +4264,11 @@ func (m *TransactionsResponseValuesItems0MemberAddress) Validate(formats strfmt. return nil } +// ContextValidate validates this transactions response values items0 member address based on context it is used +func (m *TransactionsResponseValuesItems0MemberAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0MemberAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -3075,39 +4296,50 @@ type TransactionsResponseValuesItems0MemberIdentificationsItems0 struct { Assets []*TransactionsResponseValuesItems0MemberIdentificationsItems0AssetsItems0 `json:"assets"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1557334153113 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // expiration date + // Example: 1653462000000 ExpirationDate float64 `json:"expirationDate,omitempty"` // front photo FrontPhoto *TransactionsResponseValuesItems0MemberIdentificationsItems0FrontPhoto `json:"frontPhoto,omitempty"` // id + // Example: 5cd30889e0faca07d2824d81 ID string `json:"id,omitempty"` // license number + // Example: B8669788 LicenseNumber string `json:"licenseNumber,omitempty"` // modified + // Example: 1557334153113 Modified int64 `json:"modified,omitempty"` // state + // Example: string State string `json:"state,omitempty"` // type + // Example: string Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // verified + // Example: false Verified bool `json:"verified,omitempty"` } @@ -3130,7 +4362,6 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) Validate(f } func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -3155,7 +4386,6 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) validateAs } func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) validateFrontPhoto(formats strfmt.Registry) error { - if swag.IsZero(m.FrontPhoto) { // not required return nil } @@ -3172,6 +4402,56 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) validateFr return nil } +// ContextValidate validate this transactions response values items0 member identifications items0 based on the context it is used +func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFrontPhoto(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) contextValidateFrontPhoto(ctx context.Context, formats strfmt.Registry) error { + + if m.FrontPhoto != nil { + if err := m.FrontPhoto.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("frontPhoto") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -3196,60 +4476,79 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0) UnmarshalB type TransactionsResponseValuesItems0MemberIdentificationsItems0AssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1557334147632 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cd308830c9ccc081b8a271d ID string `json:"id,omitempty"` // key + // Example: 187ea16f-92cb-44e8-92f9-364efd4a6bff.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1557334147632 Modified int64 `json:"modified,omitempty"` // name + // Example: Screen Shot 2019-05-08 at 9.46.57 AM.png Name string `json:"name,omitempty"` // orig URL + // Example: string OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: string PublicURL string `json:"publicURL,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -3258,6 +4557,11 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0AssetsItems0 return nil } +// ContextValidate validates this transactions response values items0 member identifications items0 assets items0 based on context it is used +func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0AssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0AssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -3282,60 +4586,79 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0AssetsItems0 type TransactionsResponseValuesItems0MemberIdentificationsItems0FrontPhoto struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1557334147632 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cd308830c9ccc081b8a271d ID string `json:"id,omitempty"` // key + // Example: 187ea16f-92cb-44e8-92f9-364efd4a6bff.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1557334147632 Modified int64 `json:"modified,omitempty"` // name + // Example: Screen Shot 2019-05-08 at 9.46.57 AM.png Name string `json:"name,omitempty"` // orig URL + // Example: string OrigURL string `json:"origURL,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: string PublicURL string `json:"publicURL,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/187ea16f-92cb-44e8-92f9-364efd4a6bff-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -3344,6 +4667,11 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0FrontPhoto) return nil } +// ContextValidate validates this transactions response values items0 member identifications items0 front photo based on context it is used +func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0FrontPhoto) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0FrontPhoto) MarshalBinary() ([]byte, error) { if m == nil { @@ -3368,57 +4696,75 @@ func (m *TransactionsResponseValuesItems0MemberIdentificationsItems0FrontPhoto) type TransactionsResponseValuesItems0MemberMemberGroup struct { // active + // Example: true Active bool `json:"active,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1551488486906 Created int64 `json:"created,omitempty"` // default group + // Example: true DefaultGroup bool `json:"defaultGroup,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // discount + // Example: 0 Discount float64 `json:"discount,omitempty"` // discount type + // Example: Percentage DiscountType string `json:"discountType,omitempty"` // enable promotion + // Example: false EnablePromotion bool `json:"enablePromotion,omitempty"` // id + // Example: 5c7e8c7b722ed607e61edb25 ID string `json:"id,omitempty"` // member count + // Example: 144 MemberCount float64 `json:"memberCount,omitempty"` // member count email opt in + // Example: 114 MemberCountEmailOptIn float64 `json:"memberCountEmailOptIn,omitempty"` // member count text opt in + // Example: 109 MemberCountTextOptIn float64 `json:"memberCountTextOptIn,omitempty"` // modified + // Example: 1557333838706 Modified int64 `json:"modified,omitempty"` // name + // Example: Delivery Name string `json:"name,omitempty"` // promotion Id + // Example: 5cc6938d18c8a8081ff8dd0e PromotionID string `json:"promotionId,omitempty"` // shop Id + // Example: 5c7e8c7b722ed607e61edb1d ShopID string `json:"shopId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -3427,6 +4773,11 @@ func (m *TransactionsResponseValuesItems0MemberMemberGroup) Validate(formats str return nil } +// ContextValidate validates this transactions response values items0 member member group based on context it is used +func (m *TransactionsResponseValuesItems0MemberMemberGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0MemberMemberGroup) MarshalBinary() ([]byte, error) { if m == nil { @@ -3451,24 +4802,31 @@ func (m *TransactionsResponseValuesItems0MemberMemberGroup) UnmarshalBinary(b [] type TransactionsResponseValuesItems0MemberRecommendationsItems0 struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1557334153113 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cd30889e0faca07d2824d82 ID string `json:"id,omitempty"` // modified + // Example: 1557334153113 Modified int64 `json:"modified,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // verify method + // Example: MANUAL VerifyMethod string `json:"verifyMethod,omitempty"` } @@ -3477,6 +4835,11 @@ func (m *TransactionsResponseValuesItems0MemberRecommendationsItems0) Validate(f return nil } +// ContextValidate validates this transactions response values items0 member recommendations items0 based on context it is used +func (m *TransactionsResponseValuesItems0MemberRecommendationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0MemberRecommendationsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -3501,48 +4864,63 @@ func (m *TransactionsResponseValuesItems0MemberRecommendationsItems0) UnmarshalB type TransactionsResponseValuesItems0MemberSignature struct { // active + // Example: true Active bool `json:"active,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556066699832 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbfb18ba71c2f082fa6661a ID string `json:"id,omitempty"` // key + // Example: 6efbf882-f4d3-4acb-8723-6da45ef87edf.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-public.s3.amazonaws.com/6efbf882-f4d3-4acb-8723-6da45ef87edf-800x800.png LargeURL string `json:"largeURL,omitempty"` // medium URL + // Example: https://connect-files-public.s3.amazonaws.com/6efbf882-f4d3-4acb-8723-6da45ef87edf-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556066699832 Modified int64 `json:"modified,omitempty"` // name + // Example: file Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // public URL + // Example: https://connect-files-public.s3.amazonaws.com/6efbf882-f4d3-4acb-8723-6da45ef87edf.png PublicURL string `json:"publicURL,omitempty"` // secured + // Example: false Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-public.s3.amazonaws.com/6efbf882-f4d3-4acb-8723-6da45ef87edf-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -3551,6 +4929,11 @@ func (m *TransactionsResponseValuesItems0MemberSignature) Validate(formats strfm return nil } +// ContextValidate validates this transactions response values items0 member signature based on context it is used +func (m *TransactionsResponseValuesItems0MemberSignature) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0MemberSignature) MarshalBinary() ([]byte, error) { if m == nil { @@ -3575,30 +4958,39 @@ func (m *TransactionsResponseValuesItems0MemberSignature) UnmarshalBinary(b []by type TransactionsResponseValuesItems0Note struct { // created + // Example: 1557363743758 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // enable on fleet + // Example: false EnableOnFleet bool `json:"enableOnFleet,omitempty"` // id + // Example: 5cd37c1f819d9e27ca3ed854 ID string `json:"id,omitempty"` // message + // Example: Duplicate Transaction Message string `json:"message,omitempty"` // modified + // Example: 1557363743758 Modified int64 `json:"modified,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // writer Id + // Example: string WriterID string `json:"writerId,omitempty"` // writer name + // Example: string WriterName string `json:"writerName,omitempty"` } @@ -3607,6 +4999,11 @@ func (m *TransactionsResponseValuesItems0Note) Validate(formats strfmt.Registry) return nil } +// ContextValidate validates this transactions response values items0 note based on context it is used +func (m *TransactionsResponseValuesItems0Note) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0Note) MarshalBinary() ([]byte, error) { if m == nil { @@ -3631,39 +5028,51 @@ func (m *TransactionsResponseValuesItems0Note) UnmarshalBinary(b []byte) error { type TransactionsResponseValuesItems0PaymentCardPaymentsItems0 struct { // amount + // Example: 130.92 Amount float64 `json:"amount,omitempty"` // balance + // Example: 19.08 Balance float64 `json:"balance,omitempty"` // created + // Example: 0 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 000ae300b23000dd6000fbc5 ID string `json:"id,omitempty"` // modified + // Example: 0 Modified int64 `json:"modified,omitempty"` // payment card number + // Example: 6058690074011822 PaymentCardNumber string `json:"paymentCardNumber,omitempty"` // processed time + // Example: 1556311867003 ProcessedTime int64 `json:"processedTime,omitempty"` // status + // Example: Paid Status string `json:"status,omitempty"` // status message + // Example: string StatusMessage string `json:"statusMessage,omitempty"` // type + // Example: Linx Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -3672,6 +5081,11 @@ func (m *TransactionsResponseValuesItems0PaymentCardPaymentsItems0) Validate(for return nil } +// ContextValidate validates this transactions response values items0 payment card payments items0 based on context it is used +func (m *TransactionsResponseValuesItems0PaymentCardPaymentsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0PaymentCardPaymentsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -3699,186 +5113,246 @@ type TransactionsResponseValuesItems0Seller struct { Address *TransactionsResponseValuesItems0SellerAddress `json:"address,omitempty"` // assigned + // Example: true Assigned bool `json:"assigned,omitempty"` // assigned employee + // Example: string AssignedEmployee string `json:"assignedEmployee,omitempty"` // assigned terminal Id + // Example: 5c82b3944442190831bca731 AssignedTerminalID string `json:"assignedTerminalId,omitempty"` // can apply custom discount + // Example: false CanApplyCustomDiscount bool `json:"canApplyCustomDiscount,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // create onfleet task + // Example: false CreateOnfleetTask bool `json:"createOnfleetTask,omitempty"` // create tookan task + // Example: false CreateTookanTask bool `json:"createTookanTask,omitempty"` // created + // Example: 1555698469092 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // delivery date + // Example: 0 DeliveryDate float64 `json:"deliveryDate,omitempty"` // disabled + // Example: false Disabled bool `json:"disabled,omitempty"` // dl expiration date + // Example: 2019-06-11 DlExpirationDate string `json:"dlExpirationDate,omitempty"` // drivers license + // Example: Y3467802 DriversLicense string `json:"driversLicense,omitempty"` // email + // Example: ruben.luna7496@gmail.com Email string `json:"email,omitempty"` // error refund time + // Example: 0 ErrorRefundTime int64 `json:"errorRefundTime,omitempty"` // error time + // Example: 0 ErrorTime int64 `json:"errorTime,omitempty"` // first name + // Example: Ruben FirstName string `json:"firstName,omitempty"` // fulfilling fulfillment + // Example: false FulfillingFulfillment bool `json:"fulfillingFulfillment,omitempty"` // id + // Example: 5cba1325e7198807f4ba2a01 ID string `json:"id,omitempty"` // insurance company name + // Example: Progressive InsuranceCompanyName string `json:"insuranceCompanyName,omitempty"` // insurance expire date + // Example: 0 InsuranceExpireDate float64 `json:"insuranceExpireDate,omitempty"` // last name + // Example: Luna LastName string `json:"lastName,omitempty"` // modified + // Example: 1556502543146 Modified int64 `json:"modified,omitempty"` // on fleet task Id + // Example: string OnFleetTaskID string `json:"onFleetTaskId,omitempty"` // on fleet task status + // Example: string OnFleetTaskStatus string `json:"onFleetTaskStatus,omitempty"` // order tags + // Example: ["Delivery"] OrderTags []string `json:"orderTags"` // packed by + // Example: 5cb7b8a94cd84907f646e851 PackedBy string `json:"packedBy,omitempty"` // packed date + // Example: 1556055414943 PackedDate float64 `json:"packedDate,omitempty"` // password + // Example: 1Rheg0qew4Y/sOmTJIn7O9RwhFjCQV4i Password string `json:"password,omitempty"` // paying with payment card + // Example: false PayingWithPaymentCard bool `json:"payingWithPaymentCard,omitempty"` // phone number + // Example: (951) 392-6663 PhoneNumber string `json:"phoneNumber,omitempty"` // pick up date + // Example: 1556055414943 PickUpDate float64 `json:"pickUpDate,omitempty"` // pin + // Example: 8035 Pin string `json:"pin,omitempty"` // prepared by + // Example: 5cb7b8a94cd84907f646e851 PreparedBy string `json:"preparedBy,omitempty"` // prepared date + // Example: 1556055414943 PreparedDate float64 `json:"preparedDate,omitempty"` // preparing fulfillment + // Example: false PreparingFulfillment bool `json:"preparingFulfillment,omitempty"` // qb desktop journal entry ref + // Example: string QbDesktopJournalEntryRef string `json:"qbDesktopJournalEntryRef,omitempty"` // qb desktop refund receipt + // Example: string QbDesktopRefundReceipt string `json:"qbDesktopRefundReceipt,omitempty"` // qb desktop sales ref + // Example: string QbDesktopSalesRef string `json:"qbDesktopSalesRef,omitempty"` // qb errored + // Example: false QbErrored bool `json:"qbErrored,omitempty"` // qb journal entry ref + // Example: string QbJournalEntryRef string `json:"qbJournalEntryRef,omitempty"` // qb refund errored + // Example: false QbRefundErrored bool `json:"qbRefundErrored,omitempty"` // qb refund receipt + // Example: string QbRefundReceipt string `json:"qbRefundReceipt,omitempty"` // qb sales receipt ref + // Example: string QbSalesReceiptRef string `json:"qbSalesReceiptRef,omitempty"` // recent location RecentLocation *TransactionsResponseValuesItems0SellerRecentLocation `json:"recentLocation,omitempty"` // refund payment options + // Example: ["Cash","Cash","StoreCredit"] RefundPaymentOptions []string `json:"refundPaymentOptions"` // refund version + // Example: string RefundVersion string `json:"refundVersion,omitempty"` // registration expire date + // Example: 0 RegistrationExpireDate float64 `json:"registrationExpireDate,omitempty"` // role Id + // Example: 5c7e8c7b722ed607e61edb13 RoleID string `json:"roleId,omitempty"` // shops + // Example: ["5c9fe425e0faca07db94b970"] Shops []string `json:"shops"` // short Id + // Example: string ShortID string `json:"shortId,omitempty"` // state + // Example: 0 State float64 `json:"state,omitempty"` // time card Id + // Example: 5cd2d7b80c9ccc081b8999ca TimeCardID string `json:"timeCardId,omitempty"` // tookan task Id + // Example: string TookanTaskID string `json:"tookanTaskId,omitempty"` // transaction refund status + // Example: Partial_Refund TransactionRefundStatus string `json:"transactionRefundStatus,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vehicle license plate + // Example: string VehicleLicensePlate string `json:"vehicleLicensePlate,omitempty"` // vehicle make + // Example: Mercedes VehicleMake string `json:"vehicleMake,omitempty"` // vehicle model + // Example: string VehicleModel string `json:"vehicleModel,omitempty"` // vehicle pin + // Example: string VehiclePin string `json:"vehiclePin,omitempty"` // vin no + // Example: string VinNo string `json:"vinNo,omitempty"` } @@ -3901,7 +5375,6 @@ func (m *TransactionsResponseValuesItems0Seller) Validate(formats strfmt.Registr } func (m *TransactionsResponseValuesItems0Seller) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -3919,7 +5392,6 @@ func (m *TransactionsResponseValuesItems0Seller) validateAddress(formats strfmt. } func (m *TransactionsResponseValuesItems0Seller) validateRecentLocation(formats strfmt.Registry) error { - if swag.IsZero(m.RecentLocation) { // not required return nil } @@ -3936,6 +5408,52 @@ func (m *TransactionsResponseValuesItems0Seller) validateRecentLocation(formats return nil } +// ContextValidate validate this transactions response values items0 seller based on the context it is used +func (m *TransactionsResponseValuesItems0Seller) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRecentLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TransactionsResponseValuesItems0Seller) 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("seller" + "." + "address") + } + return err + } + } + + return nil +} + +func (m *TransactionsResponseValuesItems0Seller) contextValidateRecentLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.RecentLocation != nil { + if err := m.RecentLocation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("seller" + "." + "recentLocation") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0Seller) MarshalBinary() ([]byte, error) { if m == nil { @@ -3969,27 +5487,34 @@ type TransactionsResponseValuesItems0SellerAddress struct { City string `json:"city,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1555699043038 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cba1563e7198807f4ba3ce2 ID string `json:"id,omitempty"` // modified + // Example: 1555699043038 Modified int64 `json:"modified,omitempty"` // state State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code @@ -4001,6 +5526,11 @@ func (m *TransactionsResponseValuesItems0SellerAddress) Validate(formats strfmt. return nil } +// ContextValidate validates this transactions response values items0 seller address based on context it is used +func (m *TransactionsResponseValuesItems0SellerAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0SellerAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -4025,45 +5555,59 @@ func (m *TransactionsResponseValuesItems0SellerAddress) UnmarshalBinary(b []byte type TransactionsResponseValuesItems0SellerRecentLocation struct { // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1557337109403 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // device Id + // Example: A2D5B987-95F4-479F-83F0-A752A5214EC8 DeviceID string `json:"deviceId,omitempty"` // dirty + // Example: false Dirty bool `json:"dirty,omitempty"` // employee Id + // Example: 5cba1632c3cb8e0812d4c12f EmployeeID string `json:"employeeId,omitempty"` // id + // Example: 5cd3141535f310083897685c ID string `json:"id,omitempty"` // loc + // Example: [-118.54924441326274,34.38270112968458] Loc []float64 `json:"loc"` // modified + // Example: 1557337109403 Modified int64 `json:"modified,omitempty"` // name + // Example: Pineapple’s iPhone Name string `json:"name,omitempty"` // shop Id + // Example: 5c9fe425e0faca07db94b970 ShopID string `json:"shopId,omitempty"` // terminal Id + // Example: 5c9fe47ae8df3f080d33aa09 TerminalID string `json:"terminalId,omitempty"` // time card Id + // Example: 5cd2d7b80c9ccc081b8999ca TimeCardID string `json:"timeCardId,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -4072,6 +5616,11 @@ func (m *TransactionsResponseValuesItems0SellerRecentLocation) Validate(formats return nil } +// ContextValidate validates this transactions response values items0 seller recent location based on context it is used +func (m *TransactionsResponseValuesItems0SellerRecentLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TransactionsResponseValuesItems0SellerRecentLocation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/blaze/blaze_models/vendor_response.go b/api/blaze/blaze_models/vendor_response.go index de8e0aa..b1763d3 100644 --- a/api/blaze/blaze_models/vendor_response.go +++ b/api/blaze/blaze_models/vendor_response.go @@ -10,6 +10,7 @@ package blaze_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,48 +24,62 @@ import ( type VendorResponse struct { // active + // Example: true Active bool `json:"active,omitempty"` // additional address list + // Example: ["string"] AdditionalAddressList []string `json:"additionalAddressList"` // address Address *VendorResponseAddress `json:"address,omitempty"` // arms length type + // Example: ARMS_LENGTH ArmsLengthType string `json:"armsLengthType,omitempty"` // assets + // Example: ["string"] Assets []*VendorResponseAssetsItems0 `json:"assets"` // back order enabled + // Example: false BackOrderEnabled bool `json:"backOrderEnabled,omitempty"` // brand list + // Example: ["string"] BrandList []string `json:"brandList"` // brands + // Example: ["string"] Brands []string `json:"brands"` // company Id + // Example: 5cabd4ba6218d148395b402c CompanyID string `json:"companyId,omitempty"` // company licenses + // Example: ["string"] CompanyLicenses []string `json:"companyLicenses"` // company type + // Example: string CompanyType string `json:"companyType,omitempty"` // created + // Example: 1554825414778 Created int64 `json:"created,omitempty"` // credits + // Example: 0 Credits float64 `json:"credits,omitempty"` // dba name + // Example: string DbaName string `json:"dbaName,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // description @@ -80,54 +95,68 @@ type VendorResponse struct { FirstName string `json:"firstName,omitempty"` // id + // Example: 5cacc0c66218d174d3f17b0d ID string `json:"id,omitempty"` // import Id + // Example: string ImportID string `json:"importId,omitempty"` // last name LastName string `json:"lastName,omitempty"` // licence type + // Example: string LicenceType string `json:"licenceType,omitempty"` // license expiration date + // Example: 0 LicenseExpirationDate float64 `json:"licenseExpirationDate,omitempty"` // license number LicenseNumber string `json:"licenseNumber,omitempty"` // mobile number + // Example: string MobileNumber string `json:"mobileNumber,omitempty"` // modified + // Example: 1554825414778 Modified int64 `json:"modified,omitempty"` // name + // Example: Binsky Name string `json:"name,omitempty"` // notes + // Example: ["string"] Notes []string `json:"notes"` // phone Phone string `json:"phone,omitempty"` // qb desktop ref + // Example: string QbDesktopRef string `json:"qbDesktopRef,omitempty"` // qb vendor ref + // Example: ["string"] QbVendorRef []string `json:"qbVendorRef"` // related entity + // Example: false RelatedEntity bool `json:"relatedEntity,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // vendor key + // Example: NWNhYmQ0YmE2MjE4ZDE0ODM5NWI0MDJjX2JpbnNreQ== VendorKey string `json:"vendorKey,omitempty"` // vendor type + // Example: VENDOR VendorType string `json:"vendorType,omitempty"` // website @@ -153,7 +182,6 @@ func (m *VendorResponse) Validate(formats strfmt.Registry) error { } func (m *VendorResponse) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -171,7 +199,6 @@ func (m *VendorResponse) validateAddress(formats strfmt.Registry) error { } func (m *VendorResponse) validateAssets(formats strfmt.Registry) error { - if swag.IsZero(m.Assets) { // not required return nil } @@ -195,6 +222,56 @@ func (m *VendorResponse) validateAssets(formats strfmt.Registry) error { return nil } +// ContextValidate validate this vendor response based on the context it is used +func (m *VendorResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAssets(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VendorResponse) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("address") + } + return err + } + } + + return nil +} + +func (m *VendorResponse) contextValidateAssets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Assets); i++ { + + if m.Assets[i] != nil { + if err := m.Assets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *VendorResponse) MarshalBinary() ([]byte, error) { if m == nil { @@ -225,27 +302,34 @@ type VendorResponseAddress struct { City string `json:"city,omitempty"` // company Id + // Example: string CompanyID string `json:"companyId,omitempty"` // country + // Example: US Country string `json:"country,omitempty"` // created + // Example: 1554825414778 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cacc0c66218d174d3f17b0c ID string `json:"id,omitempty"` // modified + // Example: 1554825414778 Modified int64 `json:"modified,omitempty"` // state State string `json:"state,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` // zip code @@ -257,6 +341,11 @@ func (m *VendorResponseAddress) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this vendor response address based on context it is used +func (m *VendorResponseAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VendorResponseAddress) MarshalBinary() ([]byte, error) { if m == nil { @@ -281,54 +370,71 @@ func (m *VendorResponseAddress) UnmarshalBinary(b []byte) error { type VendorResponseAssetsItems0 struct { // active + // Example: true Active bool `json:"active,omitempty"` // asset type + // Example: Photo AssetType string `json:"assetType,omitempty"` // company Id + // Example: 5c7e8c7b722ed607e61edb06 CompanyID string `json:"companyId,omitempty"` // created + // Example: 1556052368662 Created int64 `json:"created,omitempty"` // deleted + // Example: false Deleted bool `json:"deleted,omitempty"` // id + // Example: 5cbf79908a29f808183540e7 ID string `json:"id,omitempty"` // key + // Example: c71adc95-bb07-47f2-b9f6-cc4db7936686.png Key string `json:"key,omitempty"` // large URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-800x800.png LargeURL string `json:"largeURL,omitempty"` // large x2 URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-1600x1600.png LargeX2URL string `json:"largeX2URL,omitempty"` // medium URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-500x500.png MediumURL string `json:"mediumURL,omitempty"` // modified + // Example: 1556052368662 Modified int64 `json:"modified,omitempty"` // name + // Example: Brian Main DL.png Name string `json:"name,omitempty"` // priority + // Example: 0 Priority float64 `json:"priority,omitempty"` // secured + // Example: true Secured bool `json:"secured,omitempty"` // thumb URL + // Example: https://connect-files-p1.s3.amazonaws.com/c71adc95-bb07-47f2-b9f6-cc4db7936686-200x200.png ThumbURL string `json:"thumbURL,omitempty"` // type + // Example: Photo Type string `json:"type,omitempty"` // updated + // Example: false Updated bool `json:"updated,omitempty"` } @@ -337,6 +443,11 @@ func (m *VendorResponseAssetsItems0) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this vendor response assets items0 based on context it is used +func (m *VendorResponseAssetsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VendorResponseAssetsItems0) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_client/accounts/accounts_client.go b/api/crm/crm_client/accounts/accounts_client.go index ce2fc82..0078d9e 100644 --- a/api/crm/crm_client/accounts/accounts_client.go +++ b/api/crm/crm_client/accounts/accounts_client.go @@ -29,17 +29,20 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteAccountOK, error) + DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) - GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) + GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) - GetAccountsObservable(params *GetAccountsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsObservableOK, error) + GetAccountsObservable(params *GetAccountsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsObservableOK, error) - PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountsOK, error) + PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) - PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter) (*PutAccountOK, error) + PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Delete Taxnexus Account record */ -func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteAccountOK, error) { +func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteAccountParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteAccount", Method: "DELETE", PathPattern: "/accounts", @@ -67,7 +69,12 @@ func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.Cli 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 } @@ -86,13 +93,12 @@ func (a *Client) DeleteAccount(params *DeleteAccountParams, authInfo runtime.Cli Return a list of all available Accounts */ -func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) { +func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccounts", Method: "GET", PathPattern: "/accounts", @@ -104,7 +110,12 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA 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 } @@ -123,13 +134,12 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA A list of accounts in a simple JSON array */ -func (a *Client) GetAccountsObservable(params *GetAccountsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsObservableOK, error) { +func (a *Client) GetAccountsObservable(params *GetAccountsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccountsObservable", Method: "GET", PathPattern: "/accounts/observable", @@ -141,7 +151,12 @@ func (a *Client) GetAccountsObservable(params *GetAccountsObservableParams, auth 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 } @@ -160,13 +175,12 @@ func (a *Client) GetAccountsObservable(params *GetAccountsObservableParams, auth Account record to be added */ -func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountsOK, error) { +func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postAccounts", Method: "POST", PathPattern: "/accounts", @@ -178,7 +192,12 @@ func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.Clien 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 } @@ -197,13 +216,12 @@ func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.Clien Update a single account specified by accountId */ -func (a *Client) PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter) (*PutAccountOK, error) { +func (a *Client) PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutAccountParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putAccount", Method: "PUT", PathPattern: "/accounts", @@ -215,7 +233,12 @@ func (a *Client) PutAccount(params *PutAccountParams, authInfo runtime.ClientAut 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 } diff --git a/api/crm/crm_client/accounts/delete_account_parameters.go b/api/crm/crm_client/accounts/delete_account_parameters.go index 4c46281..bd8e0a8 100644 --- a/api/crm/crm_client/accounts/delete_account_parameters.go +++ b/api/crm/crm_client/accounts/delete_account_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteAccountParams creates a new DeleteAccountParams object -// with the default values initialized. +// NewDeleteAccountParams creates a new DeleteAccountParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDeleteAccountParams() *DeleteAccountParams { - var () return &DeleteAccountParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteAccountParamsWithTimeout creates a new DeleteAccountParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteAccountParamsWithTimeout(timeout time.Duration) *DeleteAccountParams { - var () return &DeleteAccountParams{ - timeout: timeout, } } // NewDeleteAccountParamsWithContext creates a new DeleteAccountParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteAccountParamsWithContext(ctx context.Context) *DeleteAccountParams { - var () return &DeleteAccountParams{ - Context: ctx, } } // NewDeleteAccountParamsWithHTTPClient creates a new DeleteAccountParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteAccountParamsWithHTTPClient(client *http.Client) *DeleteAccountParams { - var () return &DeleteAccountParams{ HTTPClient: client, } } -/*DeleteAccountParams contains all the parameters to send to the API endpoint -for the delete account operation typically these are written to a http.Request +/* DeleteAccountParams contains all the parameters to send to the API endpoint + for the delete account operation. + + Typically these are written to a http.Request. */ type DeleteAccountParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string @@ -75,6 +74,21 @@ type DeleteAccountParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAccountParams) WithDefaults() *DeleteAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAccountParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete account params func (o *DeleteAccountParams) WithTimeout(timeout time.Duration) *DeleteAccountParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/accounts/delete_account_responses.go b/api/crm/crm_client/accounts/delete_account_responses.go index 17e97ff..ba3f98b 100644 --- a/api/crm/crm_client/accounts/delete_account_responses.go +++ b/api/crm/crm_client/accounts/delete_account_responses.go @@ -63,9 +63,8 @@ func (o *DeleteAccountReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteAccountOK() *DeleteAccountOK { return &DeleteAccountOK{} } -/*DeleteAccountOK handles this case with default header values. +/* DeleteAccountOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteAccountOK struct { func (o *DeleteAccountOK) Error() string { return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountOK %+v", 200, o.Payload) } - func (o *DeleteAccountOK) GetPayload() *crm_models.DeleteResponse { return o.Payload } func (o *DeleteAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -112,7 +114,7 @@ func NewDeleteAccountUnauthorized() *DeleteAccountUnauthorized { return &DeleteAccountUnauthorized{} } -/*DeleteAccountUnauthorized handles this case with default header values. +/* DeleteAccountUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteAccountUnauthorized struct { func (o *DeleteAccountUnauthorized) Error() string { return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnauthorized %+v", 401, o.Payload) } - func (o *DeleteAccountUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -150,7 +155,7 @@ func NewDeleteAccountForbidden() *DeleteAccountForbidden { return &DeleteAccountForbidden{} } -/*DeleteAccountForbidden handles this case with default header values. +/* DeleteAccountForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteAccountForbidden struct { func (o *DeleteAccountForbidden) Error() string { return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountForbidden %+v", 403, o.Payload) } - func (o *DeleteAccountForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteAccountForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -188,7 +196,7 @@ func NewDeleteAccountNotFound() *DeleteAccountNotFound { return &DeleteAccountNotFound{} } -/*DeleteAccountNotFound handles this case with default header values. +/* DeleteAccountNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteAccountNotFound struct { func (o *DeleteAccountNotFound) Error() string { return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountNotFound %+v", 404, o.Payload) } - func (o *DeleteAccountNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteAccountNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -226,7 +237,7 @@ func NewDeleteAccountUnprocessableEntity() *DeleteAccountUnprocessableEntity { return &DeleteAccountUnprocessableEntity{} } -/*DeleteAccountUnprocessableEntity handles this case with default header values. +/* DeleteAccountUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteAccountUnprocessableEntity struct { func (o *DeleteAccountUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteAccountUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteAccountUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -264,7 +278,7 @@ func NewDeleteAccountInternalServerError() *DeleteAccountInternalServerError { return &DeleteAccountInternalServerError{} } -/*DeleteAccountInternalServerError handles this case with default header values. +/* DeleteAccountInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteAccountInternalServerError struct { func (o *DeleteAccountInternalServerError) Error() string { return fmt.Sprintf("[DELETE /accounts][%d] deleteAccountInternalServerError %+v", 500, o.Payload) } - func (o *DeleteAccountInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteAccountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/accounts/get_accounts_observable_parameters.go b/api/crm/crm_client/accounts/get_accounts_observable_parameters.go index 4f0b47d..7b71ee3 100644 --- a/api/crm/crm_client/accounts/get_accounts_observable_parameters.go +++ b/api/crm/crm_client/accounts/get_accounts_observable_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAccountsObservableParams creates a new GetAccountsObservableParams object -// with the default values initialized. +// NewGetAccountsObservableParams creates a new GetAccountsObservableParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetAccountsObservableParams() *GetAccountsObservableParams { - var () return &GetAccountsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountsObservableParamsWithTimeout creates a new GetAccountsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountsObservableParamsWithTimeout(timeout time.Duration) *GetAccountsObservableParams { - var () return &GetAccountsObservableParams{ - timeout: timeout, } } // NewGetAccountsObservableParamsWithContext creates a new GetAccountsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountsObservableParamsWithContext(ctx context.Context) *GetAccountsObservableParams { - var () return &GetAccountsObservableParams{ - Context: ctx, } } // NewGetAccountsObservableParamsWithHTTPClient creates a new GetAccountsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountsObservableParamsWithHTTPClient(client *http.Client) *GetAccountsObservableParams { - var () return &GetAccountsObservableParams{ HTTPClient: client, } } -/*GetAccountsObservableParams contains all the parameters to send to the API endpoint -for the get accounts observable operation typically these are written to a http.Request +/* GetAccountsObservableParams contains all the parameters to send to the API endpoint + for the get accounts observable operation. + + Typically these are written to a http.Request. */ type GetAccountsObservableParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*Active - Only retrieve active records? + /* Active. + + Only retrieve active records? */ Active *bool - /*Email - Email address used for identity lookup + /* Email. + + Email address used for identity lookup */ Email *string - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string @@ -91,6 +93,21 @@ type GetAccountsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounts observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsObservableParams) WithDefaults() *GetAccountsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounts observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounts observable params func (o *GetAccountsObservableParams) WithTimeout(timeout time.Duration) *GetAccountsObservableParams { o.SetTimeout(timeout) @@ -180,64 +197,68 @@ func (o *GetAccountsObservableParams) WriteToRequest(r runtime.ClientRequest, re // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.Email != nil { // query param email var qrEmail string + if o.Email != nil { qrEmail = *o.Email } qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/accounts/get_accounts_observable_responses.go b/api/crm/crm_client/accounts/get_accounts_observable_responses.go index 6a0ca5c..f37cd41 100644 --- a/api/crm/crm_client/accounts/get_accounts_observable_responses.go +++ b/api/crm/crm_client/accounts/get_accounts_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountsObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetAccountsObservableOK() *GetAccountsObservableOK { return &GetAccountsObservableOK{} } -/*GetAccountsObservableOK handles this case with default header values. +/* GetAccountsObservableOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Account objects */ type GetAccountsObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*crm_models.Account } @@ -89,18 +87,25 @@ type GetAccountsObservableOK struct { func (o *GetAccountsObservableOK) Error() string { return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableOK %+v", 200, o.Payload) } - func (o *GetAccountsObservableOK) GetPayload() []*crm_models.Account { return o.Payload } func (o *GetAccountsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetAccountsObservableUnauthorized() *GetAccountsObservableUnauthorized { return &GetAccountsObservableUnauthorized{} } -/*GetAccountsObservableUnauthorized handles this case with default header values. +/* GetAccountsObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetAccountsObservableUnauthorized struct { func (o *GetAccountsObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountsObservableUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -153,7 +161,7 @@ func NewGetAccountsObservableForbidden() *GetAccountsObservableForbidden { return &GetAccountsObservableForbidden{} } -/*GetAccountsObservableForbidden handles this case with default header values. +/* GetAccountsObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetAccountsObservableForbidden struct { func (o *GetAccountsObservableForbidden) Error() string { return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableForbidden %+v", 403, o.Payload) } - func (o *GetAccountsObservableForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -191,7 +202,7 @@ func NewGetAccountsObservableNotFound() *GetAccountsObservableNotFound { return &GetAccountsObservableNotFound{} } -/*GetAccountsObservableNotFound handles this case with default header values. +/* GetAccountsObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetAccountsObservableNotFound struct { func (o *GetAccountsObservableNotFound) Error() string { return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableNotFound %+v", 404, o.Payload) } - func (o *GetAccountsObservableNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -229,7 +243,7 @@ func NewGetAccountsObservableUnprocessableEntity() *GetAccountsObservableUnproce return &GetAccountsObservableUnprocessableEntity{} } -/*GetAccountsObservableUnprocessableEntity handles this case with default header values. +/* GetAccountsObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetAccountsObservableUnprocessableEntity struct { func (o *GetAccountsObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountsObservableUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -267,7 +284,7 @@ func NewGetAccountsObservableInternalServerError() *GetAccountsObservableInterna return &GetAccountsObservableInternalServerError{} } -/*GetAccountsObservableInternalServerError handles this case with default header values. +/* GetAccountsObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetAccountsObservableInternalServerError struct { func (o *GetAccountsObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /accounts/observable][%d] getAccountsObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountsObservableInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/accounts/get_accounts_parameters.go b/api/crm/crm_client/accounts/get_accounts_parameters.go index ada1e8e..64b36ed 100644 --- a/api/crm/crm_client/accounts/get_accounts_parameters.go +++ b/api/crm/crm_client/accounts/get_accounts_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAccountsParams creates a new GetAccountsParams object -// with the default values initialized. +// NewGetAccountsParams creates a new GetAccountsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetAccountsParams() *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountsParamsWithTimeout creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountsParamsWithTimeout(timeout time.Duration) *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: timeout, } } // NewGetAccountsParamsWithContext creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountsParamsWithContext(ctx context.Context) *GetAccountsParams { - var () return &GetAccountsParams{ - Context: ctx, } } // NewGetAccountsParamsWithHTTPClient creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountsParamsWithHTTPClient(client *http.Client) *GetAccountsParams { - var () return &GetAccountsParams{ HTTPClient: client, } } -/*GetAccountsParams contains all the parameters to send to the API endpoint -for the get accounts operation typically these are written to a http.Request +/* GetAccountsParams contains all the parameters to send to the API endpoint + for the get accounts operation. + + Typically these are written to a http.Request. */ type GetAccountsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*Active - Only retrieve active records? + /* Active. + + Only retrieve active records? */ Active *bool - /*Email - Email address used for identity lookup + /* Email. + + Email address used for identity lookup */ Email *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string - /*Offset - How many objects to skip? + /* Offset. + + How many objects to skip? + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) WithDefaults() *GetAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounts params func (o *GetAccountsParams) WithTimeout(timeout time.Duration) *GetAccountsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.Email != nil { // query param email var qrEmail string + if o.Email != nil { qrEmail = *o.Email } qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/accounts/get_accounts_responses.go b/api/crm/crm_client/accounts/get_accounts_responses.go index 042d035..ee72d58 100644 --- a/api/crm/crm_client/accounts/get_accounts_responses.go +++ b/api/crm/crm_client/accounts/get_accounts_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetAccountsOK() *GetAccountsOK { return &GetAccountsOK{} } -/*GetAccountsOK handles this case with default header values. +/* GetAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Account objects with Contacts */ type GetAccountsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.AccountResponse } @@ -89,18 +87,25 @@ type GetAccountsOK struct { func (o *GetAccountsOK) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload) } - func (o *GetAccountsOK) GetPayload() *crm_models.AccountResponse { return o.Payload } func (o *GetAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.AccountResponse) @@ -117,7 +122,7 @@ func NewGetAccountsUnauthorized() *GetAccountsUnauthorized { return &GetAccountsUnauthorized{} } -/*GetAccountsUnauthorized handles this case with default header values. +/* GetAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetAccountsUnauthorized struct { func (o *GetAccountsUnauthorized) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewGetAccountsForbidden() *GetAccountsForbidden { return &GetAccountsForbidden{} } -/*GetAccountsForbidden handles this case with default header values. +/* GetAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetAccountsForbidden struct { func (o *GetAccountsForbidden) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload) } - func (o *GetAccountsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewGetAccountsNotFound() *GetAccountsNotFound { return &GetAccountsNotFound{} } -/*GetAccountsNotFound handles this case with default header values. +/* GetAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetAccountsNotFound struct { func (o *GetAccountsNotFound) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload) } - func (o *GetAccountsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewGetAccountsUnprocessableEntity() *GetAccountsUnprocessableEntity { return &GetAccountsUnprocessableEntity{} } -/*GetAccountsUnprocessableEntity handles this case with default header values. +/* GetAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetAccountsUnprocessableEntity struct { func (o *GetAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewGetAccountsInternalServerError() *GetAccountsInternalServerError { return &GetAccountsInternalServerError{} } -/*GetAccountsInternalServerError handles this case with default header values. +/* GetAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetAccountsInternalServerError struct { func (o *GetAccountsInternalServerError) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/accounts/post_accounts_parameters.go b/api/crm/crm_client/accounts/post_accounts_parameters.go index 4484684..095b862 100644 --- a/api/crm/crm_client/accounts/post_accounts_parameters.go +++ b/api/crm/crm_client/accounts/post_accounts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_models" ) -// NewPostAccountsParams creates a new PostAccountsParams object -// with the default values initialized. +// NewPostAccountsParams creates a new PostAccountsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPostAccountsParams() *PostAccountsParams { - var () return &PostAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPostAccountsParamsWithTimeout creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostAccountsParamsWithTimeout(timeout time.Duration) *PostAccountsParams { - var () return &PostAccountsParams{ - timeout: timeout, } } // NewPostAccountsParamsWithContext creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostAccountsParamsWithContext(ctx context.Context) *PostAccountsParams { - var () return &PostAccountsParams{ - Context: ctx, } } // NewPostAccountsParamsWithHTTPClient creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostAccountsParamsWithHTTPClient(client *http.Client) *PostAccountsParams { - var () return &PostAccountsParams{ HTTPClient: client, } } -/*PostAccountsParams contains all the parameters to send to the API endpoint -for the post accounts operation typically these are written to a http.Request +/* PostAccountsParams contains all the parameters to send to the API endpoint + for the post accounts operation. + + Typically these are written to a http.Request. */ type PostAccountsParams struct { - /*AccountRequest - An array of new Account records + /* AccountRequest. + An array of new Account records */ AccountRequest *crm_models.AccountRequest @@ -77,6 +76,21 @@ type PostAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountsParams) WithDefaults() *PostAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post accounts params func (o *PostAccountsParams) WithTimeout(timeout time.Duration) *PostAccountsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.AccountRequest != nil { if err := r.SetBodyParam(o.AccountRequest); err != nil { return err diff --git a/api/crm/crm_client/accounts/post_accounts_responses.go b/api/crm/crm_client/accounts/post_accounts_responses.go index 4251854..948c916 100644 --- a/api/crm/crm_client/accounts/post_accounts_responses.go +++ b/api/crm/crm_client/accounts/post_accounts_responses.go @@ -63,9 +63,8 @@ func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostAccountsOK() *PostAccountsOK { return &PostAccountsOK{} } -/*PostAccountsOK handles this case with default header values. +/* PostAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Account objects with Contacts */ type PostAccountsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.AccountResponse } @@ -89,18 +87,25 @@ type PostAccountsOK struct { func (o *PostAccountsOK) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %+v", 200, o.Payload) } - func (o *PostAccountsOK) GetPayload() *crm_models.AccountResponse { return o.Payload } func (o *PostAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.AccountResponse) @@ -117,7 +122,7 @@ func NewPostAccountsUnauthorized() *PostAccountsUnauthorized { return &PostAccountsUnauthorized{} } -/*PostAccountsUnauthorized handles this case with default header values. +/* PostAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostAccountsUnauthorized struct { func (o *PostAccountsUnauthorized) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %+v", 401, o.Payload) } - func (o *PostAccountsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewPostAccountsForbidden() *PostAccountsForbidden { return &PostAccountsForbidden{} } -/*PostAccountsForbidden handles this case with default header values. +/* PostAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostAccountsForbidden struct { func (o *PostAccountsForbidden) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %+v", 403, o.Payload) } - func (o *PostAccountsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewPostAccountsNotFound() *PostAccountsNotFound { return &PostAccountsNotFound{} } -/*PostAccountsNotFound handles this case with default header values. +/* PostAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostAccountsNotFound struct { func (o *PostAccountsNotFound) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %+v", 404, o.Payload) } - func (o *PostAccountsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewPostAccountsUnprocessableEntity() *PostAccountsUnprocessableEntity { return &PostAccountsUnprocessableEntity{} } -/*PostAccountsUnprocessableEntity handles this case with default header values. +/* PostAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostAccountsUnprocessableEntity struct { func (o *PostAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostAccountsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewPostAccountsInternalServerError() *PostAccountsInternalServerError { return &PostAccountsInternalServerError{} } -/*PostAccountsInternalServerError handles this case with default header values. +/* PostAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostAccountsInternalServerError struct { func (o *PostAccountsInternalServerError) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %+v", 500, o.Payload) } - func (o *PostAccountsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/accounts/put_account_parameters.go b/api/crm/crm_client/accounts/put_account_parameters.go index 6c40da9..a62babe 100644 --- a/api/crm/crm_client/accounts/put_account_parameters.go +++ b/api/crm/crm_client/accounts/put_account_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_models" ) -// NewPutAccountParams creates a new PutAccountParams object -// with the default values initialized. +// NewPutAccountParams creates a new PutAccountParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPutAccountParams() *PutAccountParams { - var () return &PutAccountParams{ - timeout: cr.DefaultTimeout, } } // NewPutAccountParamsWithTimeout creates a new PutAccountParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutAccountParamsWithTimeout(timeout time.Duration) *PutAccountParams { - var () return &PutAccountParams{ - timeout: timeout, } } // NewPutAccountParamsWithContext creates a new PutAccountParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutAccountParamsWithContext(ctx context.Context) *PutAccountParams { - var () return &PutAccountParams{ - Context: ctx, } } // NewPutAccountParamsWithHTTPClient creates a new PutAccountParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutAccountParamsWithHTTPClient(client *http.Client) *PutAccountParams { - var () return &PutAccountParams{ HTTPClient: client, } } -/*PutAccountParams contains all the parameters to send to the API endpoint -for the put account operation typically these are written to a http.Request +/* PutAccountParams contains all the parameters to send to the API endpoint + for the put account operation. + + Typically these are written to a http.Request. */ type PutAccountParams struct { - /*AccountRequest - An array of new Account records + /* AccountRequest. + An array of new Account records */ AccountRequest *crm_models.AccountRequest @@ -77,6 +76,21 @@ type PutAccountParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAccountParams) WithDefaults() *PutAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAccountParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put account params func (o *PutAccountParams) WithTimeout(timeout time.Duration) *PutAccountParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.AccountRequest != nil { if err := r.SetBodyParam(o.AccountRequest); err != nil { return err diff --git a/api/crm/crm_client/accounts/put_account_responses.go b/api/crm/crm_client/accounts/put_account_responses.go index bda4cec..61190f6 100644 --- a/api/crm/crm_client/accounts/put_account_responses.go +++ b/api/crm/crm_client/accounts/put_account_responses.go @@ -63,9 +63,8 @@ func (o *PutAccountReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutAccountOK() *PutAccountOK { return &PutAccountOK{} } -/*PutAccountOK handles this case with default header values. +/* PutAccountOK describes a response with status code 200, with default header values. Taxnexus Response with Account objects with Contacts */ type PutAccountOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.AccountResponse } @@ -89,18 +87,25 @@ type PutAccountOK struct { func (o *PutAccountOK) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountOK %+v", 200, o.Payload) } - func (o *PutAccountOK) GetPayload() *crm_models.AccountResponse { return o.Payload } func (o *PutAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.AccountResponse) @@ -117,7 +122,7 @@ func NewPutAccountUnauthorized() *PutAccountUnauthorized { return &PutAccountUnauthorized{} } -/*PutAccountUnauthorized handles this case with default header values. +/* PutAccountUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutAccountUnauthorized struct { func (o *PutAccountUnauthorized) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountUnauthorized %+v", 401, o.Payload) } - func (o *PutAccountUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PutAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewPutAccountForbidden() *PutAccountForbidden { return &PutAccountForbidden{} } -/*PutAccountForbidden handles this case with default header values. +/* PutAccountForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutAccountForbidden struct { func (o *PutAccountForbidden) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountForbidden %+v", 403, o.Payload) } - func (o *PutAccountForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PutAccountForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewPutAccountNotFound() *PutAccountNotFound { return &PutAccountNotFound{} } -/*PutAccountNotFound handles this case with default header values. +/* PutAccountNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutAccountNotFound struct { func (o *PutAccountNotFound) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountNotFound %+v", 404, o.Payload) } - func (o *PutAccountNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PutAccountNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewPutAccountUnprocessableEntity() *PutAccountUnprocessableEntity { return &PutAccountUnprocessableEntity{} } -/*PutAccountUnprocessableEntity handles this case with default header values. +/* PutAccountUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutAccountUnprocessableEntity struct { func (o *PutAccountUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutAccountUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PutAccountUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewPutAccountInternalServerError() *PutAccountInternalServerError { return &PutAccountInternalServerError{} } -/*PutAccountInternalServerError handles this case with default header values. +/* PutAccountInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutAccountInternalServerError struct { func (o *PutAccountInternalServerError) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountInternalServerError %+v", 500, o.Payload) } - func (o *PutAccountInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PutAccountInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/companies/companies_client.go b/api/crm/crm_client/companies/companies_client.go index 5737ad7..7bed5d6 100644 --- a/api/crm/crm_client/companies/companies_client.go +++ b/api/crm/crm_client/companies/companies_client.go @@ -29,13 +29,16 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCompaniesOK, error) + GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesOK, error) - GetCompaniesObservable(params *GetCompaniesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCompaniesObservableOK, error) + GetCompaniesObservable(params *GetCompaniesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesObservableOK, error) - PostCompanies(params *PostCompaniesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCompaniesOK, error) + PostCompanies(params *PostCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompaniesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Retrieve Company records from the datastore */ -func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCompaniesOK, error) { +func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCompaniesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCompanies", Method: "GET", PathPattern: "/companies", @@ -63,7 +65,12 @@ func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.Clien 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 } @@ -82,13 +89,12 @@ func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.Clien A list of companies in a simple JSON array */ -func (a *Client) GetCompaniesObservable(params *GetCompaniesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCompaniesObservableOK, error) { +func (a *Client) GetCompaniesObservable(params *GetCompaniesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCompaniesObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCompaniesObservable", Method: "GET", PathPattern: "/companies/observable", @@ -100,7 +106,12 @@ func (a *Client) GetCompaniesObservable(params *GetCompaniesObservableParams, au 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 } @@ -119,13 +130,12 @@ func (a *Client) GetCompaniesObservable(params *GetCompaniesObservableParams, au Add new companies */ -func (a *Client) PostCompanies(params *PostCompaniesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCompaniesOK, error) { +func (a *Client) PostCompanies(params *PostCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCompaniesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCompaniesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCompanies", Method: "POST", PathPattern: "/companies", @@ -137,7 +147,12 @@ func (a *Client) PostCompanies(params *PostCompaniesParams, authInfo runtime.Cli 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 } diff --git a/api/crm/crm_client/companies/get_companies_observable_parameters.go b/api/crm/crm_client/companies/get_companies_observable_parameters.go index 325fdef..0c449d4 100644 --- a/api/crm/crm_client/companies/get_companies_observable_parameters.go +++ b/api/crm/crm_client/companies/get_companies_observable_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCompaniesObservableParams creates a new GetCompaniesObservableParams object -// with the default values initialized. +// NewGetCompaniesObservableParams creates a new GetCompaniesObservableParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetCompaniesObservableParams() *GetCompaniesObservableParams { - var () return &GetCompaniesObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetCompaniesObservableParamsWithTimeout creates a new GetCompaniesObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCompaniesObservableParamsWithTimeout(timeout time.Duration) *GetCompaniesObservableParams { - var () return &GetCompaniesObservableParams{ - timeout: timeout, } } // NewGetCompaniesObservableParamsWithContext creates a new GetCompaniesObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCompaniesObservableParamsWithContext(ctx context.Context) *GetCompaniesObservableParams { - var () return &GetCompaniesObservableParams{ - Context: ctx, } } // NewGetCompaniesObservableParamsWithHTTPClient creates a new GetCompaniesObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCompaniesObservableParamsWithHTTPClient(client *http.Client) *GetCompaniesObservableParams { - var () return &GetCompaniesObservableParams{ HTTPClient: client, } } -/*GetCompaniesObservableParams contains all the parameters to send to the API endpoint -for the get companies observable operation typically these are written to a http.Request +/* GetCompaniesObservableParams contains all the parameters to send to the API endpoint + for the get companies observable operation. + + Typically these are written to a http.Request. */ type GetCompaniesObservableParams struct { - /*CompanyID - Taxnexus Company record ID + /* CompanyID. + Taxnexus Company record ID */ CompanyID *string @@ -75,6 +74,21 @@ type GetCompaniesObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get companies observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompaniesObservableParams) WithDefaults() *GetCompaniesObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get companies observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompaniesObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get companies observable params func (o *GetCompaniesObservableParams) WithTimeout(timeout time.Duration) *GetCompaniesObservableParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *GetCompaniesObservableParams) WriteToRequest(r runtime.ClientRequest, r // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/companies/get_companies_observable_responses.go b/api/crm/crm_client/companies/get_companies_observable_responses.go index cc5bf8c..f58df5c 100644 --- a/api/crm/crm_client/companies/get_companies_observable_responses.go +++ b/api/crm/crm_client/companies/get_companies_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetCompaniesObservableReader) ReadResponse(response runtime.ClientRespo return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCompaniesObservableOK() *GetCompaniesObservableOK { return &GetCompaniesObservableOK{} } -/*GetCompaniesObservableOK handles this case with default header values. +/* GetCompaniesObservableOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Company objects */ type GetCompaniesObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*crm_models.Company } @@ -89,18 +87,25 @@ type GetCompaniesObservableOK struct { func (o *GetCompaniesObservableOK) Error() string { return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableOK %+v", 200, o.Payload) } - func (o *GetCompaniesObservableOK) GetPayload() []*crm_models.Company { return o.Payload } func (o *GetCompaniesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetCompaniesObservableUnauthorized() *GetCompaniesObservableUnauthorized return &GetCompaniesObservableUnauthorized{} } -/*GetCompaniesObservableUnauthorized handles this case with default header values. +/* GetCompaniesObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetCompaniesObservableUnauthorized struct { func (o *GetCompaniesObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetCompaniesObservableUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -153,7 +161,7 @@ func NewGetCompaniesObservableForbidden() *GetCompaniesObservableForbidden { return &GetCompaniesObservableForbidden{} } -/*GetCompaniesObservableForbidden handles this case with default header values. +/* GetCompaniesObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetCompaniesObservableForbidden struct { func (o *GetCompaniesObservableForbidden) Error() string { return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableForbidden %+v", 403, o.Payload) } - func (o *GetCompaniesObservableForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -191,7 +202,7 @@ func NewGetCompaniesObservableNotFound() *GetCompaniesObservableNotFound { return &GetCompaniesObservableNotFound{} } -/*GetCompaniesObservableNotFound handles this case with default header values. +/* GetCompaniesObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetCompaniesObservableNotFound struct { func (o *GetCompaniesObservableNotFound) Error() string { return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableNotFound %+v", 404, o.Payload) } - func (o *GetCompaniesObservableNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -229,7 +243,7 @@ func NewGetCompaniesObservableUnprocessableEntity() *GetCompaniesObservableUnpro return &GetCompaniesObservableUnprocessableEntity{} } -/*GetCompaniesObservableUnprocessableEntity handles this case with default header values. +/* GetCompaniesObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetCompaniesObservableUnprocessableEntity struct { func (o *GetCompaniesObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCompaniesObservableUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -267,7 +284,7 @@ func NewGetCompaniesObservableInternalServerError() *GetCompaniesObservableInter return &GetCompaniesObservableInternalServerError{} } -/*GetCompaniesObservableInternalServerError handles this case with default header values. +/* GetCompaniesObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetCompaniesObservableInternalServerError struct { func (o *GetCompaniesObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /companies/observable][%d] getCompaniesObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetCompaniesObservableInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/companies/get_companies_parameters.go b/api/crm/crm_client/companies/get_companies_parameters.go index 62ebe18..bcd117a 100644 --- a/api/crm/crm_client/companies/get_companies_parameters.go +++ b/api/crm/crm_client/companies/get_companies_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCompaniesParams creates a new GetCompaniesParams object -// with the default values initialized. +// NewGetCompaniesParams creates a new GetCompaniesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetCompaniesParams() *GetCompaniesParams { - var () return &GetCompaniesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCompaniesParamsWithTimeout creates a new GetCompaniesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCompaniesParamsWithTimeout(timeout time.Duration) *GetCompaniesParams { - var () return &GetCompaniesParams{ - timeout: timeout, } } // NewGetCompaniesParamsWithContext creates a new GetCompaniesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCompaniesParamsWithContext(ctx context.Context) *GetCompaniesParams { - var () return &GetCompaniesParams{ - Context: ctx, } } // NewGetCompaniesParamsWithHTTPClient creates a new GetCompaniesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCompaniesParamsWithHTTPClient(client *http.Client) *GetCompaniesParams { - var () return &GetCompaniesParams{ HTTPClient: client, } } -/*GetCompaniesParams contains all the parameters to send to the API endpoint -for the get companies operation typically these are written to a http.Request +/* GetCompaniesParams contains all the parameters to send to the API endpoint + for the get companies operation. + + Typically these are written to a http.Request. */ type GetCompaniesParams struct { - /*CompanyID - Taxnexus Company record ID + /* CompanyID. + Taxnexus Company record ID */ CompanyID *string @@ -75,6 +74,21 @@ type GetCompaniesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get companies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompaniesParams) WithDefaults() *GetCompaniesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get companies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompaniesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get companies params func (o *GetCompaniesParams) WithTimeout(timeout time.Duration) *GetCompaniesParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *GetCompaniesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/companies/get_companies_responses.go b/api/crm/crm_client/companies/get_companies_responses.go index 1f09c74..db1b7e5 100644 --- a/api/crm/crm_client/companies/get_companies_responses.go +++ b/api/crm/crm_client/companies/get_companies_responses.go @@ -63,9 +63,8 @@ func (o *GetCompaniesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCompaniesOK() *GetCompaniesOK { return &GetCompaniesOK{} } -/*GetCompaniesOK handles this case with default header values. +/* GetCompaniesOK describes a response with status code 200, with default header values. Taxnexus Response with Company objects */ type GetCompaniesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.CompanyResponse } @@ -89,18 +87,25 @@ type GetCompaniesOK struct { func (o *GetCompaniesOK) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesOK %+v", 200, o.Payload) } - func (o *GetCompaniesOK) GetPayload() *crm_models.CompanyResponse { return o.Payload } func (o *GetCompaniesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.CompanyResponse) @@ -117,7 +122,7 @@ func NewGetCompaniesUnauthorized() *GetCompaniesUnauthorized { return &GetCompaniesUnauthorized{} } -/*GetCompaniesUnauthorized handles this case with default header values. +/* GetCompaniesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetCompaniesUnauthorized struct { func (o *GetCompaniesUnauthorized) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesUnauthorized %+v", 401, o.Payload) } - func (o *GetCompaniesUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewGetCompaniesForbidden() *GetCompaniesForbidden { return &GetCompaniesForbidden{} } -/*GetCompaniesForbidden handles this case with default header values. +/* GetCompaniesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetCompaniesForbidden struct { func (o *GetCompaniesForbidden) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesForbidden %+v", 403, o.Payload) } - func (o *GetCompaniesForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewGetCompaniesNotFound() *GetCompaniesNotFound { return &GetCompaniesNotFound{} } -/*GetCompaniesNotFound handles this case with default header values. +/* GetCompaniesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetCompaniesNotFound struct { func (o *GetCompaniesNotFound) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesNotFound %+v", 404, o.Payload) } - func (o *GetCompaniesNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewGetCompaniesUnprocessableEntity() *GetCompaniesUnprocessableEntity { return &GetCompaniesUnprocessableEntity{} } -/*GetCompaniesUnprocessableEntity handles this case with default header values. +/* GetCompaniesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetCompaniesUnprocessableEntity struct { func (o *GetCompaniesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCompaniesUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewGetCompaniesInternalServerError() *GetCompaniesInternalServerError { return &GetCompaniesInternalServerError{} } -/*GetCompaniesInternalServerError handles this case with default header values. +/* GetCompaniesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetCompaniesInternalServerError struct { func (o *GetCompaniesInternalServerError) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesInternalServerError %+v", 500, o.Payload) } - func (o *GetCompaniesInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetCompaniesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/companies/post_companies_parameters.go b/api/crm/crm_client/companies/post_companies_parameters.go index c5cc6d3..ec92272 100644 --- a/api/crm/crm_client/companies/post_companies_parameters.go +++ b/api/crm/crm_client/companies/post_companies_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_models" ) -// NewPostCompaniesParams creates a new PostCompaniesParams object -// with the default values initialized. +// NewPostCompaniesParams creates a new PostCompaniesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPostCompaniesParams() *PostCompaniesParams { - var () return &PostCompaniesParams{ - timeout: cr.DefaultTimeout, } } // NewPostCompaniesParamsWithTimeout creates a new PostCompaniesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCompaniesParamsWithTimeout(timeout time.Duration) *PostCompaniesParams { - var () return &PostCompaniesParams{ - timeout: timeout, } } // NewPostCompaniesParamsWithContext creates a new PostCompaniesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCompaniesParamsWithContext(ctx context.Context) *PostCompaniesParams { - var () return &PostCompaniesParams{ - Context: ctx, } } // NewPostCompaniesParamsWithHTTPClient creates a new PostCompaniesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCompaniesParamsWithHTTPClient(client *http.Client) *PostCompaniesParams { - var () return &PostCompaniesParams{ HTTPClient: client, } } -/*PostCompaniesParams contains all the parameters to send to the API endpoint -for the post companies operation typically these are written to a http.Request +/* PostCompaniesParams contains all the parameters to send to the API endpoint + for the post companies operation. + + Typically these are written to a http.Request. */ type PostCompaniesParams struct { - /*CompaniesRequest - An array of new Contact records + /* CompaniesRequest. + An array of new Contact records */ CompaniesRequest *crm_models.CompanyRequest @@ -77,6 +76,21 @@ type PostCompaniesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post companies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCompaniesParams) WithDefaults() *PostCompaniesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post companies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCompaniesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post companies params func (o *PostCompaniesParams) WithTimeout(timeout time.Duration) *PostCompaniesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostCompaniesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.CompaniesRequest != nil { if err := r.SetBodyParam(o.CompaniesRequest); err != nil { return err diff --git a/api/crm/crm_client/companies/post_companies_responses.go b/api/crm/crm_client/companies/post_companies_responses.go index d3fb677..c898bab 100644 --- a/api/crm/crm_client/companies/post_companies_responses.go +++ b/api/crm/crm_client/companies/post_companies_responses.go @@ -63,9 +63,8 @@ func (o *PostCompaniesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostCompaniesOK() *PostCompaniesOK { return &PostCompaniesOK{} } -/*PostCompaniesOK handles this case with default header values. +/* PostCompaniesOK describes a response with status code 200, with default header values. Taxnexus Response with Company objects */ type PostCompaniesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.CompanyResponse } @@ -89,18 +87,25 @@ type PostCompaniesOK struct { func (o *PostCompaniesOK) Error() string { return fmt.Sprintf("[POST /companies][%d] postCompaniesOK %+v", 200, o.Payload) } - func (o *PostCompaniesOK) GetPayload() *crm_models.CompanyResponse { return o.Payload } func (o *PostCompaniesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.CompanyResponse) @@ -117,7 +122,7 @@ func NewPostCompaniesUnauthorized() *PostCompaniesUnauthorized { return &PostCompaniesUnauthorized{} } -/*PostCompaniesUnauthorized handles this case with default header values. +/* PostCompaniesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostCompaniesUnauthorized struct { func (o *PostCompaniesUnauthorized) Error() string { return fmt.Sprintf("[POST /companies][%d] postCompaniesUnauthorized %+v", 401, o.Payload) } - func (o *PostCompaniesUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PostCompaniesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewPostCompaniesForbidden() *PostCompaniesForbidden { return &PostCompaniesForbidden{} } -/*PostCompaniesForbidden handles this case with default header values. +/* PostCompaniesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostCompaniesForbidden struct { func (o *PostCompaniesForbidden) Error() string { return fmt.Sprintf("[POST /companies][%d] postCompaniesForbidden %+v", 403, o.Payload) } - func (o *PostCompaniesForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PostCompaniesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewPostCompaniesNotFound() *PostCompaniesNotFound { return &PostCompaniesNotFound{} } -/*PostCompaniesNotFound handles this case with default header values. +/* PostCompaniesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostCompaniesNotFound struct { func (o *PostCompaniesNotFound) Error() string { return fmt.Sprintf("[POST /companies][%d] postCompaniesNotFound %+v", 404, o.Payload) } - func (o *PostCompaniesNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PostCompaniesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewPostCompaniesUnprocessableEntity() *PostCompaniesUnprocessableEntity { return &PostCompaniesUnprocessableEntity{} } -/*PostCompaniesUnprocessableEntity handles this case with default header values. +/* PostCompaniesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostCompaniesUnprocessableEntity struct { func (o *PostCompaniesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /companies][%d] postCompaniesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostCompaniesUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PostCompaniesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewPostCompaniesInternalServerError() *PostCompaniesInternalServerError { return &PostCompaniesInternalServerError{} } -/*PostCompaniesInternalServerError handles this case with default header values. +/* PostCompaniesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostCompaniesInternalServerError struct { func (o *PostCompaniesInternalServerError) Error() string { return fmt.Sprintf("[POST /companies][%d] postCompaniesInternalServerError %+v", 500, o.Payload) } - func (o *PostCompaniesInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PostCompaniesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/contacts/contacts_client.go b/api/crm/crm_client/contacts/contacts_client.go index 893e226..dcbfcab 100644 --- a/api/crm/crm_client/contacts/contacts_client.go +++ b/api/crm/crm_client/contacts/contacts_client.go @@ -29,17 +29,20 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteContactOK, error) + DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) - GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter) (*GetContactsOK, error) + GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) - GetContactsObservable(params *GetContactsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetContactsObservableOK, error) + GetContactsObservable(params *GetContactsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsObservableOK, error) - PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PostContactsOK, error) + PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) - PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PutContactsOK, error) + PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Delete Taxnexus Contact record */ -func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteContactOK, error) { +func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteContactParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteContact", Method: "DELETE", PathPattern: "/contacts", @@ -67,7 +69,12 @@ func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.Cli 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 } @@ -86,13 +93,12 @@ func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.Cli Return a list of all available Contacts */ -func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter) (*GetContactsOK, error) { +func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetContactsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getContacts", Method: "GET", PathPattern: "/contacts", @@ -104,7 +110,12 @@ func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientA 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 } @@ -123,13 +134,12 @@ func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientA A list of contacts in a simple JSON array */ -func (a *Client) GetContactsObservable(params *GetContactsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetContactsObservableOK, error) { +func (a *Client) GetContactsObservable(params *GetContactsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetContactsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getContactsObservable", Method: "GET", PathPattern: "/contacts/observable", @@ -141,7 +151,12 @@ func (a *Client) GetContactsObservable(params *GetContactsObservableParams, auth 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 } @@ -160,13 +175,12 @@ func (a *Client) GetContactsObservable(params *GetContactsObservableParams, auth Contact record to be added */ -func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PostContactsOK, error) { +func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostContactsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postContacts", Method: "POST", PathPattern: "/contacts", @@ -178,7 +192,12 @@ func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.Clien 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 } @@ -197,13 +216,12 @@ func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.Clien Update Contact records */ -func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PutContactsOK, error) { +func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutContactsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putContacts", Method: "PUT", PathPattern: "/contacts", @@ -215,7 +233,12 @@ func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientA 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 } diff --git a/api/crm/crm_client/contacts/delete_contact_parameters.go b/api/crm/crm_client/contacts/delete_contact_parameters.go index 99fe848..0c13f37 100644 --- a/api/crm/crm_client/contacts/delete_contact_parameters.go +++ b/api/crm/crm_client/contacts/delete_contact_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteContactParams creates a new DeleteContactParams object -// with the default values initialized. +// NewDeleteContactParams creates a new DeleteContactParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDeleteContactParams() *DeleteContactParams { - var () return &DeleteContactParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteContactParamsWithTimeout creates a new DeleteContactParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteContactParamsWithTimeout(timeout time.Duration) *DeleteContactParams { - var () return &DeleteContactParams{ - timeout: timeout, } } // NewDeleteContactParamsWithContext creates a new DeleteContactParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteContactParamsWithContext(ctx context.Context) *DeleteContactParams { - var () return &DeleteContactParams{ - Context: ctx, } } // NewDeleteContactParamsWithHTTPClient creates a new DeleteContactParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteContactParamsWithHTTPClient(client *http.Client) *DeleteContactParams { - var () return &DeleteContactParams{ HTTPClient: client, } } -/*DeleteContactParams contains all the parameters to send to the API endpoint -for the delete contact operation typically these are written to a http.Request +/* DeleteContactParams contains all the parameters to send to the API endpoint + for the delete contact operation. + + Typically these are written to a http.Request. */ type DeleteContactParams struct { - /*ContactID - Taxnexus Contact record ID + /* ContactID. + Taxnexus Contact record ID */ ContactID *string @@ -75,6 +74,21 @@ type DeleteContactParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete contact params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteContactParams) WithDefaults() *DeleteContactParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete contact params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteContactParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete contact params func (o *DeleteContactParams) WithTimeout(timeout time.Duration) *DeleteContactParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteContactParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // query param contactId var qrContactID string + if o.ContactID != nil { qrContactID = *o.ContactID } qContactID := qrContactID if qContactID != "" { + if err := r.SetQueryParam("contactId", qContactID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/contacts/delete_contact_responses.go b/api/crm/crm_client/contacts/delete_contact_responses.go index d16a7cc..49528cf 100644 --- a/api/crm/crm_client/contacts/delete_contact_responses.go +++ b/api/crm/crm_client/contacts/delete_contact_responses.go @@ -63,9 +63,8 @@ func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteContactOK() *DeleteContactOK { return &DeleteContactOK{} } -/*DeleteContactOK handles this case with default header values. +/* DeleteContactOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteContactOK struct { func (o *DeleteContactOK) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %+v", 200, o.Payload) } - func (o *DeleteContactOK) GetPayload() *crm_models.DeleteResponse { return o.Payload } func (o *DeleteContactOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -112,7 +114,7 @@ func NewDeleteContactUnauthorized() *DeleteContactUnauthorized { return &DeleteContactUnauthorized{} } -/*DeleteContactUnauthorized handles this case with default header values. +/* DeleteContactUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteContactUnauthorized struct { func (o *DeleteContactUnauthorized) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %+v", 401, o.Payload) } - func (o *DeleteContactUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteContactUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -150,7 +155,7 @@ func NewDeleteContactForbidden() *DeleteContactForbidden { return &DeleteContactForbidden{} } -/*DeleteContactForbidden handles this case with default header values. +/* DeleteContactForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteContactForbidden struct { func (o *DeleteContactForbidden) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %+v", 403, o.Payload) } - func (o *DeleteContactForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteContactForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -188,7 +196,7 @@ func NewDeleteContactNotFound() *DeleteContactNotFound { return &DeleteContactNotFound{} } -/*DeleteContactNotFound handles this case with default header values. +/* DeleteContactNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteContactNotFound struct { func (o *DeleteContactNotFound) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %+v", 404, o.Payload) } - func (o *DeleteContactNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteContactNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -226,7 +237,7 @@ func NewDeleteContactUnprocessableEntity() *DeleteContactUnprocessableEntity { return &DeleteContactUnprocessableEntity{} } -/*DeleteContactUnprocessableEntity handles this case with default header values. +/* DeleteContactUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteContactUnprocessableEntity struct { func (o *DeleteContactUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteContactUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteContactUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -264,7 +278,7 @@ func NewDeleteContactInternalServerError() *DeleteContactInternalServerError { return &DeleteContactInternalServerError{} } -/*DeleteContactInternalServerError handles this case with default header values. +/* DeleteContactInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteContactInternalServerError struct { func (o *DeleteContactInternalServerError) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %+v", 500, o.Payload) } - func (o *DeleteContactInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteContactInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/contacts/get_contacts_observable_parameters.go b/api/crm/crm_client/contacts/get_contacts_observable_parameters.go index ef8f587..a88099e 100644 --- a/api/crm/crm_client/contacts/get_contacts_observable_parameters.go +++ b/api/crm/crm_client/contacts/get_contacts_observable_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetContactsObservableParams creates a new GetContactsObservableParams object -// with the default values initialized. +// NewGetContactsObservableParams creates a new GetContactsObservableParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetContactsObservableParams() *GetContactsObservableParams { - var () return &GetContactsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetContactsObservableParamsWithTimeout creates a new GetContactsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetContactsObservableParamsWithTimeout(timeout time.Duration) *GetContactsObservableParams { - var () return &GetContactsObservableParams{ - timeout: timeout, } } // NewGetContactsObservableParamsWithContext creates a new GetContactsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetContactsObservableParamsWithContext(ctx context.Context) *GetContactsObservableParams { - var () return &GetContactsObservableParams{ - Context: ctx, } } // NewGetContactsObservableParamsWithHTTPClient creates a new GetContactsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetContactsObservableParamsWithHTTPClient(client *http.Client) *GetContactsObservableParams { - var () return &GetContactsObservableParams{ HTTPClient: client, } } -/*GetContactsObservableParams contains all the parameters to send to the API endpoint -for the get contacts observable operation typically these are written to a http.Request +/* GetContactsObservableParams contains all the parameters to send to the API endpoint + for the get contacts observable operation. + + Typically these are written to a http.Request. */ type GetContactsObservableParams struct { - /*Active - Only retrieve active records? + /* Active. + Only retrieve active records? */ Active *bool - /*ContactID - Taxnexus Contact record ID + /* ContactID. + + Taxnexus Contact record ID */ ContactID *string - /*Email - Email address used for identity lookup + /* Email. + + Email address used for identity lookup */ Email *string - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string @@ -91,6 +93,21 @@ type GetContactsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get contacts observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContactsObservableParams) WithDefaults() *GetContactsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get contacts observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContactsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get contacts observable params func (o *GetContactsObservableParams) WithTimeout(timeout time.Duration) *GetContactsObservableParams { o.SetTimeout(timeout) @@ -180,64 +197,68 @@ func (o *GetContactsObservableParams) WriteToRequest(r runtime.ClientRequest, re // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ContactID != nil { // query param contactId var qrContactID string + if o.ContactID != nil { qrContactID = *o.ContactID } qContactID := qrContactID if qContactID != "" { + if err := r.SetQueryParam("contactId", qContactID); err != nil { return err } } - } if o.Email != nil { // query param email var qrEmail string + if o.Email != nil { qrEmail = *o.Email } qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/contacts/get_contacts_observable_responses.go b/api/crm/crm_client/contacts/get_contacts_observable_responses.go index 79df7ef..18f047c 100644 --- a/api/crm/crm_client/contacts/get_contacts_observable_responses.go +++ b/api/crm/crm_client/contacts/get_contacts_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetContactsObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetContactsObservableOK() *GetContactsObservableOK { return &GetContactsObservableOK{} } -/*GetContactsObservableOK handles this case with default header values. +/* GetContactsObservableOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Contact objects */ type GetContactsObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*crm_models.Contact } @@ -89,18 +87,25 @@ type GetContactsObservableOK struct { func (o *GetContactsObservableOK) Error() string { return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableOK %+v", 200, o.Payload) } - func (o *GetContactsObservableOK) GetPayload() []*crm_models.Contact { return o.Payload } func (o *GetContactsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetContactsObservableUnauthorized() *GetContactsObservableUnauthorized { return &GetContactsObservableUnauthorized{} } -/*GetContactsObservableUnauthorized handles this case with default header values. +/* GetContactsObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetContactsObservableUnauthorized struct { func (o *GetContactsObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetContactsObservableUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -153,7 +161,7 @@ func NewGetContactsObservableForbidden() *GetContactsObservableForbidden { return &GetContactsObservableForbidden{} } -/*GetContactsObservableForbidden handles this case with default header values. +/* GetContactsObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetContactsObservableForbidden struct { func (o *GetContactsObservableForbidden) Error() string { return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableForbidden %+v", 403, o.Payload) } - func (o *GetContactsObservableForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -191,7 +202,7 @@ func NewGetContactsObservableNotFound() *GetContactsObservableNotFound { return &GetContactsObservableNotFound{} } -/*GetContactsObservableNotFound handles this case with default header values. +/* GetContactsObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetContactsObservableNotFound struct { func (o *GetContactsObservableNotFound) Error() string { return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableNotFound %+v", 404, o.Payload) } - func (o *GetContactsObservableNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -229,7 +243,7 @@ func NewGetContactsObservableUnprocessableEntity() *GetContactsObservableUnproce return &GetContactsObservableUnprocessableEntity{} } -/*GetContactsObservableUnprocessableEntity handles this case with default header values. +/* GetContactsObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetContactsObservableUnprocessableEntity struct { func (o *GetContactsObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetContactsObservableUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -267,7 +284,7 @@ func NewGetContactsObservableInternalServerError() *GetContactsObservableInterna return &GetContactsObservableInternalServerError{} } -/*GetContactsObservableInternalServerError handles this case with default header values. +/* GetContactsObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetContactsObservableInternalServerError struct { func (o *GetContactsObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /contacts/observable][%d] getContactsObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetContactsObservableInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/contacts/get_contacts_parameters.go b/api/crm/crm_client/contacts/get_contacts_parameters.go index 155edc9..b120d2e 100644 --- a/api/crm/crm_client/contacts/get_contacts_parameters.go +++ b/api/crm/crm_client/contacts/get_contacts_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetContactsParams creates a new GetContactsParams object -// with the default values initialized. +// NewGetContactsParams creates a new GetContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetContactsParams() *GetContactsParams { - var () return &GetContactsParams{ - timeout: cr.DefaultTimeout, } } // NewGetContactsParamsWithTimeout creates a new GetContactsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetContactsParamsWithTimeout(timeout time.Duration) *GetContactsParams { - var () return &GetContactsParams{ - timeout: timeout, } } // NewGetContactsParamsWithContext creates a new GetContactsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetContactsParamsWithContext(ctx context.Context) *GetContactsParams { - var () return &GetContactsParams{ - Context: ctx, } } // NewGetContactsParamsWithHTTPClient creates a new GetContactsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetContactsParamsWithHTTPClient(client *http.Client) *GetContactsParams { - var () return &GetContactsParams{ HTTPClient: client, } } -/*GetContactsParams contains all the parameters to send to the API endpoint -for the get contacts operation typically these are written to a http.Request +/* GetContactsParams contains all the parameters to send to the API endpoint + for the get contacts operation. + + Typically these are written to a http.Request. */ type GetContactsParams struct { - /*Active - Only retrieve active records? + /* Active. + Only retrieve active records? */ Active *bool - /*ContactID - Taxnexus Contact record ID + /* ContactID. + + Taxnexus Contact record ID */ ContactID *string - /*Email - Email address used for identity lookup + /* Email. + + Email address used for identity lookup */ Email *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string - /*Offset - How many objects to skip? + /* Offset. + + How many objects to skip? + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetContactsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContactsParams) WithDefaults() *GetContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContactsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get contacts params func (o *GetContactsParams) WithTimeout(timeout time.Duration) *GetContactsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ContactID != nil { // query param contactId var qrContactID string + if o.ContactID != nil { qrContactID = *o.ContactID } qContactID := qrContactID if qContactID != "" { + if err := r.SetQueryParam("contactId", qContactID); err != nil { return err } } - } if o.Email != nil { // query param email var qrEmail string + if o.Email != nil { qrEmail = *o.Email } qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/contacts/get_contacts_responses.go b/api/crm/crm_client/contacts/get_contacts_responses.go index 3243577..78474c0 100644 --- a/api/crm/crm_client/contacts/get_contacts_responses.go +++ b/api/crm/crm_client/contacts/get_contacts_responses.go @@ -63,9 +63,8 @@ func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetContactsOK() *GetContactsOK { return &GetContactsOK{} } -/*GetContactsOK handles this case with default header values. +/* GetContactsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Contact objects */ type GetContactsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.ContactResponse } @@ -89,18 +87,25 @@ type GetContactsOK struct { func (o *GetContactsOK) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsOK %+v", 200, o.Payload) } - func (o *GetContactsOK) GetPayload() *crm_models.ContactResponse { return o.Payload } func (o *GetContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.ContactResponse) @@ -117,7 +122,7 @@ func NewGetContactsUnauthorized() *GetContactsUnauthorized { return &GetContactsUnauthorized{} } -/*GetContactsUnauthorized handles this case with default header values. +/* GetContactsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetContactsUnauthorized struct { func (o *GetContactsUnauthorized) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %+v", 401, o.Payload) } - func (o *GetContactsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewGetContactsForbidden() *GetContactsForbidden { return &GetContactsForbidden{} } -/*GetContactsForbidden handles this case with default header values. +/* GetContactsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetContactsForbidden struct { func (o *GetContactsForbidden) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %+v", 403, o.Payload) } - func (o *GetContactsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewGetContactsNotFound() *GetContactsNotFound { return &GetContactsNotFound{} } -/*GetContactsNotFound handles this case with default header values. +/* GetContactsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetContactsNotFound struct { func (o *GetContactsNotFound) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %+v", 404, o.Payload) } - func (o *GetContactsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewGetContactsUnprocessableEntity() *GetContactsUnprocessableEntity { return &GetContactsUnprocessableEntity{} } -/*GetContactsUnprocessableEntity handles this case with default header values. +/* GetContactsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetContactsUnprocessableEntity struct { func (o *GetContactsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetContactsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewGetContactsInternalServerError() *GetContactsInternalServerError { return &GetContactsInternalServerError{} } -/*GetContactsInternalServerError handles this case with default header values. +/* GetContactsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetContactsInternalServerError struct { func (o *GetContactsInternalServerError) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %+v", 500, o.Payload) } - func (o *GetContactsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetContactsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/contacts/post_contacts_parameters.go b/api/crm/crm_client/contacts/post_contacts_parameters.go index e544ca0..dd6baf4 100644 --- a/api/crm/crm_client/contacts/post_contacts_parameters.go +++ b/api/crm/crm_client/contacts/post_contacts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_models" ) -// NewPostContactsParams creates a new PostContactsParams object -// with the default values initialized. +// NewPostContactsParams creates a new PostContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPostContactsParams() *PostContactsParams { - var () return &PostContactsParams{ - timeout: cr.DefaultTimeout, } } // NewPostContactsParamsWithTimeout creates a new PostContactsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostContactsParamsWithTimeout(timeout time.Duration) *PostContactsParams { - var () return &PostContactsParams{ - timeout: timeout, } } // NewPostContactsParamsWithContext creates a new PostContactsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostContactsParamsWithContext(ctx context.Context) *PostContactsParams { - var () return &PostContactsParams{ - Context: ctx, } } // NewPostContactsParamsWithHTTPClient creates a new PostContactsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostContactsParamsWithHTTPClient(client *http.Client) *PostContactsParams { - var () return &PostContactsParams{ HTTPClient: client, } } -/*PostContactsParams contains all the parameters to send to the API endpoint -for the post contacts operation typically these are written to a http.Request +/* PostContactsParams contains all the parameters to send to the API endpoint + for the post contacts operation. + + Typically these are written to a http.Request. */ type PostContactsParams struct { - /*ContactsRequest - An array of new Contact records + /* ContactsRequest. + An array of new Contact records */ ContactsRequest *crm_models.ContactRequest @@ -77,6 +76,21 @@ type PostContactsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostContactsParams) WithDefaults() *PostContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostContactsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post contacts params func (o *PostContactsParams) WithTimeout(timeout time.Duration) *PostContactsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.ContactsRequest != nil { if err := r.SetBodyParam(o.ContactsRequest); err != nil { return err diff --git a/api/crm/crm_client/contacts/post_contacts_responses.go b/api/crm/crm_client/contacts/post_contacts_responses.go index 0b6f5ae..cd165eb 100644 --- a/api/crm/crm_client/contacts/post_contacts_responses.go +++ b/api/crm/crm_client/contacts/post_contacts_responses.go @@ -63,9 +63,8 @@ func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostContactsOK() *PostContactsOK { return &PostContactsOK{} } -/*PostContactsOK handles this case with default header values. +/* PostContactsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Contact objects */ type PostContactsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.ContactResponse } @@ -89,18 +87,25 @@ type PostContactsOK struct { func (o *PostContactsOK) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsOK %+v", 200, o.Payload) } - func (o *PostContactsOK) GetPayload() *crm_models.ContactResponse { return o.Payload } func (o *PostContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.ContactResponse) @@ -117,7 +122,7 @@ func NewPostContactsUnauthorized() *PostContactsUnauthorized { return &PostContactsUnauthorized{} } -/*PostContactsUnauthorized handles this case with default header values. +/* PostContactsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostContactsUnauthorized struct { func (o *PostContactsUnauthorized) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %+v", 401, o.Payload) } - func (o *PostContactsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PostContactsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewPostContactsForbidden() *PostContactsForbidden { return &PostContactsForbidden{} } -/*PostContactsForbidden handles this case with default header values. +/* PostContactsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostContactsForbidden struct { func (o *PostContactsForbidden) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %+v", 403, o.Payload) } - func (o *PostContactsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PostContactsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewPostContactsNotFound() *PostContactsNotFound { return &PostContactsNotFound{} } -/*PostContactsNotFound handles this case with default header values. +/* PostContactsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostContactsNotFound struct { func (o *PostContactsNotFound) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %+v", 404, o.Payload) } - func (o *PostContactsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PostContactsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewPostContactsUnprocessableEntity() *PostContactsUnprocessableEntity { return &PostContactsUnprocessableEntity{} } -/*PostContactsUnprocessableEntity handles this case with default header values. +/* PostContactsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostContactsUnprocessableEntity struct { func (o *PostContactsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostContactsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PostContactsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewPostContactsInternalServerError() *PostContactsInternalServerError { return &PostContactsInternalServerError{} } -/*PostContactsInternalServerError handles this case with default header values. +/* PostContactsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostContactsInternalServerError struct { func (o *PostContactsInternalServerError) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %+v", 500, o.Payload) } - func (o *PostContactsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PostContactsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/contacts/put_contacts_parameters.go b/api/crm/crm_client/contacts/put_contacts_parameters.go index 0c9d997..834bd12 100644 --- a/api/crm/crm_client/contacts/put_contacts_parameters.go +++ b/api/crm/crm_client/contacts/put_contacts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_models" ) -// NewPutContactsParams creates a new PutContactsParams object -// with the default values initialized. +// NewPutContactsParams creates a new PutContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPutContactsParams() *PutContactsParams { - var () return &PutContactsParams{ - timeout: cr.DefaultTimeout, } } // NewPutContactsParamsWithTimeout creates a new PutContactsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutContactsParamsWithTimeout(timeout time.Duration) *PutContactsParams { - var () return &PutContactsParams{ - timeout: timeout, } } // NewPutContactsParamsWithContext creates a new PutContactsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutContactsParamsWithContext(ctx context.Context) *PutContactsParams { - var () return &PutContactsParams{ - Context: ctx, } } // NewPutContactsParamsWithHTTPClient creates a new PutContactsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutContactsParamsWithHTTPClient(client *http.Client) *PutContactsParams { - var () return &PutContactsParams{ HTTPClient: client, } } -/*PutContactsParams contains all the parameters to send to the API endpoint -for the put contacts operation typically these are written to a http.Request +/* PutContactsParams contains all the parameters to send to the API endpoint + for the put contacts operation. + + Typically these are written to a http.Request. */ type PutContactsParams struct { - /*ContactsRequest - An array of new Contact records + /* ContactsRequest. + An array of new Contact records */ ContactsRequest *crm_models.ContactRequest @@ -77,6 +76,21 @@ type PutContactsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutContactsParams) WithDefaults() *PutContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutContactsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put contacts params func (o *PutContactsParams) WithTimeout(timeout time.Duration) *PutContactsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ContactsRequest != nil { if err := r.SetBodyParam(o.ContactsRequest); err != nil { return err diff --git a/api/crm/crm_client/contacts/put_contacts_responses.go b/api/crm/crm_client/contacts/put_contacts_responses.go index 0ab5950..7284c57 100644 --- a/api/crm/crm_client/contacts/put_contacts_responses.go +++ b/api/crm/crm_client/contacts/put_contacts_responses.go @@ -63,9 +63,8 @@ func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutContactsOK() *PutContactsOK { return &PutContactsOK{} } -/*PutContactsOK handles this case with default header values. +/* PutContactsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Contact objects */ type PutContactsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.ContactResponse } @@ -89,18 +87,25 @@ type PutContactsOK struct { func (o *PutContactsOK) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %+v", 200, o.Payload) } - func (o *PutContactsOK) GetPayload() *crm_models.ContactResponse { return o.Payload } func (o *PutContactsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.ContactResponse) @@ -117,7 +122,7 @@ func NewPutContactsUnauthorized() *PutContactsUnauthorized { return &PutContactsUnauthorized{} } -/*PutContactsUnauthorized handles this case with default header values. +/* PutContactsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutContactsUnauthorized struct { func (o *PutContactsUnauthorized) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %+v", 401, o.Payload) } - func (o *PutContactsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PutContactsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewPutContactsForbidden() *PutContactsForbidden { return &PutContactsForbidden{} } -/*PutContactsForbidden handles this case with default header values. +/* PutContactsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutContactsForbidden struct { func (o *PutContactsForbidden) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %+v", 403, o.Payload) } - func (o *PutContactsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PutContactsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewPutContactsNotFound() *PutContactsNotFound { return &PutContactsNotFound{} } -/*PutContactsNotFound handles this case with default header values. +/* PutContactsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutContactsNotFound struct { func (o *PutContactsNotFound) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %+v", 404, o.Payload) } - func (o *PutContactsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PutContactsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewPutContactsUnprocessableEntity() *PutContactsUnprocessableEntity { return &PutContactsUnprocessableEntity{} } -/*PutContactsUnprocessableEntity handles this case with default header values. +/* PutContactsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutContactsUnprocessableEntity struct { func (o *PutContactsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutContactsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PutContactsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewPutContactsInternalServerError() *PutContactsInternalServerError { return &PutContactsInternalServerError{} } -/*PutContactsInternalServerError handles this case with default header values. +/* PutContactsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutContactsInternalServerError struct { func (o *PutContactsInternalServerError) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %+v", 500, o.Payload) } - func (o *PutContactsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PutContactsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/cors/account_options_observable_parameters.go b/api/crm/crm_client/cors/account_options_observable_parameters.go index 422a3c9..76414d3 100644 --- a/api/crm/crm_client/cors/account_options_observable_parameters.go +++ b/api/crm/crm_client/cors/account_options_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewAccountOptionsObservableParams creates a new AccountOptionsObservableParams object -// with the default values initialized. +// NewAccountOptionsObservableParams creates a new AccountOptionsObservableParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewAccountOptionsObservableParams() *AccountOptionsObservableParams { - return &AccountOptionsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewAccountOptionsObservableParamsWithTimeout creates a new AccountOptionsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAccountOptionsObservableParamsWithTimeout(timeout time.Duration) *AccountOptionsObservableParams { - return &AccountOptionsObservableParams{ - timeout: timeout, } } // NewAccountOptionsObservableParamsWithContext creates a new AccountOptionsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAccountOptionsObservableParamsWithContext(ctx context.Context) *AccountOptionsObservableParams { - return &AccountOptionsObservableParams{ - Context: ctx, } } // NewAccountOptionsObservableParamsWithHTTPClient creates a new AccountOptionsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAccountOptionsObservableParamsWithHTTPClient(client *http.Client) *AccountOptionsObservableParams { - return &AccountOptionsObservableParams{ HTTPClient: client, } } -/*AccountOptionsObservableParams contains all the parameters to send to the API endpoint -for the account options observable operation typically these are written to a http.Request +/* AccountOptionsObservableParams contains all the parameters to send to the API endpoint + for the account options observable operation. + + Typically these are written to a http.Request. */ type AccountOptionsObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type AccountOptionsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the account options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountOptionsObservableParams) WithDefaults() *AccountOptionsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountOptionsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the account options observable params func (o *AccountOptionsObservableParams) WithTimeout(timeout time.Duration) *AccountOptionsObservableParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/account_options_observable_responses.go b/api/crm/crm_client/cors/account_options_observable_responses.go index b8eaf91..8c960eb 100644 --- a/api/crm/crm_client/cors/account_options_observable_responses.go +++ b/api/crm/crm_client/cors/account_options_observable_responses.go @@ -30,9 +30,8 @@ func (o *AccountOptionsObservableReader) ReadResponse(response runtime.ClientRes return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewAccountOptionsObservableOK() *AccountOptionsObservableOK { return &AccountOptionsObservableOK{} } -/*AccountOptionsObservableOK handles this case with default header values. +/* AccountOptionsObservableOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type AccountOptionsObservableOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *AccountOptionsObservableOK) Error() string { @@ -67,26 +60,54 @@ func (o *AccountOptionsObservableOK) Error() string { func (o *AccountOptionsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/cors/account_options_parameters.go b/api/crm/crm_client/cors/account_options_parameters.go index 777b99c..305bbf5 100644 --- a/api/crm/crm_client/cors/account_options_parameters.go +++ b/api/crm/crm_client/cors/account_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewAccountOptionsParams creates a new AccountOptionsParams object -// with the default values initialized. +// NewAccountOptionsParams creates a new AccountOptionsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewAccountOptionsParams() *AccountOptionsParams { - return &AccountOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewAccountOptionsParamsWithTimeout creates a new AccountOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAccountOptionsParamsWithTimeout(timeout time.Duration) *AccountOptionsParams { - return &AccountOptionsParams{ - timeout: timeout, } } // NewAccountOptionsParamsWithContext creates a new AccountOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAccountOptionsParamsWithContext(ctx context.Context) *AccountOptionsParams { - return &AccountOptionsParams{ - Context: ctx, } } // NewAccountOptionsParamsWithHTTPClient creates a new AccountOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAccountOptionsParamsWithHTTPClient(client *http.Client) *AccountOptionsParams { - return &AccountOptionsParams{ HTTPClient: client, } } -/*AccountOptionsParams contains all the parameters to send to the API endpoint -for the account options operation typically these are written to a http.Request +/* AccountOptionsParams contains all the parameters to send to the API endpoint + for the account options operation. + + Typically these are written to a http.Request. */ type AccountOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type AccountOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the account options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountOptionsParams) WithDefaults() *AccountOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the account options params func (o *AccountOptionsParams) WithTimeout(timeout time.Duration) *AccountOptionsParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/account_options_responses.go b/api/crm/crm_client/cors/account_options_responses.go index 324e979..3e51a40 100644 --- a/api/crm/crm_client/cors/account_options_responses.go +++ b/api/crm/crm_client/cors/account_options_responses.go @@ -30,9 +30,8 @@ func (o *AccountOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewAccountOptionsOK() *AccountOptionsOK { return &AccountOptionsOK{} } -/*AccountOptionsOK handles this case with default header values. +/* AccountOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type AccountOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *AccountOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *AccountOptionsOK) Error() string { func (o *AccountOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/cors/company_observable_options_parameters.go b/api/crm/crm_client/cors/company_observable_options_parameters.go index 651a74e..53979a4 100644 --- a/api/crm/crm_client/cors/company_observable_options_parameters.go +++ b/api/crm/crm_client/cors/company_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewCompanyObservableOptionsParams creates a new CompanyObservableOptionsParams object -// with the default values initialized. +// NewCompanyObservableOptionsParams creates a new CompanyObservableOptionsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewCompanyObservableOptionsParams() *CompanyObservableOptionsParams { - return &CompanyObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewCompanyObservableOptionsParamsWithTimeout creates a new CompanyObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewCompanyObservableOptionsParamsWithTimeout(timeout time.Duration) *CompanyObservableOptionsParams { - return &CompanyObservableOptionsParams{ - timeout: timeout, } } // NewCompanyObservableOptionsParamsWithContext creates a new CompanyObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewCompanyObservableOptionsParamsWithContext(ctx context.Context) *CompanyObservableOptionsParams { - return &CompanyObservableOptionsParams{ - Context: ctx, } } // NewCompanyObservableOptionsParamsWithHTTPClient creates a new CompanyObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewCompanyObservableOptionsParamsWithHTTPClient(client *http.Client) *CompanyObservableOptionsParams { - return &CompanyObservableOptionsParams{ HTTPClient: client, } } -/*CompanyObservableOptionsParams contains all the parameters to send to the API endpoint -for the company observable options operation typically these are written to a http.Request +/* CompanyObservableOptionsParams contains all the parameters to send to the API endpoint + for the company observable options operation. + + Typically these are written to a http.Request. */ type CompanyObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type CompanyObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the company observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CompanyObservableOptionsParams) WithDefaults() *CompanyObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the company observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CompanyObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the company observable options params func (o *CompanyObservableOptionsParams) WithTimeout(timeout time.Duration) *CompanyObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/company_observable_options_responses.go b/api/crm/crm_client/cors/company_observable_options_responses.go index db080a6..ce186f7 100644 --- a/api/crm/crm_client/cors/company_observable_options_responses.go +++ b/api/crm/crm_client/cors/company_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *CompanyObservableOptionsReader) ReadResponse(response runtime.ClientRes return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewCompanyObservableOptionsOK() *CompanyObservableOptionsOK { return &CompanyObservableOptionsOK{} } -/*CompanyObservableOptionsOK handles this case with default header values. +/* CompanyObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type CompanyObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *CompanyObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *CompanyObservableOptionsOK) Error() string { func (o *CompanyObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/cors/company_options_parameters.go b/api/crm/crm_client/cors/company_options_parameters.go index 6800bd5..5993855 100644 --- a/api/crm/crm_client/cors/company_options_parameters.go +++ b/api/crm/crm_client/cors/company_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewCompanyOptionsParams creates a new CompanyOptionsParams object -// with the default values initialized. +// NewCompanyOptionsParams creates a new CompanyOptionsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewCompanyOptionsParams() *CompanyOptionsParams { - return &CompanyOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewCompanyOptionsParamsWithTimeout creates a new CompanyOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewCompanyOptionsParamsWithTimeout(timeout time.Duration) *CompanyOptionsParams { - return &CompanyOptionsParams{ - timeout: timeout, } } // NewCompanyOptionsParamsWithContext creates a new CompanyOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewCompanyOptionsParamsWithContext(ctx context.Context) *CompanyOptionsParams { - return &CompanyOptionsParams{ - Context: ctx, } } // NewCompanyOptionsParamsWithHTTPClient creates a new CompanyOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewCompanyOptionsParamsWithHTTPClient(client *http.Client) *CompanyOptionsParams { - return &CompanyOptionsParams{ HTTPClient: client, } } -/*CompanyOptionsParams contains all the parameters to send to the API endpoint -for the company options operation typically these are written to a http.Request +/* CompanyOptionsParams contains all the parameters to send to the API endpoint + for the company options operation. + + Typically these are written to a http.Request. */ type CompanyOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type CompanyOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the company options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CompanyOptionsParams) WithDefaults() *CompanyOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the company options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CompanyOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the company options params func (o *CompanyOptionsParams) WithTimeout(timeout time.Duration) *CompanyOptionsParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/company_options_responses.go b/api/crm/crm_client/cors/company_options_responses.go index e3fa2f2..1199d7e 100644 --- a/api/crm/crm_client/cors/company_options_responses.go +++ b/api/crm/crm_client/cors/company_options_responses.go @@ -30,9 +30,8 @@ func (o *CompanyOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewCompanyOptionsOK() *CompanyOptionsOK { return &CompanyOptionsOK{} } -/*CompanyOptionsOK handles this case with default header values. +/* CompanyOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type CompanyOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *CompanyOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *CompanyOptionsOK) Error() string { func (o *CompanyOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/cors/contact_options_observable_parameters.go b/api/crm/crm_client/cors/contact_options_observable_parameters.go index dac7626..97e2873 100644 --- a/api/crm/crm_client/cors/contact_options_observable_parameters.go +++ b/api/crm/crm_client/cors/contact_options_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewContactOptionsObservableParams creates a new ContactOptionsObservableParams object -// with the default values initialized. +// NewContactOptionsObservableParams creates a new ContactOptionsObservableParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewContactOptionsObservableParams() *ContactOptionsObservableParams { - return &ContactOptionsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewContactOptionsObservableParamsWithTimeout creates a new ContactOptionsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewContactOptionsObservableParamsWithTimeout(timeout time.Duration) *ContactOptionsObservableParams { - return &ContactOptionsObservableParams{ - timeout: timeout, } } // NewContactOptionsObservableParamsWithContext creates a new ContactOptionsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewContactOptionsObservableParamsWithContext(ctx context.Context) *ContactOptionsObservableParams { - return &ContactOptionsObservableParams{ - Context: ctx, } } // NewContactOptionsObservableParamsWithHTTPClient creates a new ContactOptionsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewContactOptionsObservableParamsWithHTTPClient(client *http.Client) *ContactOptionsObservableParams { - return &ContactOptionsObservableParams{ HTTPClient: client, } } -/*ContactOptionsObservableParams contains all the parameters to send to the API endpoint -for the contact options observable operation typically these are written to a http.Request +/* ContactOptionsObservableParams contains all the parameters to send to the API endpoint + for the contact options observable operation. + + Typically these are written to a http.Request. */ type ContactOptionsObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ContactOptionsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the contact options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ContactOptionsObservableParams) WithDefaults() *ContactOptionsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the contact options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ContactOptionsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the contact options observable params func (o *ContactOptionsObservableParams) WithTimeout(timeout time.Duration) *ContactOptionsObservableParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/contact_options_observable_responses.go b/api/crm/crm_client/cors/contact_options_observable_responses.go index 932fe5c..4b86cce 100644 --- a/api/crm/crm_client/cors/contact_options_observable_responses.go +++ b/api/crm/crm_client/cors/contact_options_observable_responses.go @@ -30,9 +30,8 @@ func (o *ContactOptionsObservableReader) ReadResponse(response runtime.ClientRes return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewContactOptionsObservableOK() *ContactOptionsObservableOK { return &ContactOptionsObservableOK{} } -/*ContactOptionsObservableOK handles this case with default header values. +/* ContactOptionsObservableOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ContactOptionsObservableOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ContactOptionsObservableOK) Error() string { @@ -67,26 +60,54 @@ func (o *ContactOptionsObservableOK) Error() string { func (o *ContactOptionsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/cors/contact_options_parameters.go b/api/crm/crm_client/cors/contact_options_parameters.go index 38179f7..7cf8c62 100644 --- a/api/crm/crm_client/cors/contact_options_parameters.go +++ b/api/crm/crm_client/cors/contact_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewContactOptionsParams creates a new ContactOptionsParams object -// with the default values initialized. +// NewContactOptionsParams creates a new ContactOptionsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewContactOptionsParams() *ContactOptionsParams { - return &ContactOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewContactOptionsParamsWithTimeout creates a new ContactOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewContactOptionsParamsWithTimeout(timeout time.Duration) *ContactOptionsParams { - return &ContactOptionsParams{ - timeout: timeout, } } // NewContactOptionsParamsWithContext creates a new ContactOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewContactOptionsParamsWithContext(ctx context.Context) *ContactOptionsParams { - return &ContactOptionsParams{ - Context: ctx, } } // NewContactOptionsParamsWithHTTPClient creates a new ContactOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewContactOptionsParamsWithHTTPClient(client *http.Client) *ContactOptionsParams { - return &ContactOptionsParams{ HTTPClient: client, } } -/*ContactOptionsParams contains all the parameters to send to the API endpoint -for the contact options operation typically these are written to a http.Request +/* ContactOptionsParams contains all the parameters to send to the API endpoint + for the contact options operation. + + Typically these are written to a http.Request. */ type ContactOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ContactOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the contact options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ContactOptionsParams) WithDefaults() *ContactOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the contact options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ContactOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the contact options params func (o *ContactOptionsParams) WithTimeout(timeout time.Duration) *ContactOptionsParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/contact_options_responses.go b/api/crm/crm_client/cors/contact_options_responses.go index 2afa612..bdb3599 100644 --- a/api/crm/crm_client/cors/contact_options_responses.go +++ b/api/crm/crm_client/cors/contact_options_responses.go @@ -30,9 +30,8 @@ func (o *ContactOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewContactOptionsOK() *ContactOptionsOK { return &ContactOptionsOK{} } -/*ContactOptionsOK handles this case with default header values. +/* ContactOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ContactOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ContactOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *ContactOptionsOK) Error() string { func (o *ContactOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/cors/cors_client.go b/api/crm/crm_client/cors/cors_client.go index 79ff649..3b1072b 100644 --- a/api/crm/crm_client/cors/cors_client.go +++ b/api/crm/crm_client/cors/cors_client.go @@ -29,23 +29,26 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - AccountOptions(params *AccountOptionsParams) (*AccountOptionsOK, error) + AccountOptions(params *AccountOptionsParams, opts ...ClientOption) (*AccountOptionsOK, error) - AccountOptionsObservable(params *AccountOptionsObservableParams) (*AccountOptionsObservableOK, error) + AccountOptionsObservable(params *AccountOptionsObservableParams, opts ...ClientOption) (*AccountOptionsObservableOK, error) - CompanyObservableOptions(params *CompanyObservableOptionsParams) (*CompanyObservableOptionsOK, error) + CompanyObservableOptions(params *CompanyObservableOptionsParams, opts ...ClientOption) (*CompanyObservableOptionsOK, error) - CompanyOptions(params *CompanyOptionsParams) (*CompanyOptionsOK, error) + CompanyOptions(params *CompanyOptionsParams, opts ...ClientOption) (*CompanyOptionsOK, error) - ContactOptions(params *ContactOptionsParams) (*ContactOptionsOK, error) + ContactOptions(params *ContactOptionsParams, opts ...ClientOption) (*ContactOptionsOK, error) - ContactOptionsObservable(params *ContactOptionsObservableParams) (*ContactOptionsObservableOK, error) + ContactOptionsObservable(params *ContactOptionsObservableParams, opts ...ClientOption) (*ContactOptionsObservableOK, error) - LeadOptions(params *LeadOptionsParams) (*LeadOptionsOK, error) + LeadOptions(params *LeadOptionsParams, opts ...ClientOption) (*LeadOptionsOK, error) - LeadOptionsObservable(params *LeadOptionsObservableParams) (*LeadOptionsObservableOK, error) + LeadOptionsObservable(params *LeadOptionsObservableParams, opts ...ClientOption) (*LeadOptionsObservableOK, error) SetTransport(transport runtime.ClientTransport) } @@ -53,13 +56,12 @@ type ClientService interface { /* AccountOptions CORS support */ -func (a *Client) AccountOptions(params *AccountOptionsParams) (*AccountOptionsOK, error) { +func (a *Client) AccountOptions(params *AccountOptionsParams, opts ...ClientOption) (*AccountOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAccountOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "accountOptions", Method: "OPTIONS", PathPattern: "/accounts", @@ -70,7 +72,12 @@ func (a *Client) AccountOptions(params *AccountOptionsParams) (*AccountOptionsOK Reader: &AccountOptionsReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -87,13 +94,12 @@ func (a *Client) AccountOptions(params *AccountOptionsParams) (*AccountOptionsOK /* AccountOptionsObservable CORS support */ -func (a *Client) AccountOptionsObservable(params *AccountOptionsObservableParams) (*AccountOptionsObservableOK, error) { +func (a *Client) AccountOptionsObservable(params *AccountOptionsObservableParams, opts ...ClientOption) (*AccountOptionsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAccountOptionsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "accountOptionsObservable", Method: "OPTIONS", PathPattern: "/accounts/observable", @@ -104,7 +110,12 @@ func (a *Client) AccountOptionsObservable(params *AccountOptionsObservableParams Reader: &AccountOptionsObservableReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -121,13 +132,12 @@ func (a *Client) AccountOptionsObservable(params *AccountOptionsObservableParams /* CompanyObservableOptions CORS support */ -func (a *Client) CompanyObservableOptions(params *CompanyObservableOptionsParams) (*CompanyObservableOptionsOK, error) { +func (a *Client) CompanyObservableOptions(params *CompanyObservableOptionsParams, opts ...ClientOption) (*CompanyObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewCompanyObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "companyObservableOptions", Method: "OPTIONS", PathPattern: "/companies/observable", @@ -138,7 +148,12 @@ func (a *Client) CompanyObservableOptions(params *CompanyObservableOptionsParams Reader: &CompanyObservableOptionsReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -155,13 +170,12 @@ func (a *Client) CompanyObservableOptions(params *CompanyObservableOptionsParams /* CompanyOptions CORS support */ -func (a *Client) CompanyOptions(params *CompanyOptionsParams) (*CompanyOptionsOK, error) { +func (a *Client) CompanyOptions(params *CompanyOptionsParams, opts ...ClientOption) (*CompanyOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewCompanyOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "companyOptions", Method: "OPTIONS", PathPattern: "/companies", @@ -172,7 +186,12 @@ func (a *Client) CompanyOptions(params *CompanyOptionsParams) (*CompanyOptionsOK Reader: &CompanyOptionsReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -189,13 +208,12 @@ func (a *Client) CompanyOptions(params *CompanyOptionsParams) (*CompanyOptionsOK /* ContactOptions CORS support */ -func (a *Client) ContactOptions(params *ContactOptionsParams) (*ContactOptionsOK, error) { +func (a *Client) ContactOptions(params *ContactOptionsParams, opts ...ClientOption) (*ContactOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewContactOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "contactOptions", Method: "OPTIONS", PathPattern: "/contacts", @@ -206,7 +224,12 @@ func (a *Client) ContactOptions(params *ContactOptionsParams) (*ContactOptionsOK Reader: &ContactOptionsReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -223,13 +246,12 @@ func (a *Client) ContactOptions(params *ContactOptionsParams) (*ContactOptionsOK /* ContactOptionsObservable CORS support */ -func (a *Client) ContactOptionsObservable(params *ContactOptionsObservableParams) (*ContactOptionsObservableOK, error) { +func (a *Client) ContactOptionsObservable(params *ContactOptionsObservableParams, opts ...ClientOption) (*ContactOptionsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewContactOptionsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "contactOptionsObservable", Method: "OPTIONS", PathPattern: "/contacts/observable", @@ -240,7 +262,12 @@ func (a *Client) ContactOptionsObservable(params *ContactOptionsObservableParams Reader: &ContactOptionsObservableReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -257,13 +284,12 @@ func (a *Client) ContactOptionsObservable(params *ContactOptionsObservableParams /* LeadOptions CORS support */ -func (a *Client) LeadOptions(params *LeadOptionsParams) (*LeadOptionsOK, error) { +func (a *Client) LeadOptions(params *LeadOptionsParams, opts ...ClientOption) (*LeadOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewLeadOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "leadOptions", Method: "OPTIONS", PathPattern: "/leads", @@ -274,7 +300,12 @@ func (a *Client) LeadOptions(params *LeadOptionsParams) (*LeadOptionsOK, error) Reader: &LeadOptionsReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -291,13 +322,12 @@ func (a *Client) LeadOptions(params *LeadOptionsParams) (*LeadOptionsOK, error) /* LeadOptionsObservable CORS support */ -func (a *Client) LeadOptionsObservable(params *LeadOptionsObservableParams) (*LeadOptionsObservableOK, error) { +func (a *Client) LeadOptionsObservable(params *LeadOptionsObservableParams, opts ...ClientOption) (*LeadOptionsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewLeadOptionsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "leadOptionsObservable", Method: "OPTIONS", PathPattern: "/leads/observable", @@ -308,7 +338,12 @@ func (a *Client) LeadOptionsObservable(params *LeadOptionsObservableParams) (*Le Reader: &LeadOptionsObservableReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } diff --git a/api/crm/crm_client/cors/lead_options_observable_parameters.go b/api/crm/crm_client/cors/lead_options_observable_parameters.go index 28e8dd5..a88cf72 100644 --- a/api/crm/crm_client/cors/lead_options_observable_parameters.go +++ b/api/crm/crm_client/cors/lead_options_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewLeadOptionsObservableParams creates a new LeadOptionsObservableParams object -// with the default values initialized. +// NewLeadOptionsObservableParams creates a new LeadOptionsObservableParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewLeadOptionsObservableParams() *LeadOptionsObservableParams { - return &LeadOptionsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewLeadOptionsObservableParamsWithTimeout creates a new LeadOptionsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewLeadOptionsObservableParamsWithTimeout(timeout time.Duration) *LeadOptionsObservableParams { - return &LeadOptionsObservableParams{ - timeout: timeout, } } // NewLeadOptionsObservableParamsWithContext creates a new LeadOptionsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewLeadOptionsObservableParamsWithContext(ctx context.Context) *LeadOptionsObservableParams { - return &LeadOptionsObservableParams{ - Context: ctx, } } // NewLeadOptionsObservableParamsWithHTTPClient creates a new LeadOptionsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewLeadOptionsObservableParamsWithHTTPClient(client *http.Client) *LeadOptionsObservableParams { - return &LeadOptionsObservableParams{ HTTPClient: client, } } -/*LeadOptionsObservableParams contains all the parameters to send to the API endpoint -for the lead options observable operation typically these are written to a http.Request +/* LeadOptionsObservableParams contains all the parameters to send to the API endpoint + for the lead options observable operation. + + Typically these are written to a http.Request. */ type LeadOptionsObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type LeadOptionsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the lead options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LeadOptionsObservableParams) WithDefaults() *LeadOptionsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the lead options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LeadOptionsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the lead options observable params func (o *LeadOptionsObservableParams) WithTimeout(timeout time.Duration) *LeadOptionsObservableParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/lead_options_observable_responses.go b/api/crm/crm_client/cors/lead_options_observable_responses.go index 655ae4e..e9c5911 100644 --- a/api/crm/crm_client/cors/lead_options_observable_responses.go +++ b/api/crm/crm_client/cors/lead_options_observable_responses.go @@ -30,9 +30,8 @@ func (o *LeadOptionsObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewLeadOptionsObservableOK() *LeadOptionsObservableOK { return &LeadOptionsObservableOK{} } -/*LeadOptionsObservableOK handles this case with default header values. +/* LeadOptionsObservableOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type LeadOptionsObservableOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *LeadOptionsObservableOK) Error() string { @@ -67,26 +60,54 @@ func (o *LeadOptionsObservableOK) Error() string { func (o *LeadOptionsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/cors/lead_options_parameters.go b/api/crm/crm_client/cors/lead_options_parameters.go index f11b41a..24d6ff5 100644 --- a/api/crm/crm_client/cors/lead_options_parameters.go +++ b/api/crm/crm_client/cors/lead_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewLeadOptionsParams creates a new LeadOptionsParams object -// with the default values initialized. +// NewLeadOptionsParams creates a new LeadOptionsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewLeadOptionsParams() *LeadOptionsParams { - return &LeadOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewLeadOptionsParamsWithTimeout creates a new LeadOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewLeadOptionsParamsWithTimeout(timeout time.Duration) *LeadOptionsParams { - return &LeadOptionsParams{ - timeout: timeout, } } // NewLeadOptionsParamsWithContext creates a new LeadOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewLeadOptionsParamsWithContext(ctx context.Context) *LeadOptionsParams { - return &LeadOptionsParams{ - Context: ctx, } } // NewLeadOptionsParamsWithHTTPClient creates a new LeadOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewLeadOptionsParamsWithHTTPClient(client *http.Client) *LeadOptionsParams { - return &LeadOptionsParams{ HTTPClient: client, } } -/*LeadOptionsParams contains all the parameters to send to the API endpoint -for the lead options operation typically these are written to a http.Request +/* LeadOptionsParams contains all the parameters to send to the API endpoint + for the lead options operation. + + Typically these are written to a http.Request. */ type LeadOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type LeadOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the lead options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LeadOptionsParams) WithDefaults() *LeadOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the lead options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LeadOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the lead options params func (o *LeadOptionsParams) WithTimeout(timeout time.Duration) *LeadOptionsParams { o.SetTimeout(timeout) diff --git a/api/crm/crm_client/cors/lead_options_responses.go b/api/crm/crm_client/cors/lead_options_responses.go index c478140..73e7545 100644 --- a/api/crm/crm_client/cors/lead_options_responses.go +++ b/api/crm/crm_client/cors/lead_options_responses.go @@ -30,9 +30,8 @@ func (o *LeadOptionsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewLeadOptionsOK() *LeadOptionsOK { return &LeadOptionsOK{} } -/*LeadOptionsOK handles this case with default header values. +/* LeadOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type LeadOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *LeadOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *LeadOptionsOK) Error() string { func (o *LeadOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/crm/crm_client/leads/delete_lead_parameters.go b/api/crm/crm_client/leads/delete_lead_parameters.go index ab2a975..1098f19 100644 --- a/api/crm/crm_client/leads/delete_lead_parameters.go +++ b/api/crm/crm_client/leads/delete_lead_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteLeadParams creates a new DeleteLeadParams object -// with the default values initialized. +// NewDeleteLeadParams creates a new DeleteLeadParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDeleteLeadParams() *DeleteLeadParams { - var () return &DeleteLeadParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteLeadParamsWithTimeout creates a new DeleteLeadParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteLeadParamsWithTimeout(timeout time.Duration) *DeleteLeadParams { - var () return &DeleteLeadParams{ - timeout: timeout, } } // NewDeleteLeadParamsWithContext creates a new DeleteLeadParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteLeadParamsWithContext(ctx context.Context) *DeleteLeadParams { - var () return &DeleteLeadParams{ - Context: ctx, } } // NewDeleteLeadParamsWithHTTPClient creates a new DeleteLeadParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteLeadParamsWithHTTPClient(client *http.Client) *DeleteLeadParams { - var () return &DeleteLeadParams{ HTTPClient: client, } } -/*DeleteLeadParams contains all the parameters to send to the API endpoint -for the delete lead operation typically these are written to a http.Request +/* DeleteLeadParams contains all the parameters to send to the API endpoint + for the delete lead operation. + + Typically these are written to a http.Request. */ type DeleteLeadParams struct { - /*LeadID - Taxnexus Lead record ID + /* LeadID. + Taxnexus Lead record ID */ LeadID *string @@ -75,6 +74,21 @@ type DeleteLeadParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete lead params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteLeadParams) WithDefaults() *DeleteLeadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete lead params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteLeadParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete lead params func (o *DeleteLeadParams) WithTimeout(timeout time.Duration) *DeleteLeadParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteLeadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param leadId var qrLeadID string + if o.LeadID != nil { qrLeadID = *o.LeadID } qLeadID := qrLeadID if qLeadID != "" { + if err := r.SetQueryParam("leadId", qLeadID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/leads/delete_lead_responses.go b/api/crm/crm_client/leads/delete_lead_responses.go index 44904a6..4ddb297 100644 --- a/api/crm/crm_client/leads/delete_lead_responses.go +++ b/api/crm/crm_client/leads/delete_lead_responses.go @@ -63,9 +63,8 @@ func (o *DeleteLeadReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteLeadOK() *DeleteLeadOK { return &DeleteLeadOK{} } -/*DeleteLeadOK handles this case with default header values. +/* DeleteLeadOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteLeadOK struct { func (o *DeleteLeadOK) Error() string { return fmt.Sprintf("[DELETE /leads][%d] deleteLeadOK %+v", 200, o.Payload) } - func (o *DeleteLeadOK) GetPayload() *crm_models.DeleteResponse { return o.Payload } func (o *DeleteLeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -112,7 +114,7 @@ func NewDeleteLeadUnauthorized() *DeleteLeadUnauthorized { return &DeleteLeadUnauthorized{} } -/*DeleteLeadUnauthorized handles this case with default header values. +/* DeleteLeadUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteLeadUnauthorized struct { func (o *DeleteLeadUnauthorized) Error() string { return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnauthorized %+v", 401, o.Payload) } - func (o *DeleteLeadUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteLeadUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -150,7 +155,7 @@ func NewDeleteLeadForbidden() *DeleteLeadForbidden { return &DeleteLeadForbidden{} } -/*DeleteLeadForbidden handles this case with default header values. +/* DeleteLeadForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteLeadForbidden struct { func (o *DeleteLeadForbidden) Error() string { return fmt.Sprintf("[DELETE /leads][%d] deleteLeadForbidden %+v", 403, o.Payload) } - func (o *DeleteLeadForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteLeadForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -188,7 +196,7 @@ func NewDeleteLeadNotFound() *DeleteLeadNotFound { return &DeleteLeadNotFound{} } -/*DeleteLeadNotFound handles this case with default header values. +/* DeleteLeadNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteLeadNotFound struct { func (o *DeleteLeadNotFound) Error() string { return fmt.Sprintf("[DELETE /leads][%d] deleteLeadNotFound %+v", 404, o.Payload) } - func (o *DeleteLeadNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteLeadNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -226,7 +237,7 @@ func NewDeleteLeadUnprocessableEntity() *DeleteLeadUnprocessableEntity { return &DeleteLeadUnprocessableEntity{} } -/*DeleteLeadUnprocessableEntity handles this case with default header values. +/* DeleteLeadUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteLeadUnprocessableEntity struct { func (o *DeleteLeadUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /leads][%d] deleteLeadUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteLeadUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteLeadUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -264,7 +278,7 @@ func NewDeleteLeadInternalServerError() *DeleteLeadInternalServerError { return &DeleteLeadInternalServerError{} } -/*DeleteLeadInternalServerError handles this case with default header values. +/* DeleteLeadInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteLeadInternalServerError struct { func (o *DeleteLeadInternalServerError) Error() string { return fmt.Sprintf("[DELETE /leads][%d] deleteLeadInternalServerError %+v", 500, o.Payload) } - func (o *DeleteLeadInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *DeleteLeadInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/leads/get_leads_observable_parameters.go b/api/crm/crm_client/leads/get_leads_observable_parameters.go index 10acbb9..47b07db 100644 --- a/api/crm/crm_client/leads/get_leads_observable_parameters.go +++ b/api/crm/crm_client/leads/get_leads_observable_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetLeadsObservableParams creates a new GetLeadsObservableParams object -// with the default values initialized. +// NewGetLeadsObservableParams creates a new GetLeadsObservableParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetLeadsObservableParams() *GetLeadsObservableParams { - var () return &GetLeadsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetLeadsObservableParamsWithTimeout creates a new GetLeadsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLeadsObservableParamsWithTimeout(timeout time.Duration) *GetLeadsObservableParams { - var () return &GetLeadsObservableParams{ - timeout: timeout, } } // NewGetLeadsObservableParamsWithContext creates a new GetLeadsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLeadsObservableParamsWithContext(ctx context.Context) *GetLeadsObservableParams { - var () return &GetLeadsObservableParams{ - Context: ctx, } } // NewGetLeadsObservableParamsWithHTTPClient creates a new GetLeadsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLeadsObservableParamsWithHTTPClient(client *http.Client) *GetLeadsObservableParams { - var () return &GetLeadsObservableParams{ HTTPClient: client, } } -/*GetLeadsObservableParams contains all the parameters to send to the API endpoint -for the get leads observable operation typically these are written to a http.Request +/* GetLeadsObservableParams contains all the parameters to send to the API endpoint + for the get leads observable operation. + + Typically these are written to a http.Request. */ type GetLeadsObservableParams struct { - /*Email - Email address used for identity lookup + /* Email. + Email address used for identity lookup */ Email *string - /*LeadID - Taxnexus Lead record ID + /* LeadID. + + Taxnexus Lead record ID */ LeadID *string - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string @@ -85,6 +86,21 @@ type GetLeadsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get leads observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeadsObservableParams) WithDefaults() *GetLeadsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get leads observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeadsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get leads observable params func (o *GetLeadsObservableParams) WithTimeout(timeout time.Duration) *GetLeadsObservableParams { o.SetTimeout(timeout) @@ -163,48 +179,51 @@ func (o *GetLeadsObservableParams) WriteToRequest(r runtime.ClientRequest, reg s // query param email var qrEmail string + if o.Email != nil { qrEmail = *o.Email } qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } } - } if o.LeadID != nil { // query param leadId var qrLeadID string + if o.LeadID != nil { qrLeadID = *o.LeadID } qLeadID := qrLeadID if qLeadID != "" { + if err := r.SetQueryParam("leadId", qLeadID); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/leads/get_leads_observable_responses.go b/api/crm/crm_client/leads/get_leads_observable_responses.go index f80f0a1..7a9ac86 100644 --- a/api/crm/crm_client/leads/get_leads_observable_responses.go +++ b/api/crm/crm_client/leads/get_leads_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetLeadsObservableReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetLeadsObservableOK() *GetLeadsObservableOK { return &GetLeadsObservableOK{} } -/*GetLeadsObservableOK handles this case with default header values. +/* GetLeadsObservableOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Lead objects */ type GetLeadsObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*crm_models.Lead } @@ -89,18 +87,25 @@ type GetLeadsObservableOK struct { func (o *GetLeadsObservableOK) Error() string { return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableOK %+v", 200, o.Payload) } - func (o *GetLeadsObservableOK) GetPayload() []*crm_models.Lead { return o.Payload } func (o *GetLeadsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetLeadsObservableUnauthorized() *GetLeadsObservableUnauthorized { return &GetLeadsObservableUnauthorized{} } -/*GetLeadsObservableUnauthorized handles this case with default header values. +/* GetLeadsObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetLeadsObservableUnauthorized struct { func (o *GetLeadsObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetLeadsObservableUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -153,7 +161,7 @@ func NewGetLeadsObservableForbidden() *GetLeadsObservableForbidden { return &GetLeadsObservableForbidden{} } -/*GetLeadsObservableForbidden handles this case with default header values. +/* GetLeadsObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetLeadsObservableForbidden struct { func (o *GetLeadsObservableForbidden) Error() string { return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableForbidden %+v", 403, o.Payload) } - func (o *GetLeadsObservableForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -191,7 +202,7 @@ func NewGetLeadsObservableNotFound() *GetLeadsObservableNotFound { return &GetLeadsObservableNotFound{} } -/*GetLeadsObservableNotFound handles this case with default header values. +/* GetLeadsObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetLeadsObservableNotFound struct { func (o *GetLeadsObservableNotFound) Error() string { return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableNotFound %+v", 404, o.Payload) } - func (o *GetLeadsObservableNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -229,7 +243,7 @@ func NewGetLeadsObservableUnprocessableEntity() *GetLeadsObservableUnprocessable return &GetLeadsObservableUnprocessableEntity{} } -/*GetLeadsObservableUnprocessableEntity handles this case with default header values. +/* GetLeadsObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetLeadsObservableUnprocessableEntity struct { func (o *GetLeadsObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetLeadsObservableUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -267,7 +284,7 @@ func NewGetLeadsObservableInternalServerError() *GetLeadsObservableInternalServe return &GetLeadsObservableInternalServerError{} } -/*GetLeadsObservableInternalServerError handles this case with default header values. +/* GetLeadsObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetLeadsObservableInternalServerError struct { func (o *GetLeadsObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /leads/observable][%d] getLeadsObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetLeadsObservableInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/leads/get_leads_parameters.go b/api/crm/crm_client/leads/get_leads_parameters.go index 1265d7f..bc75839 100644 --- a/api/crm/crm_client/leads/get_leads_parameters.go +++ b/api/crm/crm_client/leads/get_leads_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetLeadsParams creates a new GetLeadsParams object -// with the default values initialized. +// NewGetLeadsParams creates a new GetLeadsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetLeadsParams() *GetLeadsParams { - var () return &GetLeadsParams{ - timeout: cr.DefaultTimeout, } } // NewGetLeadsParamsWithTimeout creates a new GetLeadsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLeadsParamsWithTimeout(timeout time.Duration) *GetLeadsParams { - var () return &GetLeadsParams{ - timeout: timeout, } } // NewGetLeadsParamsWithContext creates a new GetLeadsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLeadsParamsWithContext(ctx context.Context) *GetLeadsParams { - var () return &GetLeadsParams{ - Context: ctx, } } // NewGetLeadsParamsWithHTTPClient creates a new GetLeadsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLeadsParamsWithHTTPClient(client *http.Client) *GetLeadsParams { - var () return &GetLeadsParams{ HTTPClient: client, } } -/*GetLeadsParams contains all the parameters to send to the API endpoint -for the get leads operation typically these are written to a http.Request +/* GetLeadsParams contains all the parameters to send to the API endpoint + for the get leads operation. + + Typically these are written to a http.Request. */ type GetLeadsParams struct { - /*Email - Email address used for identity lookup + /* Email. + Email address used for identity lookup */ Email *string - /*LeadID - Taxnexus Lead record ID + /* LeadID. + + Taxnexus Lead record ID */ LeadID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string - /*Offset - How many objects to skip? + /* Offset. + + How many objects to skip? + + Format: int64 */ Offset *int64 @@ -96,6 +103,21 @@ type GetLeadsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get leads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeadsParams) WithDefaults() *GetLeadsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get leads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeadsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get leads params func (o *GetLeadsParams) WithTimeout(timeout time.Duration) *GetLeadsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param email var qrEmail string + if o.Email != nil { qrEmail = *o.Email } qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } } - } if o.LeadID != nil { // query param leadId var qrLeadID string + if o.LeadID != nil { qrLeadID = *o.LeadID } qLeadID := qrLeadID if qLeadID != "" { + if err := r.SetQueryParam("leadId", qLeadID); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/crm/crm_client/leads/get_leads_responses.go b/api/crm/crm_client/leads/get_leads_responses.go index 9e4ef2b..01f2037 100644 --- a/api/crm/crm_client/leads/get_leads_responses.go +++ b/api/crm/crm_client/leads/get_leads_responses.go @@ -63,9 +63,8 @@ func (o *GetLeadsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetLeadsOK() *GetLeadsOK { return &GetLeadsOK{} } -/*GetLeadsOK handles this case with default header values. +/* GetLeadsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Lead objects */ type GetLeadsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.LeadResponse } @@ -89,18 +87,25 @@ type GetLeadsOK struct { func (o *GetLeadsOK) Error() string { return fmt.Sprintf("[GET /leads][%d] getLeadsOK %+v", 200, o.Payload) } - func (o *GetLeadsOK) GetPayload() *crm_models.LeadResponse { return o.Payload } func (o *GetLeadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.LeadResponse) @@ -117,7 +122,7 @@ func NewGetLeadsUnauthorized() *GetLeadsUnauthorized { return &GetLeadsUnauthorized{} } -/*GetLeadsUnauthorized handles this case with default header values. +/* GetLeadsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetLeadsUnauthorized struct { func (o *GetLeadsUnauthorized) Error() string { return fmt.Sprintf("[GET /leads][%d] getLeadsUnauthorized %+v", 401, o.Payload) } - func (o *GetLeadsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewGetLeadsForbidden() *GetLeadsForbidden { return &GetLeadsForbidden{} } -/*GetLeadsForbidden handles this case with default header values. +/* GetLeadsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetLeadsForbidden struct { func (o *GetLeadsForbidden) Error() string { return fmt.Sprintf("[GET /leads][%d] getLeadsForbidden %+v", 403, o.Payload) } - func (o *GetLeadsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewGetLeadsNotFound() *GetLeadsNotFound { return &GetLeadsNotFound{} } -/*GetLeadsNotFound handles this case with default header values. +/* GetLeadsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetLeadsNotFound struct { func (o *GetLeadsNotFound) Error() string { return fmt.Sprintf("[GET /leads][%d] getLeadsNotFound %+v", 404, o.Payload) } - func (o *GetLeadsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewGetLeadsUnprocessableEntity() *GetLeadsUnprocessableEntity { return &GetLeadsUnprocessableEntity{} } -/*GetLeadsUnprocessableEntity handles this case with default header values. +/* GetLeadsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetLeadsUnprocessableEntity struct { func (o *GetLeadsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /leads][%d] getLeadsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetLeadsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewGetLeadsInternalServerError() *GetLeadsInternalServerError { return &GetLeadsInternalServerError{} } -/*GetLeadsInternalServerError handles this case with default header values. +/* GetLeadsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetLeadsInternalServerError struct { func (o *GetLeadsInternalServerError) Error() string { return fmt.Sprintf("[GET /leads][%d] getLeadsInternalServerError %+v", 500, o.Payload) } - func (o *GetLeadsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *GetLeadsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/leads/leads_client.go b/api/crm/crm_client/leads/leads_client.go index 8185e68..01fa479 100644 --- a/api/crm/crm_client/leads/leads_client.go +++ b/api/crm/crm_client/leads/leads_client.go @@ -29,17 +29,20 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteLeadOK, error) + DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) - GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeadsOK, error) + GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) - GetLeadsObservable(params *GetLeadsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeadsObservableOK, error) + GetLeadsObservable(params *GetLeadsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsObservableOK, error) - PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeadsOK, error) + PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) - PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter) (*PutLeadsOK, error) + PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Delete Taxnexus Lead record */ -func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteLeadOK, error) { +func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeadOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteLeadParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteLead", Method: "DELETE", PathPattern: "/leads", @@ -67,7 +69,12 @@ func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAut 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 } @@ -86,13 +93,12 @@ func (a *Client) DeleteLead(params *DeleteLeadParams, authInfo runtime.ClientAut Return a list of all available Leads */ -func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeadsOK, error) { +func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLeadsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLeads", Method: "GET", PathPattern: "/leads", @@ -104,7 +110,12 @@ func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInf 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 } @@ -123,13 +134,12 @@ func (a *Client) GetLeads(params *GetLeadsParams, authInfo runtime.ClientAuthInf A list of leads in a simple JSON array */ -func (a *Client) GetLeadsObservable(params *GetLeadsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeadsObservableOK, error) { +func (a *Client) GetLeadsObservable(params *GetLeadsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeadsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLeadsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLeadsObservable", Method: "GET", PathPattern: "/leads/observable", @@ -141,7 +151,12 @@ func (a *Client) GetLeadsObservable(params *GetLeadsObservableParams, authInfo r 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 } @@ -160,13 +175,12 @@ func (a *Client) GetLeadsObservable(params *GetLeadsObservableParams, authInfo r Lead records to be added */ -func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeadsOK, error) { +func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeadsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostLeadsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postLeads", Method: "POST", PathPattern: "/leads", @@ -178,7 +192,12 @@ func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthI 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 } @@ -197,13 +216,12 @@ func (a *Client) PostLeads(params *PostLeadsParams, authInfo runtime.ClientAuthI Update Lead records */ -func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter) (*PutLeadsOK, error) { +func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLeadsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutLeadsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putLeads", Method: "PUT", PathPattern: "/leads", @@ -215,7 +233,12 @@ func (a *Client) PutLeads(params *PutLeadsParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/crm/crm_client/leads/post_leads_parameters.go b/api/crm/crm_client/leads/post_leads_parameters.go index fffc788..18b28da 100644 --- a/api/crm/crm_client/leads/post_leads_parameters.go +++ b/api/crm/crm_client/leads/post_leads_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_models" ) -// NewPostLeadsParams creates a new PostLeadsParams object -// with the default values initialized. +// NewPostLeadsParams creates a new PostLeadsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPostLeadsParams() *PostLeadsParams { - var () return &PostLeadsParams{ - timeout: cr.DefaultTimeout, } } // NewPostLeadsParamsWithTimeout creates a new PostLeadsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostLeadsParamsWithTimeout(timeout time.Duration) *PostLeadsParams { - var () return &PostLeadsParams{ - timeout: timeout, } } // NewPostLeadsParamsWithContext creates a new PostLeadsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostLeadsParamsWithContext(ctx context.Context) *PostLeadsParams { - var () return &PostLeadsParams{ - Context: ctx, } } // NewPostLeadsParamsWithHTTPClient creates a new PostLeadsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostLeadsParamsWithHTTPClient(client *http.Client) *PostLeadsParams { - var () return &PostLeadsParams{ HTTPClient: client, } } -/*PostLeadsParams contains all the parameters to send to the API endpoint -for the post leads operation typically these are written to a http.Request +/* PostLeadsParams contains all the parameters to send to the API endpoint + for the post leads operation. + + Typically these are written to a http.Request. */ type PostLeadsParams struct { - /*LeadRequest - An array of new Lead records + /* LeadRequest. + An array of new Lead records */ LeadRequest *crm_models.LeadRequest @@ -77,6 +76,21 @@ type PostLeadsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post leads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLeadsParams) WithDefaults() *PostLeadsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post leads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLeadsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post leads params func (o *PostLeadsParams) WithTimeout(timeout time.Duration) *PostLeadsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.LeadRequest != nil { if err := r.SetBodyParam(o.LeadRequest); err != nil { return err diff --git a/api/crm/crm_client/leads/post_leads_responses.go b/api/crm/crm_client/leads/post_leads_responses.go index 4e950cd..a877ba7 100644 --- a/api/crm/crm_client/leads/post_leads_responses.go +++ b/api/crm/crm_client/leads/post_leads_responses.go @@ -63,9 +63,8 @@ func (o *PostLeadsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostLeadsOK() *PostLeadsOK { return &PostLeadsOK{} } -/*PostLeadsOK handles this case with default header values. +/* PostLeadsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Lead objects */ type PostLeadsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.LeadResponse } @@ -89,18 +87,25 @@ type PostLeadsOK struct { func (o *PostLeadsOK) Error() string { return fmt.Sprintf("[POST /leads][%d] postLeadsOK %+v", 200, o.Payload) } - func (o *PostLeadsOK) GetPayload() *crm_models.LeadResponse { return o.Payload } func (o *PostLeadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.LeadResponse) @@ -117,7 +122,7 @@ func NewPostLeadsUnauthorized() *PostLeadsUnauthorized { return &PostLeadsUnauthorized{} } -/*PostLeadsUnauthorized handles this case with default header values. +/* PostLeadsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostLeadsUnauthorized struct { func (o *PostLeadsUnauthorized) Error() string { return fmt.Sprintf("[POST /leads][%d] postLeadsUnauthorized %+v", 401, o.Payload) } - func (o *PostLeadsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PostLeadsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewPostLeadsForbidden() *PostLeadsForbidden { return &PostLeadsForbidden{} } -/*PostLeadsForbidden handles this case with default header values. +/* PostLeadsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostLeadsForbidden struct { func (o *PostLeadsForbidden) Error() string { return fmt.Sprintf("[POST /leads][%d] postLeadsForbidden %+v", 403, o.Payload) } - func (o *PostLeadsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PostLeadsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewPostLeadsNotFound() *PostLeadsNotFound { return &PostLeadsNotFound{} } -/*PostLeadsNotFound handles this case with default header values. +/* PostLeadsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostLeadsNotFound struct { func (o *PostLeadsNotFound) Error() string { return fmt.Sprintf("[POST /leads][%d] postLeadsNotFound %+v", 404, o.Payload) } - func (o *PostLeadsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PostLeadsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewPostLeadsUnprocessableEntity() *PostLeadsUnprocessableEntity { return &PostLeadsUnprocessableEntity{} } -/*PostLeadsUnprocessableEntity handles this case with default header values. +/* PostLeadsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostLeadsUnprocessableEntity struct { func (o *PostLeadsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /leads][%d] postLeadsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostLeadsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PostLeadsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewPostLeadsInternalServerError() *PostLeadsInternalServerError { return &PostLeadsInternalServerError{} } -/*PostLeadsInternalServerError handles this case with default header values. +/* PostLeadsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostLeadsInternalServerError struct { func (o *PostLeadsInternalServerError) Error() string { return fmt.Sprintf("[POST /leads][%d] postLeadsInternalServerError %+v", 500, o.Payload) } - func (o *PostLeadsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PostLeadsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_client/leads/put_leads_parameters.go b/api/crm/crm_client/leads/put_leads_parameters.go index 4252471..e95e416 100644 --- a/api/crm/crm_client/leads/put_leads_parameters.go +++ b/api/crm/crm_client/leads/put_leads_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_models" ) -// NewPutLeadsParams creates a new PutLeadsParams object -// with the default values initialized. +// NewPutLeadsParams creates a new PutLeadsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPutLeadsParams() *PutLeadsParams { - var () return &PutLeadsParams{ - timeout: cr.DefaultTimeout, } } // NewPutLeadsParamsWithTimeout creates a new PutLeadsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutLeadsParamsWithTimeout(timeout time.Duration) *PutLeadsParams { - var () return &PutLeadsParams{ - timeout: timeout, } } // NewPutLeadsParamsWithContext creates a new PutLeadsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutLeadsParamsWithContext(ctx context.Context) *PutLeadsParams { - var () return &PutLeadsParams{ - Context: ctx, } } // NewPutLeadsParamsWithHTTPClient creates a new PutLeadsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutLeadsParamsWithHTTPClient(client *http.Client) *PutLeadsParams { - var () return &PutLeadsParams{ HTTPClient: client, } } -/*PutLeadsParams contains all the parameters to send to the API endpoint -for the put leads operation typically these are written to a http.Request +/* PutLeadsParams contains all the parameters to send to the API endpoint + for the put leads operation. + + Typically these are written to a http.Request. */ type PutLeadsParams struct { - /*LeadRequest - An array of new Lead records + /* LeadRequest. + An array of new Lead records */ LeadRequest *crm_models.LeadRequest @@ -77,6 +76,21 @@ type PutLeadsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put leads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutLeadsParams) WithDefaults() *PutLeadsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put leads params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutLeadsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put leads params func (o *PutLeadsParams) WithTimeout(timeout time.Duration) *PutLeadsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutLeadsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.LeadRequest != nil { if err := r.SetBodyParam(o.LeadRequest); err != nil { return err diff --git a/api/crm/crm_client/leads/put_leads_responses.go b/api/crm/crm_client/leads/put_leads_responses.go index d60eb9c..8b3c8e4 100644 --- a/api/crm/crm_client/leads/put_leads_responses.go +++ b/api/crm/crm_client/leads/put_leads_responses.go @@ -63,9 +63,8 @@ func (o *PutLeadsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutLeadsOK() *PutLeadsOK { return &PutLeadsOK{} } -/*PutLeadsOK handles this case with default header values. +/* PutLeadsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Lead objects */ type PutLeadsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *crm_models.LeadResponse } @@ -89,18 +87,25 @@ type PutLeadsOK struct { func (o *PutLeadsOK) Error() string { return fmt.Sprintf("[PUT /leads][%d] putLeadsOK %+v", 200, o.Payload) } - func (o *PutLeadsOK) GetPayload() *crm_models.LeadResponse { return o.Payload } func (o *PutLeadsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(crm_models.LeadResponse) @@ -117,7 +122,7 @@ func NewPutLeadsUnauthorized() *PutLeadsUnauthorized { return &PutLeadsUnauthorized{} } -/*PutLeadsUnauthorized handles this case with default header values. +/* PutLeadsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutLeadsUnauthorized struct { func (o *PutLeadsUnauthorized) Error() string { return fmt.Sprintf("[PUT /leads][%d] putLeadsUnauthorized %+v", 401, o.Payload) } - func (o *PutLeadsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PutLeadsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -155,7 +163,7 @@ func NewPutLeadsForbidden() *PutLeadsForbidden { return &PutLeadsForbidden{} } -/*PutLeadsForbidden handles this case with default header values. +/* PutLeadsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutLeadsForbidden struct { func (o *PutLeadsForbidden) Error() string { return fmt.Sprintf("[PUT /leads][%d] putLeadsForbidden %+v", 403, o.Payload) } - func (o *PutLeadsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PutLeadsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -193,7 +204,7 @@ func NewPutLeadsNotFound() *PutLeadsNotFound { return &PutLeadsNotFound{} } -/*PutLeadsNotFound handles this case with default header values. +/* PutLeadsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutLeadsNotFound struct { func (o *PutLeadsNotFound) Error() string { return fmt.Sprintf("[PUT /leads][%d] putLeadsNotFound %+v", 404, o.Payload) } - func (o *PutLeadsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PutLeadsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -231,7 +245,7 @@ func NewPutLeadsUnprocessableEntity() *PutLeadsUnprocessableEntity { return &PutLeadsUnprocessableEntity{} } -/*PutLeadsUnprocessableEntity handles this case with default header values. +/* PutLeadsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutLeadsUnprocessableEntity struct { func (o *PutLeadsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /leads][%d] putLeadsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutLeadsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PutLeadsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) @@ -269,7 +286,7 @@ func NewPutLeadsInternalServerError() *PutLeadsInternalServerError { return &PutLeadsInternalServerError{} } -/*PutLeadsInternalServerError handles this case with default header values. +/* PutLeadsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutLeadsInternalServerError struct { func (o *PutLeadsInternalServerError) Error() string { return fmt.Sprintf("[PUT /leads][%d] putLeadsInternalServerError %+v", 500, o.Payload) } - func (o *PutLeadsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PutLeadsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // 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) diff --git a/api/crm/crm_models/account.go b/api/crm/crm_models/account.go index 473f787..c67d4f0 100644 --- a/api/crm/crm_models/account.go +++ b/api/crm/crm_models/account.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -312,7 +314,6 @@ func (m *Account) Validate(formats strfmt.Registry) error { } func (m *Account) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -330,7 +331,6 @@ func (m *Account) validateBillingAddress(formats strfmt.Registry) error { } func (m *Account) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -348,7 +348,6 @@ func (m *Account) validateBusinessAddress(formats strfmt.Registry) error { } func (m *Account) validateDefaultAddress(formats strfmt.Registry) error { - if swag.IsZero(m.DefaultAddress) { // not required return nil } @@ -366,7 +365,6 @@ func (m *Account) validateDefaultAddress(formats strfmt.Registry) error { } func (m *Account) validateShippingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingAddress) { // not required return nil } @@ -383,6 +381,88 @@ func (m *Account) validateShippingAddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account based on the context it is used +func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDefaultAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Account) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateDefaultAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.DefaultAddress != nil { + if err := m.DefaultAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("DefaultAddress") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingAddress != nil { + if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingAddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Account) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/account_basic.go b/api/crm/crm_models/account_basic.go index 2b595a4..9cd02b7 100644 --- a/api/crm/crm_models/account_basic.go +++ b/api/crm/crm_models/account_basic.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -116,7 +118,6 @@ func (m *AccountBasic) Validate(formats strfmt.Registry) error { } func (m *AccountBasic) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -134,7 +135,6 @@ func (m *AccountBasic) validateBillingAddress(formats strfmt.Registry) error { } func (m *AccountBasic) validateDefaultAddress(formats strfmt.Registry) error { - if swag.IsZero(m.DefaultAddress) { // not required return nil } @@ -152,7 +152,6 @@ func (m *AccountBasic) validateDefaultAddress(formats strfmt.Registry) error { } func (m *AccountBasic) validateShippingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingAddress) { // not required return nil } @@ -169,6 +168,70 @@ func (m *AccountBasic) validateShippingAddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account basic based on the context it is used +func (m *AccountBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDefaultAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AccountBasic) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *AccountBasic) contextValidateDefaultAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.DefaultAddress != nil { + if err := m.DefaultAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("DefaultAddress") + } + return err + } + } + + return nil +} + +func (m *AccountBasic) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingAddress != nil { + if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingAddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/account_basic_response.go b/api/crm/crm_models/account_basic_response.go index 3721968..4e613ea 100644 --- a/api/crm/crm_models/account_basic_response.go +++ b/api/crm/crm_models/account_basic_response.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountBasicResponse) Validate(formats strfmt.Registry) error { } func (m *AccountBasicResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountBasicResponse) validateData(formats strfmt.Registry) error { } func (m *AccountBasicResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountBasicResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account basic response based on the context it is used +func (m *AccountBasicResponse) 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 *AccountBasicResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountBasicResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountBasicResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/account_request.go b/api/crm/crm_models/account_request.go index 6b32525..6a4348b 100644 --- a/api/crm/crm_models/account_request.go +++ b/api/crm/crm_models/account_request.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *AccountRequest) Validate(formats strfmt.Registry) error { } func (m *AccountRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *AccountRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account request based on the context it is used +func (m *AccountRequest) 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 *AccountRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/account_response.go b/api/crm/crm_models/account_response.go index 773c098..ac7eed3 100644 --- a/api/crm/crm_models/account_response.go +++ b/api/crm/crm_models/account_response.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountResponse) Validate(formats strfmt.Registry) error { } func (m *AccountResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountResponse) validateData(formats strfmt.Registry) error { } func (m *AccountResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account response based on the context it is used +func (m *AccountResponse) 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 *AccountResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/address.go b/api/crm/crm_models/address.go index d781ff7..4f5fe89 100644 --- a/api/crm/crm_models/address.go +++ b/api/crm/crm_models/address.go @@ -10,6 +10,8 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *Address) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this address based on context it is used +func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Address) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/company.go b/api/crm/crm_models/company.go index 3f36c2a..ed5d567 100644 --- a/api/crm/crm_models/company.go +++ b/api/crm/crm_models/company.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -148,7 +150,6 @@ func (m *Company) Validate(formats strfmt.Registry) error { } func (m *Company) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -166,7 +167,6 @@ func (m *Company) validateBillingAddress(formats strfmt.Registry) error { } func (m *Company) validateDefaultAddress(formats strfmt.Registry) error { - if swag.IsZero(m.DefaultAddress) { // not required return nil } @@ -183,6 +183,52 @@ func (m *Company) validateDefaultAddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this company based on the context it is used +func (m *Company) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDefaultAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Company) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *Company) contextValidateDefaultAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.DefaultAddress != nil { + if err := m.DefaultAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("DefaultAddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Company) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/company_request.go b/api/crm/crm_models/company_request.go index e34bc53..ef2621d 100644 --- a/api/crm/crm_models/company_request.go +++ b/api/crm/crm_models/company_request.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *CompanyRequest) Validate(formats strfmt.Registry) error { } func (m *CompanyRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *CompanyRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this company request based on the context it is used +func (m *CompanyRequest) 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 *CompanyRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CompanyRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/company_response.go b/api/crm/crm_models/company_response.go index d420486..fef63be 100644 --- a/api/crm/crm_models/company_response.go +++ b/api/crm/crm_models/company_response.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CompanyResponse) Validate(formats strfmt.Registry) error { } func (m *CompanyResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CompanyResponse) validateData(formats strfmt.Registry) error { } func (m *CompanyResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CompanyResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this company response based on the context it is used +func (m *CompanyResponse) 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 *CompanyResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CompanyResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CompanyResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/contact.go b/api/crm/crm_models/contact.go index 8239b74..b22e214 100644 --- a/api/crm/crm_models/contact.go +++ b/api/crm/crm_models/contact.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -175,7 +177,6 @@ func (m *Contact) Validate(formats strfmt.Registry) error { } func (m *Contact) validateMailingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.MailingAddress) { // not required return nil } @@ -193,7 +194,6 @@ func (m *Contact) validateMailingAddress(formats strfmt.Registry) error { } func (m *Contact) validateOtherAddress(formats strfmt.Registry) error { - if swag.IsZero(m.OtherAddress) { // not required return nil } @@ -210,6 +210,52 @@ func (m *Contact) validateOtherAddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contact based on the context it is used +func (m *Contact) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMailingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOtherAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Contact) contextValidateMailingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.MailingAddress != nil { + if err := m.MailingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("MailingAddress") + } + return err + } + } + + return nil +} + +func (m *Contact) contextValidateOtherAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.OtherAddress != nil { + if err := m.OtherAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("OtherAddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Contact) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/contact_request.go b/api/crm/crm_models/contact_request.go index 6387107..a3bfdfe 100644 --- a/api/crm/crm_models/contact_request.go +++ b/api/crm/crm_models/contact_request.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *ContactRequest) Validate(formats strfmt.Registry) error { } func (m *ContactRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *ContactRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contact request based on the context it is used +func (m *ContactRequest) 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 *ContactRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ContactRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/contact_response.go b/api/crm/crm_models/contact_response.go index 4b51021..a453d76 100644 --- a/api/crm/crm_models/contact_response.go +++ b/api/crm/crm_models/contact_response.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ContactResponse) Validate(formats strfmt.Registry) error { } func (m *ContactResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ContactResponse) validateData(formats strfmt.Registry) error { } func (m *ContactResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ContactResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contact response based on the context it is used +func (m *ContactResponse) 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 *ContactResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ContactResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ContactResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/delete_response.go b/api/crm/crm_models/delete_response.go index a09b904..9b3f011 100644 --- a/api/crm/crm_models/delete_response.go +++ b/api/crm/crm_models/delete_response.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error { } func (m *DeleteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error { } func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this delete response based on the context it is used +func (m *DeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DeleteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DeleteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/error.go b/api/crm/crm_models/error.go index b09d7ed..e4a16a4 100644 --- a/api/crm/crm_models/error.go +++ b/api/crm/crm_models/error.go @@ -10,6 +10,8 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/invalid_error.go b/api/crm/crm_models/invalid_error.go index 86746c2..0a974e8 100644 --- a/api/crm/crm_models/invalid_error.go +++ b/api/crm/crm_models/invalid_error.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/lead.go b/api/crm/crm_models/lead.go index f5146cb..9354069 100644 --- a/api/crm/crm_models/lead.go +++ b/api/crm/crm_models/lead.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -120,7 +122,6 @@ func (m *Lead) Validate(formats strfmt.Registry) error { } func (m *Lead) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -137,6 +138,34 @@ func (m *Lead) validateAddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this lead based on the context it is used +func (m *Lead) 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 *Lead) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Address") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Lead) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/lead_request.go b/api/crm/crm_models/lead_request.go index 8f00b3d..a24fc6f 100644 --- a/api/crm/crm_models/lead_request.go +++ b/api/crm/crm_models/lead_request.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *LeadRequest) Validate(formats strfmt.Registry) error { } func (m *LeadRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *LeadRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this lead request based on the context it is used +func (m *LeadRequest) 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 *LeadRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *LeadRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/lead_response.go b/api/crm/crm_models/lead_response.go index 59d1ad6..035f081 100644 --- a/api/crm/crm_models/lead_response.go +++ b/api/crm/crm_models/lead_response.go @@ -10,6 +10,7 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LeadResponse) Validate(formats strfmt.Registry) error { } func (m *LeadResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LeadResponse) validateData(formats strfmt.Registry) error { } func (m *LeadResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LeadResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this lead response based on the context it is used +func (m *LeadResponse) 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 *LeadResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LeadResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LeadResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/message.go b/api/crm/crm_models/message.go index 0b08b0d..1c3ab28 100644 --- a/api/crm/crm_models/message.go +++ b/api/crm/crm_models/message.go @@ -10,6 +10,8 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/pagination.go b/api/crm/crm_models/pagination.go index 2c5f82e..1ae7c3b 100644 --- a/api/crm/crm_models/pagination.go +++ b/api/crm/crm_models/pagination.go @@ -10,6 +10,8 @@ package crm_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/request_meta.go b/api/crm/crm_models/request_meta.go index 4abb1e2..f21ef51 100644 --- a/api/crm/crm_models/request_meta.go +++ b/api/crm/crm_models/request_meta.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/crm/crm_models/response_meta.go b/api/crm/crm_models/response_meta.go index f1bdc29..27e7a56 100644 --- a/api/crm/crm_models/response_meta.go +++ b/api/crm/crm_models/response_meta.go @@ -10,6 +10,8 @@ package crm_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_client/cluster/cluster_client.go b/api/devops/devops_client/cluster/cluster_client.go index c992a9e..9cc88c2 100644 --- a/api/devops/devops_client/cluster/cluster_client.go +++ b/api/devops/devops_client/cluster/cluster_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetCluster(params *GetClusterParams, authInfo runtime.ClientAuthInfoWriter) (*GetClusterOK, error) + GetCluster(params *GetClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClusterOK, error) - GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter) (*GetClustersOK, error) + GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error) - GetClustersObservable(params *GetClustersObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetClustersObservableOK, error) + GetClustersObservable(params *GetClustersObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersObservableOK, error) - PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PostClustersOK, error) + PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error) - PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PutClustersOK, error) + PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Return a single Cluster object from datastore as a Singleton */ -func (a *Client) GetCluster(params *GetClusterParams, authInfo runtime.ClientAuthInfoWriter) (*GetClusterOK, error) { +func (a *Client) GetCluster(params *GetClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClusterOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetClusterParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCluster", Method: "GET", PathPattern: "/clusters/{clusterIdPath}", @@ -67,7 +69,12 @@ func (a *Client) GetCluster(params *GetClusterParams, authInfo runtime.ClientAut 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 } @@ -86,13 +93,12 @@ func (a *Client) GetCluster(params *GetClusterParams, authInfo runtime.ClientAut Return a list of Cluster records from the datastore */ -func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter) (*GetClustersOK, error) { +func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetClustersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getClusters", Method: "GET", PathPattern: "/clusters", @@ -104,7 +110,12 @@ func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientA 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 } @@ -123,13 +134,12 @@ func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientA Returns a Cluster retrieval in a observable array */ -func (a *Client) GetClustersObservable(params *GetClustersObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetClustersObservableOK, error) { +func (a *Client) GetClustersObservable(params *GetClustersObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetClustersObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getClustersObservable", Method: "GET", PathPattern: "/clusters/observable", @@ -141,7 +151,12 @@ func (a *Client) GetClustersObservable(params *GetClustersObservableParams, auth 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 } @@ -160,13 +175,12 @@ func (a *Client) GetClustersObservable(params *GetClustersObservableParams, auth Create Clusters in Taxnexus */ -func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PostClustersOK, error) { +func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostClustersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postClusters", Method: "POST", PathPattern: "/clusters", @@ -178,7 +192,12 @@ func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.Clien 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 } @@ -197,13 +216,12 @@ func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.Clien Update Cluster in Taxnexus */ -func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PutClustersOK, error) { +func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutClustersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putClusters", Method: "PUT", PathPattern: "/clusters", @@ -215,7 +233,12 @@ func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientA 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 } diff --git a/api/devops/devops_client/cluster/get_cluster_parameters.go b/api/devops/devops_client/cluster/get_cluster_parameters.go index bdac2ab..3c8e165 100644 --- a/api/devops/devops_client/cluster/get_cluster_parameters.go +++ b/api/devops/devops_client/cluster/get_cluster_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetClusterParams creates a new GetClusterParams object -// with the default values initialized. +// NewGetClusterParams creates a new GetClusterParams 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 NewGetClusterParams() *GetClusterParams { - var () return &GetClusterParams{ - timeout: cr.DefaultTimeout, } } // NewGetClusterParamsWithTimeout creates a new GetClusterParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetClusterParamsWithTimeout(timeout time.Duration) *GetClusterParams { - var () return &GetClusterParams{ - timeout: timeout, } } // NewGetClusterParamsWithContext creates a new GetClusterParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetClusterParamsWithContext(ctx context.Context) *GetClusterParams { - var () return &GetClusterParams{ - Context: ctx, } } // NewGetClusterParamsWithHTTPClient creates a new GetClusterParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetClusterParamsWithHTTPClient(client *http.Client) *GetClusterParams { - var () return &GetClusterParams{ HTTPClient: client, } } -/*GetClusterParams contains all the parameters to send to the API endpoint -for the get cluster operation typically these are written to a http.Request +/* GetClusterParams contains all the parameters to send to the API endpoint + for the get cluster operation. + + Typically these are written to a http.Request. */ type GetClusterParams struct { - /*ClusterIDPath - Taxnexus Record Id of a Cluster + /* ClusterIDPath. + Taxnexus Record Id of a Cluster */ ClusterIDPath string @@ -75,6 +74,21 @@ type GetClusterParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get cluster params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClusterParams) WithDefaults() *GetClusterParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get cluster params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClusterParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get cluster params func (o *GetClusterParams) WithTimeout(timeout time.Duration) *GetClusterParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cluster/get_cluster_responses.go b/api/devops/devops_client/cluster/get_cluster_responses.go index c328780..f43fdc9 100644 --- a/api/devops/devops_client/cluster/get_cluster_responses.go +++ b/api/devops/devops_client/cluster/get_cluster_responses.go @@ -63,9 +63,8 @@ func (o *GetClusterReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetClusterOK() *GetClusterOK { return &GetClusterOK{} } -/*GetClusterOK handles this case with default header values. +/* GetClusterOK describes a response with status code 200, with default header values. Single Cluster record response */ type GetClusterOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Cluster } @@ -89,18 +87,25 @@ type GetClusterOK struct { func (o *GetClusterOK) Error() string { return fmt.Sprintf("[GET /clusters/{clusterIdPath}][%d] getClusterOK %+v", 200, o.Payload) } - func (o *GetClusterOK) GetPayload() *devops_models.Cluster { return o.Payload } func (o *GetClusterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Cluster) @@ -117,14 +122,13 @@ func NewGetClusterUnauthorized() *GetClusterUnauthorized { return &GetClusterUnauthorized{} } -/*GetClusterUnauthorized handles this case with default header values. +/* GetClusterUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetClusterUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetClusterUnauthorized struct { func (o *GetClusterUnauthorized) Error() string { return fmt.Sprintf("[GET /clusters/{clusterIdPath}][%d] getClusterUnauthorized %+v", 401, o.Payload) } - func (o *GetClusterUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClusterUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetClusterForbidden() *GetClusterForbidden { return &GetClusterForbidden{} } -/*GetClusterForbidden handles this case with default header values. +/* GetClusterForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetClusterForbidden struct { func (o *GetClusterForbidden) Error() string { return fmt.Sprintf("[GET /clusters/{clusterIdPath}][%d] getClusterForbidden %+v", 403, o.Payload) } - func (o *GetClusterForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClusterForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetClusterNotFound() *GetClusterNotFound { return &GetClusterNotFound{} } -/*GetClusterNotFound handles this case with default header values. +/* GetClusterNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetClusterNotFound struct { func (o *GetClusterNotFound) Error() string { return fmt.Sprintf("[GET /clusters/{clusterIdPath}][%d] getClusterNotFound %+v", 404, o.Payload) } - func (o *GetClusterNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClusterNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetClusterUnprocessableEntity() *GetClusterUnprocessableEntity { return &GetClusterUnprocessableEntity{} } -/*GetClusterUnprocessableEntity handles this case with default header values. +/* GetClusterUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetClusterUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetClusterUnprocessableEntity struct { func (o *GetClusterUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /clusters/{clusterIdPath}][%d] getClusterUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetClusterUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClusterUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetClusterInternalServerError() *GetClusterInternalServerError { return &GetClusterInternalServerError{} } -/*GetClusterInternalServerError handles this case with default header values. +/* GetClusterInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetClusterInternalServerError struct { func (o *GetClusterInternalServerError) Error() string { return fmt.Sprintf("[GET /clusters/{clusterIdPath}][%d] getClusterInternalServerError %+v", 500, o.Payload) } - func (o *GetClusterInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClusterInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/cluster/get_clusters_observable_parameters.go b/api/devops/devops_client/cluster/get_clusters_observable_parameters.go index 086d9de..ca907b0 100644 --- a/api/devops/devops_client/cluster/get_clusters_observable_parameters.go +++ b/api/devops/devops_client/cluster/get_clusters_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetClustersObservableParams creates a new GetClustersObservableParams object -// with the default values initialized. +// NewGetClustersObservableParams creates a new GetClustersObservableParams 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 NewGetClustersObservableParams() *GetClustersObservableParams { - return &GetClustersObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetClustersObservableParamsWithTimeout creates a new GetClustersObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetClustersObservableParamsWithTimeout(timeout time.Duration) *GetClustersObservableParams { - return &GetClustersObservableParams{ - timeout: timeout, } } // NewGetClustersObservableParamsWithContext creates a new GetClustersObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetClustersObservableParamsWithContext(ctx context.Context) *GetClustersObservableParams { - return &GetClustersObservableParams{ - Context: ctx, } } // NewGetClustersObservableParamsWithHTTPClient creates a new GetClustersObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetClustersObservableParamsWithHTTPClient(client *http.Client) *GetClustersObservableParams { - return &GetClustersObservableParams{ HTTPClient: client, } } -/*GetClustersObservableParams contains all the parameters to send to the API endpoint -for the get clusters observable operation typically these are written to a http.Request +/* GetClustersObservableParams contains all the parameters to send to the API endpoint + for the get clusters observable operation. + + Typically these are written to a http.Request. */ type GetClustersObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetClustersObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get clusters observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClustersObservableParams) WithDefaults() *GetClustersObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get clusters observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClustersObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get clusters observable params func (o *GetClustersObservableParams) WithTimeout(timeout time.Duration) *GetClustersObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cluster/get_clusters_observable_responses.go b/api/devops/devops_client/cluster/get_clusters_observable_responses.go index d9612b7..38815cc 100644 --- a/api/devops/devops_client/cluster/get_clusters_observable_responses.go +++ b/api/devops/devops_client/cluster/get_clusters_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetClustersObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetClustersObservableOK() *GetClustersObservableOK { return &GetClustersObservableOK{} } -/*GetClustersObservableOK handles this case with default header values. +/* GetClustersObservableOK describes a response with status code 200, with default header values. Single Cluster record response */ type GetClustersObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.Cluster } @@ -89,18 +87,25 @@ type GetClustersObservableOK struct { func (o *GetClustersObservableOK) Error() string { return fmt.Sprintf("[GET /clusters/observable][%d] getClustersObservableOK %+v", 200, o.Payload) } - func (o *GetClustersObservableOK) GetPayload() []*devops_models.Cluster { return o.Payload } func (o *GetClustersObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetClustersObservableUnauthorized() *GetClustersObservableUnauthorized { return &GetClustersObservableUnauthorized{} } -/*GetClustersObservableUnauthorized handles this case with default header values. +/* GetClustersObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetClustersObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetClustersObservableUnauthorized struct { func (o *GetClustersObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /clusters/observable][%d] getClustersObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetClustersObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetClustersObservableForbidden() *GetClustersObservableForbidden { return &GetClustersObservableForbidden{} } -/*GetClustersObservableForbidden handles this case with default header values. +/* GetClustersObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetClustersObservableForbidden struct { func (o *GetClustersObservableForbidden) Error() string { return fmt.Sprintf("[GET /clusters/observable][%d] getClustersObservableForbidden %+v", 403, o.Payload) } - func (o *GetClustersObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetClustersObservableNotFound() *GetClustersObservableNotFound { return &GetClustersObservableNotFound{} } -/*GetClustersObservableNotFound handles this case with default header values. +/* GetClustersObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetClustersObservableNotFound struct { func (o *GetClustersObservableNotFound) Error() string { return fmt.Sprintf("[GET /clusters/observable][%d] getClustersObservableNotFound %+v", 404, o.Payload) } - func (o *GetClustersObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetClustersObservableUnprocessableEntity() *GetClustersObservableUnproce return &GetClustersObservableUnprocessableEntity{} } -/*GetClustersObservableUnprocessableEntity handles this case with default header values. +/* GetClustersObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetClustersObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetClustersObservableUnprocessableEntity struct { func (o *GetClustersObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /clusters/observable][%d] getClustersObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetClustersObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetClustersObservableInternalServerError() *GetClustersObservableInterna return &GetClustersObservableInternalServerError{} } -/*GetClustersObservableInternalServerError handles this case with default header values. +/* GetClustersObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetClustersObservableInternalServerError struct { func (o *GetClustersObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /clusters/observable][%d] getClustersObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetClustersObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/cluster/get_clusters_parameters.go b/api/devops/devops_client/cluster/get_clusters_parameters.go index 4c1c2ee..3a5304c 100644 --- a/api/devops/devops_client/cluster/get_clusters_parameters.go +++ b/api/devops/devops_client/cluster/get_clusters_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetClustersParams creates a new GetClustersParams object -// with the default values initialized. +// NewGetClustersParams creates a new GetClustersParams 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 NewGetClustersParams() *GetClustersParams { - var () return &GetClustersParams{ - timeout: cr.DefaultTimeout, } } // NewGetClustersParamsWithTimeout creates a new GetClustersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetClustersParamsWithTimeout(timeout time.Duration) *GetClustersParams { - var () return &GetClustersParams{ - timeout: timeout, } } // NewGetClustersParamsWithContext creates a new GetClustersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetClustersParamsWithContext(ctx context.Context) *GetClustersParams { - var () return &GetClustersParams{ - Context: ctx, } } // NewGetClustersParamsWithHTTPClient creates a new GetClustersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetClustersParamsWithHTTPClient(client *http.Client) *GetClustersParams { - var () return &GetClustersParams{ HTTPClient: client, } } -/*GetClustersParams contains all the parameters to send to the API endpoint -for the get clusters operation typically these are written to a http.Request +/* GetClustersParams contains all the parameters to send to the API endpoint + for the get clusters operation. + + Typically these are written to a http.Request. */ type GetClustersParams struct { - /*ClusterID - Taxnexus Record Id of a Cluster + /* ClusterID. + Taxnexus Record Id of a Cluster */ ClusterID *string - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + + Taxnexus Record Id of a Company */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetClustersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClustersParams) WithDefaults() *GetClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClustersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get clusters params func (o *GetClustersParams) WithTimeout(timeout time.Duration) *GetClustersParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param clusterId var qrClusterID string + if o.ClusterID != nil { qrClusterID = *o.ClusterID } qClusterID := qrClusterID if qClusterID != "" { + if err := r.SetQueryParam("clusterId", qClusterID); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 { diff --git a/api/devops/devops_client/cluster/get_clusters_responses.go b/api/devops/devops_client/cluster/get_clusters_responses.go index eb65865..473e58a 100644 --- a/api/devops/devops_client/cluster/get_clusters_responses.go +++ b/api/devops/devops_client/cluster/get_clusters_responses.go @@ -63,9 +63,8 @@ func (o *GetClustersReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetClustersOK() *GetClustersOK { return &GetClustersOK{} } -/*GetClustersOK handles this case with default header values. +/* GetClustersOK describes a response with status code 200, with default header values. Taxnexus Response with Cluster objects */ type GetClustersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.ClusterResponse } @@ -89,18 +87,25 @@ type GetClustersOK struct { func (o *GetClustersOK) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersOK %+v", 200, o.Payload) } - func (o *GetClustersOK) GetPayload() *devops_models.ClusterResponse { return o.Payload } func (o *GetClustersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.ClusterResponse) @@ -117,14 +122,13 @@ func NewGetClustersUnauthorized() *GetClustersUnauthorized { return &GetClustersUnauthorized{} } -/*GetClustersUnauthorized handles this case with default header values. +/* GetClustersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetClustersUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetClustersUnauthorized struct { func (o *GetClustersUnauthorized) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersUnauthorized %+v", 401, o.Payload) } - func (o *GetClustersUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetClustersForbidden() *GetClustersForbidden { return &GetClustersForbidden{} } -/*GetClustersForbidden handles this case with default header values. +/* GetClustersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetClustersForbidden struct { func (o *GetClustersForbidden) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersForbidden %+v", 403, o.Payload) } - func (o *GetClustersForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetClustersNotFound() *GetClustersNotFound { return &GetClustersNotFound{} } -/*GetClustersNotFound handles this case with default header values. +/* GetClustersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetClustersNotFound struct { func (o *GetClustersNotFound) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersNotFound %+v", 404, o.Payload) } - func (o *GetClustersNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetClustersUnprocessableEntity() *GetClustersUnprocessableEntity { return &GetClustersUnprocessableEntity{} } -/*GetClustersUnprocessableEntity handles this case with default header values. +/* GetClustersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetClustersUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetClustersUnprocessableEntity struct { func (o *GetClustersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetClustersUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetClustersInternalServerError() *GetClustersInternalServerError { return &GetClustersInternalServerError{} } -/*GetClustersInternalServerError handles this case with default header values. +/* GetClustersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetClustersInternalServerError struct { func (o *GetClustersInternalServerError) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersInternalServerError %+v", 500, o.Payload) } - func (o *GetClustersInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetClustersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/cluster/post_clusters_parameters.go b/api/devops/devops_client/cluster/post_clusters_parameters.go index ce3dc4a..ae038c0 100644 --- a/api/devops/devops_client/cluster/post_clusters_parameters.go +++ b/api/devops/devops_client/cluster/post_clusters_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostClustersParams creates a new PostClustersParams object -// with the default values initialized. +// NewPostClustersParams creates a new PostClustersParams 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 NewPostClustersParams() *PostClustersParams { - var () return &PostClustersParams{ - timeout: cr.DefaultTimeout, } } // NewPostClustersParamsWithTimeout creates a new PostClustersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostClustersParamsWithTimeout(timeout time.Duration) *PostClustersParams { - var () return &PostClustersParams{ - timeout: timeout, } } // NewPostClustersParamsWithContext creates a new PostClustersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostClustersParamsWithContext(ctx context.Context) *PostClustersParams { - var () return &PostClustersParams{ - Context: ctx, } } // NewPostClustersParamsWithHTTPClient creates a new PostClustersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostClustersParamsWithHTTPClient(client *http.Client) *PostClustersParams { - var () return &PostClustersParams{ HTTPClient: client, } } -/*PostClustersParams contains all the parameters to send to the API endpoint -for the post clusters operation typically these are written to a http.Request +/* PostClustersParams contains all the parameters to send to the API endpoint + for the post clusters operation. + + Typically these are written to a http.Request. */ type PostClustersParams struct { - /*ClusterRequest - An array of Cluster records + /* ClusterRequest. + An array of Cluster records */ ClusterRequest *devops_models.ClusterRequest @@ -77,6 +76,21 @@ type PostClustersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostClustersParams) WithDefaults() *PostClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostClustersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post clusters params func (o *PostClustersParams) WithTimeout(timeout time.Duration) *PostClustersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.ClusterRequest != nil { if err := r.SetBodyParam(o.ClusterRequest); err != nil { return err diff --git a/api/devops/devops_client/cluster/post_clusters_responses.go b/api/devops/devops_client/cluster/post_clusters_responses.go index 18aa8c3..6f74910 100644 --- a/api/devops/devops_client/cluster/post_clusters_responses.go +++ b/api/devops/devops_client/cluster/post_clusters_responses.go @@ -63,9 +63,8 @@ func (o *PostClustersReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostClustersOK() *PostClustersOK { return &PostClustersOK{} } -/*PostClustersOK handles this case with default header values. +/* PostClustersOK describes a response with status code 200, with default header values. Taxnexus Response with Cluster objects */ type PostClustersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.ClusterResponse } @@ -89,18 +87,25 @@ type PostClustersOK struct { func (o *PostClustersOK) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersOK %+v", 200, o.Payload) } - func (o *PostClustersOK) GetPayload() *devops_models.ClusterResponse { return o.Payload } func (o *PostClustersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.ClusterResponse) @@ -117,14 +122,13 @@ func NewPostClustersUnauthorized() *PostClustersUnauthorized { return &PostClustersUnauthorized{} } -/*PostClustersUnauthorized handles this case with default header values. +/* PostClustersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostClustersUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PostClustersUnauthorized struct { func (o *PostClustersUnauthorized) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersUnauthorized %+v", 401, o.Payload) } - func (o *PostClustersUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostClustersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPostClustersForbidden() *PostClustersForbidden { return &PostClustersForbidden{} } -/*PostClustersForbidden handles this case with default header values. +/* PostClustersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PostClustersForbidden struct { func (o *PostClustersForbidden) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersForbidden %+v", 403, o.Payload) } - func (o *PostClustersForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostClustersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPostClustersNotFound() *PostClustersNotFound { return &PostClustersNotFound{} } -/*PostClustersNotFound handles this case with default header values. +/* PostClustersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PostClustersNotFound struct { func (o *PostClustersNotFound) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersNotFound %+v", 404, o.Payload) } - func (o *PostClustersNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostClustersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPostClustersUnprocessableEntity() *PostClustersUnprocessableEntity { return &PostClustersUnprocessableEntity{} } -/*PostClustersUnprocessableEntity handles this case with default header values. +/* PostClustersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostClustersUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PostClustersUnprocessableEntity struct { func (o *PostClustersUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostClustersUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostClustersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPostClustersInternalServerError() *PostClustersInternalServerError { return &PostClustersInternalServerError{} } -/*PostClustersInternalServerError handles this case with default header values. +/* PostClustersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PostClustersInternalServerError struct { func (o *PostClustersInternalServerError) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersInternalServerError %+v", 500, o.Payload) } - func (o *PostClustersInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostClustersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/cluster/put_clusters_parameters.go b/api/devops/devops_client/cluster/put_clusters_parameters.go index 45c1370..1c8e092 100644 --- a/api/devops/devops_client/cluster/put_clusters_parameters.go +++ b/api/devops/devops_client/cluster/put_clusters_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPutClustersParams creates a new PutClustersParams object -// with the default values initialized. +// NewPutClustersParams creates a new PutClustersParams 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 NewPutClustersParams() *PutClustersParams { - var () return &PutClustersParams{ - timeout: cr.DefaultTimeout, } } // NewPutClustersParamsWithTimeout creates a new PutClustersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutClustersParamsWithTimeout(timeout time.Duration) *PutClustersParams { - var () return &PutClustersParams{ - timeout: timeout, } } // NewPutClustersParamsWithContext creates a new PutClustersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutClustersParamsWithContext(ctx context.Context) *PutClustersParams { - var () return &PutClustersParams{ - Context: ctx, } } // NewPutClustersParamsWithHTTPClient creates a new PutClustersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutClustersParamsWithHTTPClient(client *http.Client) *PutClustersParams { - var () return &PutClustersParams{ HTTPClient: client, } } -/*PutClustersParams contains all the parameters to send to the API endpoint -for the put clusters operation typically these are written to a http.Request +/* PutClustersParams contains all the parameters to send to the API endpoint + for the put clusters operation. + + Typically these are written to a http.Request. */ type PutClustersParams struct { - /*ClusterRequest - An array of Cluster records + /* ClusterRequest. + An array of Cluster records */ ClusterRequest *devops_models.ClusterRequest @@ -77,6 +76,21 @@ type PutClustersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutClustersParams) WithDefaults() *PutClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutClustersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put clusters params func (o *PutClustersParams) WithTimeout(timeout time.Duration) *PutClustersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ClusterRequest != nil { if err := r.SetBodyParam(o.ClusterRequest); err != nil { return err diff --git a/api/devops/devops_client/cluster/put_clusters_responses.go b/api/devops/devops_client/cluster/put_clusters_responses.go index 0303767..ce31d40 100644 --- a/api/devops/devops_client/cluster/put_clusters_responses.go +++ b/api/devops/devops_client/cluster/put_clusters_responses.go @@ -63,9 +63,8 @@ func (o *PutClustersReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutClustersOK() *PutClustersOK { return &PutClustersOK{} } -/*PutClustersOK handles this case with default header values. +/* PutClustersOK describes a response with status code 200, with default header values. Taxnexus Response with Cluster objects */ type PutClustersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.ClusterResponse } @@ -89,18 +87,25 @@ type PutClustersOK struct { func (o *PutClustersOK) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersOK %+v", 200, o.Payload) } - func (o *PutClustersOK) GetPayload() *devops_models.ClusterResponse { return o.Payload } func (o *PutClustersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.ClusterResponse) @@ -117,14 +122,13 @@ func NewPutClustersUnauthorized() *PutClustersUnauthorized { return &PutClustersUnauthorized{} } -/*PutClustersUnauthorized handles this case with default header values. +/* PutClustersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PutClustersUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PutClustersUnauthorized struct { func (o *PutClustersUnauthorized) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersUnauthorized %+v", 401, o.Payload) } - func (o *PutClustersUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PutClustersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPutClustersForbidden() *PutClustersForbidden { return &PutClustersForbidden{} } -/*PutClustersForbidden handles this case with default header values. +/* PutClustersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PutClustersForbidden struct { func (o *PutClustersForbidden) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersForbidden %+v", 403, o.Payload) } - func (o *PutClustersForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PutClustersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPutClustersNotFound() *PutClustersNotFound { return &PutClustersNotFound{} } -/*PutClustersNotFound handles this case with default header values. +/* PutClustersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PutClustersNotFound struct { func (o *PutClustersNotFound) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersNotFound %+v", 404, o.Payload) } - func (o *PutClustersNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PutClustersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPutClustersUnprocessableEntity() *PutClustersUnprocessableEntity { return &PutClustersUnprocessableEntity{} } -/*PutClustersUnprocessableEntity handles this case with default header values. +/* PutClustersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PutClustersUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PutClustersUnprocessableEntity struct { func (o *PutClustersUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutClustersUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PutClustersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPutClustersInternalServerError() *PutClustersInternalServerError { return &PutClustersInternalServerError{} } -/*PutClustersInternalServerError handles this case with default header values. +/* PutClustersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PutClustersInternalServerError struct { func (o *PutClustersInternalServerError) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersInternalServerError %+v", 500, o.Payload) } - func (o *PutClustersInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PutClustersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/cors/cluster_options_parameters.go b/api/devops/devops_client/cors/cluster_options_parameters.go index 69346cd..eaffee8 100644 --- a/api/devops/devops_client/cors/cluster_options_parameters.go +++ b/api/devops/devops_client/cors/cluster_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewClusterOptionsParams creates a new ClusterOptionsParams object -// with the default values initialized. +// NewClusterOptionsParams creates a new ClusterOptionsParams 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 NewClusterOptionsParams() *ClusterOptionsParams { - return &ClusterOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewClusterOptionsParamsWithTimeout creates a new ClusterOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewClusterOptionsParamsWithTimeout(timeout time.Duration) *ClusterOptionsParams { - return &ClusterOptionsParams{ - timeout: timeout, } } // NewClusterOptionsParamsWithContext creates a new ClusterOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewClusterOptionsParamsWithContext(ctx context.Context) *ClusterOptionsParams { - return &ClusterOptionsParams{ - Context: ctx, } } // NewClusterOptionsParamsWithHTTPClient creates a new ClusterOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewClusterOptionsParamsWithHTTPClient(client *http.Client) *ClusterOptionsParams { - return &ClusterOptionsParams{ HTTPClient: client, } } -/*ClusterOptionsParams contains all the parameters to send to the API endpoint -for the cluster options operation typically these are written to a http.Request +/* ClusterOptionsParams contains all the parameters to send to the API endpoint + for the cluster options operation. + + Typically these are written to a http.Request. */ type ClusterOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ClusterOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the cluster options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClusterOptionsParams) WithDefaults() *ClusterOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the cluster options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClusterOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the cluster options params func (o *ClusterOptionsParams) WithTimeout(timeout time.Duration) *ClusterOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/cluster_options_responses.go b/api/devops/devops_client/cors/cluster_options_responses.go index c381c9d..4391f97 100644 --- a/api/devops/devops_client/cors/cluster_options_responses.go +++ b/api/devops/devops_client/cors/cluster_options_responses.go @@ -30,9 +30,8 @@ func (o *ClusterOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewClusterOptionsOK() *ClusterOptionsOK { return &ClusterOptionsOK{} } -/*ClusterOptionsOK handles this case with default header values. +/* ClusterOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ClusterOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ClusterOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *ClusterOptionsOK) Error() string { func (o *ClusterOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/clusters_options_parameters.go b/api/devops/devops_client/cors/clusters_options_parameters.go index 32f5b53..f2ead6b 100644 --- a/api/devops/devops_client/cors/clusters_options_parameters.go +++ b/api/devops/devops_client/cors/clusters_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewClustersOptionsParams creates a new ClustersOptionsParams object -// with the default values initialized. +// NewClustersOptionsParams creates a new ClustersOptionsParams 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 NewClustersOptionsParams() *ClustersOptionsParams { - return &ClustersOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewClustersOptionsParamsWithTimeout creates a new ClustersOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewClustersOptionsParamsWithTimeout(timeout time.Duration) *ClustersOptionsParams { - return &ClustersOptionsParams{ - timeout: timeout, } } // NewClustersOptionsParamsWithContext creates a new ClustersOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewClustersOptionsParamsWithContext(ctx context.Context) *ClustersOptionsParams { - return &ClustersOptionsParams{ - Context: ctx, } } // NewClustersOptionsParamsWithHTTPClient creates a new ClustersOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewClustersOptionsParamsWithHTTPClient(client *http.Client) *ClustersOptionsParams { - return &ClustersOptionsParams{ HTTPClient: client, } } -/*ClustersOptionsParams contains all the parameters to send to the API endpoint -for the clusters options operation typically these are written to a http.Request +/* ClustersOptionsParams contains all the parameters to send to the API endpoint + for the clusters options operation. + + Typically these are written to a http.Request. */ type ClustersOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ClustersOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the clusters options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClustersOptionsParams) WithDefaults() *ClustersOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the clusters options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClustersOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the clusters options params func (o *ClustersOptionsParams) WithTimeout(timeout time.Duration) *ClustersOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/clusters_options_responses.go b/api/devops/devops_client/cors/clusters_options_responses.go index b2e56d0..1e282d4 100644 --- a/api/devops/devops_client/cors/clusters_options_responses.go +++ b/api/devops/devops_client/cors/clusters_options_responses.go @@ -30,9 +30,8 @@ func (o *ClustersOptionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewClustersOptionsOK() *ClustersOptionsOK { return &ClustersOptionsOK{} } -/*ClustersOptionsOK handles this case with default header values. +/* ClustersOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ClustersOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ClustersOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *ClustersOptionsOK) Error() string { func (o *ClustersOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/cors_client.go b/api/devops/devops_client/cors/cors_client.go index 111772c..d750756 100644 --- a/api/devops/devops_client/cors/cors_client.go +++ b/api/devops/devops_client/cors/cors_client.go @@ -29,39 +29,42 @@ type Client struct { 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 { - ClusterOptions(params *ClusterOptionsParams) (*ClusterOptionsOK, error) + ClusterOptions(params *ClusterOptionsParams, opts ...ClientOption) (*ClusterOptionsOK, error) - ClustersOptions(params *ClustersOptionsParams) (*ClustersOptionsOK, error) + ClustersOptions(params *ClustersOptionsParams, opts ...ClientOption) (*ClustersOptionsOK, error) - DatabaseOptions(params *DatabaseOptionsParams) (*DatabaseOptionsOK, error) + DatabaseOptions(params *DatabaseOptionsParams, opts ...ClientOption) (*DatabaseOptionsOK, error) - DatabasesOptions(params *DatabasesOptionsParams) (*DatabasesOptionsOK, error) + DatabasesOptions(params *DatabasesOptionsParams, opts ...ClientOption) (*DatabasesOptionsOK, error) - IngestOptions(params *IngestOptionsParams) (*IngestOptionsOK, error) + IngestOptions(params *IngestOptionsParams, opts ...ClientOption) (*IngestOptionsOK, error) - IngestsOptions(params *IngestsOptionsParams) (*IngestsOptionsOK, error) + IngestsOptions(params *IngestsOptionsParams, opts ...ClientOption) (*IngestsOptionsOK, error) - JobOptions(params *JobOptionsParams) (*JobOptionsOK, error) + JobOptions(params *JobOptionsParams, opts ...ClientOption) (*JobOptionsOK, error) - JobsOptions(params *JobsOptionsParams) (*JobsOptionsOK, error) + JobsOptions(params *JobsOptionsParams, opts ...ClientOption) (*JobsOptionsOK, error) - ServiceOptions(params *ServiceOptionsParams) (*ServiceOptionsOK, error) + ServiceOptions(params *ServiceOptionsParams, opts ...ClientOption) (*ServiceOptionsOK, error) - ServicesOptions(params *ServicesOptionsParams) (*ServicesOptionsOK, error) + ServicesOptions(params *ServicesOptionsParams, opts ...ClientOption) (*ServicesOptionsOK, error) - TemplateOptions(params *TemplateOptionsParams) (*TemplateOptionsOK, error) + TemplateOptions(params *TemplateOptionsParams, opts ...ClientOption) (*TemplateOptionsOK, error) - TemplatesOptions(params *TemplatesOptionsParams) (*TemplatesOptionsOK, error) + TemplatesOptions(params *TemplatesOptionsParams, opts ...ClientOption) (*TemplatesOptionsOK, error) - TenantOptions(params *TenantOptionsParams) (*TenantOptionsOK, error) + TenantOptions(params *TenantOptionsParams, opts ...ClientOption) (*TenantOptionsOK, error) - TenantsOptions(params *TenantsOptionsParams) (*TenantsOptionsOK, error) + TenantsOptions(params *TenantsOptionsParams, opts ...ClientOption) (*TenantsOptionsOK, error) - UserOptions(params *UserOptionsParams) (*UserOptionsOK, error) + UserOptions(params *UserOptionsParams, opts ...ClientOption) (*UserOptionsOK, error) - UsersOptions(params *UsersOptionsParams) (*UsersOptionsOK, error) + UsersOptions(params *UsersOptionsParams, opts ...ClientOption) (*UsersOptionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -69,13 +72,12 @@ type ClientService interface { /* ClusterOptions CORS support */ -func (a *Client) ClusterOptions(params *ClusterOptionsParams) (*ClusterOptionsOK, error) { +func (a *Client) ClusterOptions(params *ClusterOptionsParams, opts ...ClientOption) (*ClusterOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewClusterOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "clusterOptions", Method: "OPTIONS", PathPattern: "/clusters/observable", @@ -86,7 +88,12 @@ func (a *Client) ClusterOptions(params *ClusterOptionsParams) (*ClusterOptionsOK Reader: &ClusterOptionsReader{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 } @@ -103,13 +110,12 @@ func (a *Client) ClusterOptions(params *ClusterOptionsParams) (*ClusterOptionsOK /* ClustersOptions CORS support */ -func (a *Client) ClustersOptions(params *ClustersOptionsParams) (*ClustersOptionsOK, error) { +func (a *Client) ClustersOptions(params *ClustersOptionsParams, opts ...ClientOption) (*ClustersOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewClustersOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "clustersOptions", Method: "OPTIONS", PathPattern: "/clusters", @@ -120,7 +126,12 @@ func (a *Client) ClustersOptions(params *ClustersOptionsParams) (*ClustersOption Reader: &ClustersOptionsReader{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 } @@ -137,13 +148,12 @@ func (a *Client) ClustersOptions(params *ClustersOptionsParams) (*ClustersOption /* DatabaseOptions CORS support */ -func (a *Client) DatabaseOptions(params *DatabaseOptionsParams) (*DatabaseOptionsOK, error) { +func (a *Client) DatabaseOptions(params *DatabaseOptionsParams, opts ...ClientOption) (*DatabaseOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDatabaseOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "databaseOptions", Method: "OPTIONS", PathPattern: "/databases/observable", @@ -154,7 +164,12 @@ func (a *Client) DatabaseOptions(params *DatabaseOptionsParams) (*DatabaseOption Reader: &DatabaseOptionsReader{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 } @@ -171,13 +186,12 @@ func (a *Client) DatabaseOptions(params *DatabaseOptionsParams) (*DatabaseOption /* DatabasesOptions CORS support */ -func (a *Client) DatabasesOptions(params *DatabasesOptionsParams) (*DatabasesOptionsOK, error) { +func (a *Client) DatabasesOptions(params *DatabasesOptionsParams, opts ...ClientOption) (*DatabasesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDatabasesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "databasesOptions", Method: "OPTIONS", PathPattern: "/databases", @@ -188,7 +202,12 @@ func (a *Client) DatabasesOptions(params *DatabasesOptionsParams) (*DatabasesOpt Reader: &DatabasesOptionsReader{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 } @@ -205,13 +224,12 @@ func (a *Client) DatabasesOptions(params *DatabasesOptionsParams) (*DatabasesOpt /* IngestOptions CORS support */ -func (a *Client) IngestOptions(params *IngestOptionsParams) (*IngestOptionsOK, error) { +func (a *Client) IngestOptions(params *IngestOptionsParams, opts ...ClientOption) (*IngestOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewIngestOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "ingestOptions", Method: "OPTIONS", PathPattern: "/ingests/observable", @@ -222,7 +240,12 @@ func (a *Client) IngestOptions(params *IngestOptionsParams) (*IngestOptionsOK, e Reader: &IngestOptionsReader{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 } @@ -239,13 +262,12 @@ func (a *Client) IngestOptions(params *IngestOptionsParams) (*IngestOptionsOK, e /* IngestsOptions CORS support */ -func (a *Client) IngestsOptions(params *IngestsOptionsParams) (*IngestsOptionsOK, error) { +func (a *Client) IngestsOptions(params *IngestsOptionsParams, opts ...ClientOption) (*IngestsOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewIngestsOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "ingestsOptions", Method: "OPTIONS", PathPattern: "/ingests", @@ -256,7 +278,12 @@ func (a *Client) IngestsOptions(params *IngestsOptionsParams) (*IngestsOptionsOK Reader: &IngestsOptionsReader{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 } @@ -273,13 +300,12 @@ func (a *Client) IngestsOptions(params *IngestsOptionsParams) (*IngestsOptionsOK /* JobOptions CORS support */ -func (a *Client) JobOptions(params *JobOptionsParams) (*JobOptionsOK, error) { +func (a *Client) JobOptions(params *JobOptionsParams, opts ...ClientOption) (*JobOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewJobOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "jobOptions", Method: "OPTIONS", PathPattern: "/jobs/observable", @@ -290,7 +316,12 @@ func (a *Client) JobOptions(params *JobOptionsParams) (*JobOptionsOK, error) { Reader: &JobOptionsReader{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 } @@ -307,13 +338,12 @@ func (a *Client) JobOptions(params *JobOptionsParams) (*JobOptionsOK, error) { /* JobsOptions CORS support */ -func (a *Client) JobsOptions(params *JobsOptionsParams) (*JobsOptionsOK, error) { +func (a *Client) JobsOptions(params *JobsOptionsParams, opts ...ClientOption) (*JobsOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewJobsOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "jobsOptions", Method: "OPTIONS", PathPattern: "/jobs", @@ -324,7 +354,12 @@ func (a *Client) JobsOptions(params *JobsOptionsParams) (*JobsOptionsOK, error) Reader: &JobsOptionsReader{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 } @@ -341,13 +376,12 @@ func (a *Client) JobsOptions(params *JobsOptionsParams) (*JobsOptionsOK, error) /* ServiceOptions CORS support */ -func (a *Client) ServiceOptions(params *ServiceOptionsParams) (*ServiceOptionsOK, error) { +func (a *Client) ServiceOptions(params *ServiceOptionsParams, opts ...ClientOption) (*ServiceOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceOptions", Method: "OPTIONS", PathPattern: "/services/observable", @@ -358,7 +392,12 @@ func (a *Client) ServiceOptions(params *ServiceOptionsParams) (*ServiceOptionsOK Reader: &ServiceOptionsReader{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 } @@ -375,13 +414,12 @@ func (a *Client) ServiceOptions(params *ServiceOptionsParams) (*ServiceOptionsOK /* ServicesOptions CORS support */ -func (a *Client) ServicesOptions(params *ServicesOptionsParams) (*ServicesOptionsOK, error) { +func (a *Client) ServicesOptions(params *ServicesOptionsParams, opts ...ClientOption) (*ServicesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServicesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "servicesOptions", Method: "OPTIONS", PathPattern: "/services", @@ -392,7 +430,12 @@ func (a *Client) ServicesOptions(params *ServicesOptionsParams) (*ServicesOption Reader: &ServicesOptionsReader{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 } @@ -409,13 +452,12 @@ func (a *Client) ServicesOptions(params *ServicesOptionsParams) (*ServicesOption /* TemplateOptions CORS support */ -func (a *Client) TemplateOptions(params *TemplateOptionsParams) (*TemplateOptionsOK, error) { +func (a *Client) TemplateOptions(params *TemplateOptionsParams, opts ...ClientOption) (*TemplateOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTemplateOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "templateOptions", Method: "OPTIONS", PathPattern: "/templates/observable", @@ -426,7 +468,12 @@ func (a *Client) TemplateOptions(params *TemplateOptionsParams) (*TemplateOption Reader: &TemplateOptionsReader{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 } @@ -443,13 +490,12 @@ func (a *Client) TemplateOptions(params *TemplateOptionsParams) (*TemplateOption /* TemplatesOptions CORS support */ -func (a *Client) TemplatesOptions(params *TemplatesOptionsParams) (*TemplatesOptionsOK, error) { +func (a *Client) TemplatesOptions(params *TemplatesOptionsParams, opts ...ClientOption) (*TemplatesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTemplatesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "templatesOptions", Method: "OPTIONS", PathPattern: "/templates", @@ -460,7 +506,12 @@ func (a *Client) TemplatesOptions(params *TemplatesOptionsParams) (*TemplatesOpt Reader: &TemplatesOptionsReader{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 } @@ -477,13 +528,12 @@ func (a *Client) TemplatesOptions(params *TemplatesOptionsParams) (*TemplatesOpt /* TenantOptions CORS support */ -func (a *Client) TenantOptions(params *TenantOptionsParams) (*TenantOptionsOK, error) { +func (a *Client) TenantOptions(params *TenantOptionsParams, opts ...ClientOption) (*TenantOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTenantOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "tenantOptions", Method: "OPTIONS", PathPattern: "/tenants/observable", @@ -494,7 +544,12 @@ func (a *Client) TenantOptions(params *TenantOptionsParams) (*TenantOptionsOK, e Reader: &TenantOptionsReader{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 } @@ -511,13 +566,12 @@ func (a *Client) TenantOptions(params *TenantOptionsParams) (*TenantOptionsOK, e /* TenantsOptions CORS support */ -func (a *Client) TenantsOptions(params *TenantsOptionsParams) (*TenantsOptionsOK, error) { +func (a *Client) TenantsOptions(params *TenantsOptionsParams, opts ...ClientOption) (*TenantsOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTenantsOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "tenantsOptions", Method: "OPTIONS", PathPattern: "/tenants", @@ -528,7 +582,12 @@ func (a *Client) TenantsOptions(params *TenantsOptionsParams) (*TenantsOptionsOK Reader: &TenantsOptionsReader{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 } @@ -545,13 +604,12 @@ func (a *Client) TenantsOptions(params *TenantsOptionsParams) (*TenantsOptionsOK /* UserOptions CORS support */ -func (a *Client) UserOptions(params *UserOptionsParams) (*UserOptionsOK, error) { +func (a *Client) UserOptions(params *UserOptionsParams, opts ...ClientOption) (*UserOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewUserOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "userOptions", Method: "OPTIONS", PathPattern: "/users/observable", @@ -562,7 +620,12 @@ func (a *Client) UserOptions(params *UserOptionsParams) (*UserOptionsOK, error) Reader: &UserOptionsReader{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 } @@ -579,13 +642,12 @@ func (a *Client) UserOptions(params *UserOptionsParams) (*UserOptionsOK, error) /* UsersOptions CORS support */ -func (a *Client) UsersOptions(params *UsersOptionsParams) (*UsersOptionsOK, error) { +func (a *Client) UsersOptions(params *UsersOptionsParams, opts ...ClientOption) (*UsersOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewUsersOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "usersOptions", Method: "OPTIONS", PathPattern: "/users", @@ -596,7 +658,12 @@ func (a *Client) UsersOptions(params *UsersOptionsParams) (*UsersOptionsOK, erro Reader: &UsersOptionsReader{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 } diff --git a/api/devops/devops_client/cors/database_options_parameters.go b/api/devops/devops_client/cors/database_options_parameters.go index 226fef6..d93b39f 100644 --- a/api/devops/devops_client/cors/database_options_parameters.go +++ b/api/devops/devops_client/cors/database_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDatabaseOptionsParams creates a new DatabaseOptionsParams object -// with the default values initialized. +// NewDatabaseOptionsParams creates a new DatabaseOptionsParams 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 NewDatabaseOptionsParams() *DatabaseOptionsParams { - return &DatabaseOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewDatabaseOptionsParamsWithTimeout creates a new DatabaseOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDatabaseOptionsParamsWithTimeout(timeout time.Duration) *DatabaseOptionsParams { - return &DatabaseOptionsParams{ - timeout: timeout, } } // NewDatabaseOptionsParamsWithContext creates a new DatabaseOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDatabaseOptionsParamsWithContext(ctx context.Context) *DatabaseOptionsParams { - return &DatabaseOptionsParams{ - Context: ctx, } } // NewDatabaseOptionsParamsWithHTTPClient creates a new DatabaseOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDatabaseOptionsParamsWithHTTPClient(client *http.Client) *DatabaseOptionsParams { - return &DatabaseOptionsParams{ HTTPClient: client, } } -/*DatabaseOptionsParams contains all the parameters to send to the API endpoint -for the database options operation typically these are written to a http.Request +/* DatabaseOptionsParams contains all the parameters to send to the API endpoint + for the database options operation. + + Typically these are written to a http.Request. */ type DatabaseOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type DatabaseOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the database options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DatabaseOptionsParams) WithDefaults() *DatabaseOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the database options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DatabaseOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the database options params func (o *DatabaseOptionsParams) WithTimeout(timeout time.Duration) *DatabaseOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/database_options_responses.go b/api/devops/devops_client/cors/database_options_responses.go index 63a86d8..adc700a 100644 --- a/api/devops/devops_client/cors/database_options_responses.go +++ b/api/devops/devops_client/cors/database_options_responses.go @@ -30,9 +30,8 @@ func (o *DatabaseOptionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewDatabaseOptionsOK() *DatabaseOptionsOK { return &DatabaseOptionsOK{} } -/*DatabaseOptionsOK handles this case with default header values. +/* DatabaseOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type DatabaseOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *DatabaseOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *DatabaseOptionsOK) Error() string { func (o *DatabaseOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/databases_options_parameters.go b/api/devops/devops_client/cors/databases_options_parameters.go index 31f7081..d3e203e 100644 --- a/api/devops/devops_client/cors/databases_options_parameters.go +++ b/api/devops/devops_client/cors/databases_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDatabasesOptionsParams creates a new DatabasesOptionsParams object -// with the default values initialized. +// NewDatabasesOptionsParams creates a new DatabasesOptionsParams 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 NewDatabasesOptionsParams() *DatabasesOptionsParams { - return &DatabasesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewDatabasesOptionsParamsWithTimeout creates a new DatabasesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDatabasesOptionsParamsWithTimeout(timeout time.Duration) *DatabasesOptionsParams { - return &DatabasesOptionsParams{ - timeout: timeout, } } // NewDatabasesOptionsParamsWithContext creates a new DatabasesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDatabasesOptionsParamsWithContext(ctx context.Context) *DatabasesOptionsParams { - return &DatabasesOptionsParams{ - Context: ctx, } } // NewDatabasesOptionsParamsWithHTTPClient creates a new DatabasesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDatabasesOptionsParamsWithHTTPClient(client *http.Client) *DatabasesOptionsParams { - return &DatabasesOptionsParams{ HTTPClient: client, } } -/*DatabasesOptionsParams contains all the parameters to send to the API endpoint -for the databases options operation typically these are written to a http.Request +/* DatabasesOptionsParams contains all the parameters to send to the API endpoint + for the databases options operation. + + Typically these are written to a http.Request. */ type DatabasesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type DatabasesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the databases options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DatabasesOptionsParams) WithDefaults() *DatabasesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the databases options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DatabasesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the databases options params func (o *DatabasesOptionsParams) WithTimeout(timeout time.Duration) *DatabasesOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/databases_options_responses.go b/api/devops/devops_client/cors/databases_options_responses.go index 82ec728..01a7b07 100644 --- a/api/devops/devops_client/cors/databases_options_responses.go +++ b/api/devops/devops_client/cors/databases_options_responses.go @@ -30,9 +30,8 @@ func (o *DatabasesOptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewDatabasesOptionsOK() *DatabasesOptionsOK { return &DatabasesOptionsOK{} } -/*DatabasesOptionsOK handles this case with default header values. +/* DatabasesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type DatabasesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *DatabasesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *DatabasesOptionsOK) Error() string { func (o *DatabasesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/ingest_options_parameters.go b/api/devops/devops_client/cors/ingest_options_parameters.go index a7c0bbb..8e0f7e8 100644 --- a/api/devops/devops_client/cors/ingest_options_parameters.go +++ b/api/devops/devops_client/cors/ingest_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewIngestOptionsParams creates a new IngestOptionsParams object -// with the default values initialized. +// NewIngestOptionsParams creates a new IngestOptionsParams 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 NewIngestOptionsParams() *IngestOptionsParams { - return &IngestOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewIngestOptionsParamsWithTimeout creates a new IngestOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewIngestOptionsParamsWithTimeout(timeout time.Duration) *IngestOptionsParams { - return &IngestOptionsParams{ - timeout: timeout, } } // NewIngestOptionsParamsWithContext creates a new IngestOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewIngestOptionsParamsWithContext(ctx context.Context) *IngestOptionsParams { - return &IngestOptionsParams{ - Context: ctx, } } // NewIngestOptionsParamsWithHTTPClient creates a new IngestOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewIngestOptionsParamsWithHTTPClient(client *http.Client) *IngestOptionsParams { - return &IngestOptionsParams{ HTTPClient: client, } } -/*IngestOptionsParams contains all the parameters to send to the API endpoint -for the ingest options operation typically these are written to a http.Request +/* IngestOptionsParams contains all the parameters to send to the API endpoint + for the ingest options operation. + + Typically these are written to a http.Request. */ type IngestOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type IngestOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the ingest options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IngestOptionsParams) WithDefaults() *IngestOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the ingest options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IngestOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the ingest options params func (o *IngestOptionsParams) WithTimeout(timeout time.Duration) *IngestOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/ingest_options_responses.go b/api/devops/devops_client/cors/ingest_options_responses.go index b2b1d71..2f01304 100644 --- a/api/devops/devops_client/cors/ingest_options_responses.go +++ b/api/devops/devops_client/cors/ingest_options_responses.go @@ -30,9 +30,8 @@ func (o *IngestOptionsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewIngestOptionsOK() *IngestOptionsOK { return &IngestOptionsOK{} } -/*IngestOptionsOK handles this case with default header values. +/* IngestOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type IngestOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *IngestOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *IngestOptionsOK) Error() string { func (o *IngestOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/ingests_options_parameters.go b/api/devops/devops_client/cors/ingests_options_parameters.go index edb77ce..ca0bf77 100644 --- a/api/devops/devops_client/cors/ingests_options_parameters.go +++ b/api/devops/devops_client/cors/ingests_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewIngestsOptionsParams creates a new IngestsOptionsParams object -// with the default values initialized. +// NewIngestsOptionsParams creates a new IngestsOptionsParams 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 NewIngestsOptionsParams() *IngestsOptionsParams { - return &IngestsOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewIngestsOptionsParamsWithTimeout creates a new IngestsOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewIngestsOptionsParamsWithTimeout(timeout time.Duration) *IngestsOptionsParams { - return &IngestsOptionsParams{ - timeout: timeout, } } // NewIngestsOptionsParamsWithContext creates a new IngestsOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewIngestsOptionsParamsWithContext(ctx context.Context) *IngestsOptionsParams { - return &IngestsOptionsParams{ - Context: ctx, } } // NewIngestsOptionsParamsWithHTTPClient creates a new IngestsOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewIngestsOptionsParamsWithHTTPClient(client *http.Client) *IngestsOptionsParams { - return &IngestsOptionsParams{ HTTPClient: client, } } -/*IngestsOptionsParams contains all the parameters to send to the API endpoint -for the ingests options operation typically these are written to a http.Request +/* IngestsOptionsParams contains all the parameters to send to the API endpoint + for the ingests options operation. + + Typically these are written to a http.Request. */ type IngestsOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type IngestsOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the ingests options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IngestsOptionsParams) WithDefaults() *IngestsOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the ingests options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IngestsOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the ingests options params func (o *IngestsOptionsParams) WithTimeout(timeout time.Duration) *IngestsOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/ingests_options_responses.go b/api/devops/devops_client/cors/ingests_options_responses.go index c0b0b5b..4730151 100644 --- a/api/devops/devops_client/cors/ingests_options_responses.go +++ b/api/devops/devops_client/cors/ingests_options_responses.go @@ -30,9 +30,8 @@ func (o *IngestsOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewIngestsOptionsOK() *IngestsOptionsOK { return &IngestsOptionsOK{} } -/*IngestsOptionsOK handles this case with default header values. +/* IngestsOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type IngestsOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *IngestsOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *IngestsOptionsOK) Error() string { func (o *IngestsOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/job_options_parameters.go b/api/devops/devops_client/cors/job_options_parameters.go index d68b5a2..255b72c 100644 --- a/api/devops/devops_client/cors/job_options_parameters.go +++ b/api/devops/devops_client/cors/job_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewJobOptionsParams creates a new JobOptionsParams object -// with the default values initialized. +// NewJobOptionsParams creates a new JobOptionsParams 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 NewJobOptionsParams() *JobOptionsParams { - return &JobOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewJobOptionsParamsWithTimeout creates a new JobOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewJobOptionsParamsWithTimeout(timeout time.Duration) *JobOptionsParams { - return &JobOptionsParams{ - timeout: timeout, } } // NewJobOptionsParamsWithContext creates a new JobOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewJobOptionsParamsWithContext(ctx context.Context) *JobOptionsParams { - return &JobOptionsParams{ - Context: ctx, } } // NewJobOptionsParamsWithHTTPClient creates a new JobOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewJobOptionsParamsWithHTTPClient(client *http.Client) *JobOptionsParams { - return &JobOptionsParams{ HTTPClient: client, } } -/*JobOptionsParams contains all the parameters to send to the API endpoint -for the job options operation typically these are written to a http.Request +/* JobOptionsParams contains all the parameters to send to the API endpoint + for the job options operation. + + Typically these are written to a http.Request. */ type JobOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type JobOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the job options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *JobOptionsParams) WithDefaults() *JobOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the job options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *JobOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the job options params func (o *JobOptionsParams) WithTimeout(timeout time.Duration) *JobOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/job_options_responses.go b/api/devops/devops_client/cors/job_options_responses.go index 9d02b47..8ca1d4d 100644 --- a/api/devops/devops_client/cors/job_options_responses.go +++ b/api/devops/devops_client/cors/job_options_responses.go @@ -30,9 +30,8 @@ func (o *JobOptionsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewJobOptionsOK() *JobOptionsOK { return &JobOptionsOK{} } -/*JobOptionsOK handles this case with default header values. +/* JobOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type JobOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *JobOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *JobOptionsOK) Error() string { func (o *JobOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/jobs_options_parameters.go b/api/devops/devops_client/cors/jobs_options_parameters.go index 350adfe..ea46f79 100644 --- a/api/devops/devops_client/cors/jobs_options_parameters.go +++ b/api/devops/devops_client/cors/jobs_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewJobsOptionsParams creates a new JobsOptionsParams object -// with the default values initialized. +// NewJobsOptionsParams creates a new JobsOptionsParams 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 NewJobsOptionsParams() *JobsOptionsParams { - return &JobsOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewJobsOptionsParamsWithTimeout creates a new JobsOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewJobsOptionsParamsWithTimeout(timeout time.Duration) *JobsOptionsParams { - return &JobsOptionsParams{ - timeout: timeout, } } // NewJobsOptionsParamsWithContext creates a new JobsOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewJobsOptionsParamsWithContext(ctx context.Context) *JobsOptionsParams { - return &JobsOptionsParams{ - Context: ctx, } } // NewJobsOptionsParamsWithHTTPClient creates a new JobsOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewJobsOptionsParamsWithHTTPClient(client *http.Client) *JobsOptionsParams { - return &JobsOptionsParams{ HTTPClient: client, } } -/*JobsOptionsParams contains all the parameters to send to the API endpoint -for the jobs options operation typically these are written to a http.Request +/* JobsOptionsParams contains all the parameters to send to the API endpoint + for the jobs options operation. + + Typically these are written to a http.Request. */ type JobsOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type JobsOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the jobs options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *JobsOptionsParams) WithDefaults() *JobsOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the jobs options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *JobsOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the jobs options params func (o *JobsOptionsParams) WithTimeout(timeout time.Duration) *JobsOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/jobs_options_responses.go b/api/devops/devops_client/cors/jobs_options_responses.go index 5fd1e2a..9674625 100644 --- a/api/devops/devops_client/cors/jobs_options_responses.go +++ b/api/devops/devops_client/cors/jobs_options_responses.go @@ -30,9 +30,8 @@ func (o *JobsOptionsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewJobsOptionsOK() *JobsOptionsOK { return &JobsOptionsOK{} } -/*JobsOptionsOK handles this case with default header values. +/* JobsOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type JobsOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *JobsOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *JobsOptionsOK) Error() string { func (o *JobsOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/service_options_parameters.go b/api/devops/devops_client/cors/service_options_parameters.go index e6ab499..e4e5f20 100644 --- a/api/devops/devops_client/cors/service_options_parameters.go +++ b/api/devops/devops_client/cors/service_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewServiceOptionsParams creates a new ServiceOptionsParams object -// with the default values initialized. +// NewServiceOptionsParams creates a new ServiceOptionsParams 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 NewServiceOptionsParams() *ServiceOptionsParams { - return &ServiceOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewServiceOptionsParamsWithTimeout creates a new ServiceOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceOptionsParamsWithTimeout(timeout time.Duration) *ServiceOptionsParams { - return &ServiceOptionsParams{ - timeout: timeout, } } // NewServiceOptionsParamsWithContext creates a new ServiceOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceOptionsParamsWithContext(ctx context.Context) *ServiceOptionsParams { - return &ServiceOptionsParams{ - Context: ctx, } } // NewServiceOptionsParamsWithHTTPClient creates a new ServiceOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceOptionsParamsWithHTTPClient(client *http.Client) *ServiceOptionsParams { - return &ServiceOptionsParams{ HTTPClient: client, } } -/*ServiceOptionsParams contains all the parameters to send to the API endpoint -for the service options operation typically these are written to a http.Request +/* ServiceOptionsParams contains all the parameters to send to the API endpoint + for the service options operation. + + Typically these are written to a http.Request. */ type ServiceOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ServiceOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceOptionsParams) WithDefaults() *ServiceOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service options params func (o *ServiceOptionsParams) WithTimeout(timeout time.Duration) *ServiceOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/service_options_responses.go b/api/devops/devops_client/cors/service_options_responses.go index 2cc92fd..689f4b7 100644 --- a/api/devops/devops_client/cors/service_options_responses.go +++ b/api/devops/devops_client/cors/service_options_responses.go @@ -30,9 +30,8 @@ func (o *ServiceOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewServiceOptionsOK() *ServiceOptionsOK { return &ServiceOptionsOK{} } -/*ServiceOptionsOK handles this case with default header values. +/* ServiceOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ServiceOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ServiceOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *ServiceOptionsOK) Error() string { func (o *ServiceOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/services_options_parameters.go b/api/devops/devops_client/cors/services_options_parameters.go index a1dd83a..ba276a6 100644 --- a/api/devops/devops_client/cors/services_options_parameters.go +++ b/api/devops/devops_client/cors/services_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewServicesOptionsParams creates a new ServicesOptionsParams object -// with the default values initialized. +// NewServicesOptionsParams creates a new ServicesOptionsParams 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 NewServicesOptionsParams() *ServicesOptionsParams { - return &ServicesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewServicesOptionsParamsWithTimeout creates a new ServicesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServicesOptionsParamsWithTimeout(timeout time.Duration) *ServicesOptionsParams { - return &ServicesOptionsParams{ - timeout: timeout, } } // NewServicesOptionsParamsWithContext creates a new ServicesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServicesOptionsParamsWithContext(ctx context.Context) *ServicesOptionsParams { - return &ServicesOptionsParams{ - Context: ctx, } } // NewServicesOptionsParamsWithHTTPClient creates a new ServicesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServicesOptionsParamsWithHTTPClient(client *http.Client) *ServicesOptionsParams { - return &ServicesOptionsParams{ HTTPClient: client, } } -/*ServicesOptionsParams contains all the parameters to send to the API endpoint -for the services options operation typically these are written to a http.Request +/* ServicesOptionsParams contains all the parameters to send to the API endpoint + for the services options operation. + + Typically these are written to a http.Request. */ type ServicesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ServicesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the services options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServicesOptionsParams) WithDefaults() *ServicesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the services options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServicesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the services options params func (o *ServicesOptionsParams) WithTimeout(timeout time.Duration) *ServicesOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/services_options_responses.go b/api/devops/devops_client/cors/services_options_responses.go index b18b6ea..a165aea 100644 --- a/api/devops/devops_client/cors/services_options_responses.go +++ b/api/devops/devops_client/cors/services_options_responses.go @@ -30,9 +30,8 @@ func (o *ServicesOptionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewServicesOptionsOK() *ServicesOptionsOK { return &ServicesOptionsOK{} } -/*ServicesOptionsOK handles this case with default header values. +/* ServicesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ServicesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ServicesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *ServicesOptionsOK) Error() string { func (o *ServicesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/template_options_parameters.go b/api/devops/devops_client/cors/template_options_parameters.go index 6b4f22a..ca492e6 100644 --- a/api/devops/devops_client/cors/template_options_parameters.go +++ b/api/devops/devops_client/cors/template_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTemplateOptionsParams creates a new TemplateOptionsParams object -// with the default values initialized. +// NewTemplateOptionsParams creates a new TemplateOptionsParams 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 NewTemplateOptionsParams() *TemplateOptionsParams { - return &TemplateOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTemplateOptionsParamsWithTimeout creates a new TemplateOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTemplateOptionsParamsWithTimeout(timeout time.Duration) *TemplateOptionsParams { - return &TemplateOptionsParams{ - timeout: timeout, } } // NewTemplateOptionsParamsWithContext creates a new TemplateOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTemplateOptionsParamsWithContext(ctx context.Context) *TemplateOptionsParams { - return &TemplateOptionsParams{ - Context: ctx, } } // NewTemplateOptionsParamsWithHTTPClient creates a new TemplateOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTemplateOptionsParamsWithHTTPClient(client *http.Client) *TemplateOptionsParams { - return &TemplateOptionsParams{ HTTPClient: client, } } -/*TemplateOptionsParams contains all the parameters to send to the API endpoint -for the template options operation typically these are written to a http.Request +/* TemplateOptionsParams contains all the parameters to send to the API endpoint + for the template options operation. + + Typically these are written to a http.Request. */ type TemplateOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TemplateOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the template options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TemplateOptionsParams) WithDefaults() *TemplateOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the template options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TemplateOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the template options params func (o *TemplateOptionsParams) WithTimeout(timeout time.Duration) *TemplateOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/template_options_responses.go b/api/devops/devops_client/cors/template_options_responses.go index 4f9db8e..e9d99b6 100644 --- a/api/devops/devops_client/cors/template_options_responses.go +++ b/api/devops/devops_client/cors/template_options_responses.go @@ -30,9 +30,8 @@ func (o *TemplateOptionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTemplateOptionsOK() *TemplateOptionsOK { return &TemplateOptionsOK{} } -/*TemplateOptionsOK handles this case with default header values. +/* TemplateOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TemplateOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TemplateOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TemplateOptionsOK) Error() string { func (o *TemplateOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/templates_options_parameters.go b/api/devops/devops_client/cors/templates_options_parameters.go index c9d84f7..571e480 100644 --- a/api/devops/devops_client/cors/templates_options_parameters.go +++ b/api/devops/devops_client/cors/templates_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTemplatesOptionsParams creates a new TemplatesOptionsParams object -// with the default values initialized. +// NewTemplatesOptionsParams creates a new TemplatesOptionsParams 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 NewTemplatesOptionsParams() *TemplatesOptionsParams { - return &TemplatesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTemplatesOptionsParamsWithTimeout creates a new TemplatesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTemplatesOptionsParamsWithTimeout(timeout time.Duration) *TemplatesOptionsParams { - return &TemplatesOptionsParams{ - timeout: timeout, } } // NewTemplatesOptionsParamsWithContext creates a new TemplatesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTemplatesOptionsParamsWithContext(ctx context.Context) *TemplatesOptionsParams { - return &TemplatesOptionsParams{ - Context: ctx, } } // NewTemplatesOptionsParamsWithHTTPClient creates a new TemplatesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTemplatesOptionsParamsWithHTTPClient(client *http.Client) *TemplatesOptionsParams { - return &TemplatesOptionsParams{ HTTPClient: client, } } -/*TemplatesOptionsParams contains all the parameters to send to the API endpoint -for the templates options operation typically these are written to a http.Request +/* TemplatesOptionsParams contains all the parameters to send to the API endpoint + for the templates options operation. + + Typically these are written to a http.Request. */ type TemplatesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TemplatesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the templates options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TemplatesOptionsParams) WithDefaults() *TemplatesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the templates options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TemplatesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the templates options params func (o *TemplatesOptionsParams) WithTimeout(timeout time.Duration) *TemplatesOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/templates_options_responses.go b/api/devops/devops_client/cors/templates_options_responses.go index 3f28c6a..ebd8268 100644 --- a/api/devops/devops_client/cors/templates_options_responses.go +++ b/api/devops/devops_client/cors/templates_options_responses.go @@ -30,9 +30,8 @@ func (o *TemplatesOptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTemplatesOptionsOK() *TemplatesOptionsOK { return &TemplatesOptionsOK{} } -/*TemplatesOptionsOK handles this case with default header values. +/* TemplatesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TemplatesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TemplatesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TemplatesOptionsOK) Error() string { func (o *TemplatesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/tenant_options_parameters.go b/api/devops/devops_client/cors/tenant_options_parameters.go index 292d9a9..b1b1635 100644 --- a/api/devops/devops_client/cors/tenant_options_parameters.go +++ b/api/devops/devops_client/cors/tenant_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTenantOptionsParams creates a new TenantOptionsParams object -// with the default values initialized. +// NewTenantOptionsParams creates a new TenantOptionsParams 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 NewTenantOptionsParams() *TenantOptionsParams { - return &TenantOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTenantOptionsParamsWithTimeout creates a new TenantOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTenantOptionsParamsWithTimeout(timeout time.Duration) *TenantOptionsParams { - return &TenantOptionsParams{ - timeout: timeout, } } // NewTenantOptionsParamsWithContext creates a new TenantOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTenantOptionsParamsWithContext(ctx context.Context) *TenantOptionsParams { - return &TenantOptionsParams{ - Context: ctx, } } // NewTenantOptionsParamsWithHTTPClient creates a new TenantOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTenantOptionsParamsWithHTTPClient(client *http.Client) *TenantOptionsParams { - return &TenantOptionsParams{ HTTPClient: client, } } -/*TenantOptionsParams contains all the parameters to send to the API endpoint -for the tenant options operation typically these are written to a http.Request +/* TenantOptionsParams contains all the parameters to send to the API endpoint + for the tenant options operation. + + Typically these are written to a http.Request. */ type TenantOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TenantOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tenant options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantOptionsParams) WithDefaults() *TenantOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tenant options params func (o *TenantOptionsParams) WithTimeout(timeout time.Duration) *TenantOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/tenant_options_responses.go b/api/devops/devops_client/cors/tenant_options_responses.go index 21d1d89..86fffa2 100644 --- a/api/devops/devops_client/cors/tenant_options_responses.go +++ b/api/devops/devops_client/cors/tenant_options_responses.go @@ -30,9 +30,8 @@ func (o *TenantOptionsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTenantOptionsOK() *TenantOptionsOK { return &TenantOptionsOK{} } -/*TenantOptionsOK handles this case with default header values. +/* TenantOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TenantOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TenantOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TenantOptionsOK) Error() string { func (o *TenantOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/tenants_options_parameters.go b/api/devops/devops_client/cors/tenants_options_parameters.go index 7594765..cff05d0 100644 --- a/api/devops/devops_client/cors/tenants_options_parameters.go +++ b/api/devops/devops_client/cors/tenants_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTenantsOptionsParams creates a new TenantsOptionsParams object -// with the default values initialized. +// NewTenantsOptionsParams creates a new TenantsOptionsParams 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 NewTenantsOptionsParams() *TenantsOptionsParams { - return &TenantsOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTenantsOptionsParamsWithTimeout creates a new TenantsOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTenantsOptionsParamsWithTimeout(timeout time.Duration) *TenantsOptionsParams { - return &TenantsOptionsParams{ - timeout: timeout, } } // NewTenantsOptionsParamsWithContext creates a new TenantsOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTenantsOptionsParamsWithContext(ctx context.Context) *TenantsOptionsParams { - return &TenantsOptionsParams{ - Context: ctx, } } // NewTenantsOptionsParamsWithHTTPClient creates a new TenantsOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTenantsOptionsParamsWithHTTPClient(client *http.Client) *TenantsOptionsParams { - return &TenantsOptionsParams{ HTTPClient: client, } } -/*TenantsOptionsParams contains all the parameters to send to the API endpoint -for the tenants options operation typically these are written to a http.Request +/* TenantsOptionsParams contains all the parameters to send to the API endpoint + for the tenants options operation. + + Typically these are written to a http.Request. */ type TenantsOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TenantsOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tenants options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantsOptionsParams) WithDefaults() *TenantsOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenants options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantsOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tenants options params func (o *TenantsOptionsParams) WithTimeout(timeout time.Duration) *TenantsOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/tenants_options_responses.go b/api/devops/devops_client/cors/tenants_options_responses.go index e8d9130..ec98a92 100644 --- a/api/devops/devops_client/cors/tenants_options_responses.go +++ b/api/devops/devops_client/cors/tenants_options_responses.go @@ -30,9 +30,8 @@ func (o *TenantsOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTenantsOptionsOK() *TenantsOptionsOK { return &TenantsOptionsOK{} } -/*TenantsOptionsOK handles this case with default header values. +/* TenantsOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TenantsOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TenantsOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TenantsOptionsOK) Error() string { func (o *TenantsOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/user_options_parameters.go b/api/devops/devops_client/cors/user_options_parameters.go index 77b8959..3e18555 100644 --- a/api/devops/devops_client/cors/user_options_parameters.go +++ b/api/devops/devops_client/cors/user_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewUserOptionsParams creates a new UserOptionsParams object -// with the default values initialized. +// NewUserOptionsParams creates a new UserOptionsParams 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 NewUserOptionsParams() *UserOptionsParams { - return &UserOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewUserOptionsParamsWithTimeout creates a new UserOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewUserOptionsParamsWithTimeout(timeout time.Duration) *UserOptionsParams { - return &UserOptionsParams{ - timeout: timeout, } } // NewUserOptionsParamsWithContext creates a new UserOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewUserOptionsParamsWithContext(ctx context.Context) *UserOptionsParams { - return &UserOptionsParams{ - Context: ctx, } } // NewUserOptionsParamsWithHTTPClient creates a new UserOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewUserOptionsParamsWithHTTPClient(client *http.Client) *UserOptionsParams { - return &UserOptionsParams{ HTTPClient: client, } } -/*UserOptionsParams contains all the parameters to send to the API endpoint -for the user options operation typically these are written to a http.Request +/* UserOptionsParams contains all the parameters to send to the API endpoint + for the user options operation. + + Typically these are written to a http.Request. */ type UserOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type UserOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the user options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserOptionsParams) WithDefaults() *UserOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the user options params func (o *UserOptionsParams) WithTimeout(timeout time.Duration) *UserOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/user_options_responses.go b/api/devops/devops_client/cors/user_options_responses.go index fdf54cb..fb5eb26 100644 --- a/api/devops/devops_client/cors/user_options_responses.go +++ b/api/devops/devops_client/cors/user_options_responses.go @@ -30,9 +30,8 @@ func (o *UserOptionsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewUserOptionsOK() *UserOptionsOK { return &UserOptionsOK{} } -/*UserOptionsOK handles this case with default header values. +/* UserOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type UserOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *UserOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *UserOptionsOK) Error() string { func (o *UserOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/cors/users_options_parameters.go b/api/devops/devops_client/cors/users_options_parameters.go index 4aed61c..cdbe0d9 100644 --- a/api/devops/devops_client/cors/users_options_parameters.go +++ b/api/devops/devops_client/cors/users_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewUsersOptionsParams creates a new UsersOptionsParams object -// with the default values initialized. +// NewUsersOptionsParams creates a new UsersOptionsParams 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 NewUsersOptionsParams() *UsersOptionsParams { - return &UsersOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewUsersOptionsParamsWithTimeout creates a new UsersOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewUsersOptionsParamsWithTimeout(timeout time.Duration) *UsersOptionsParams { - return &UsersOptionsParams{ - timeout: timeout, } } // NewUsersOptionsParamsWithContext creates a new UsersOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewUsersOptionsParamsWithContext(ctx context.Context) *UsersOptionsParams { - return &UsersOptionsParams{ - Context: ctx, } } // NewUsersOptionsParamsWithHTTPClient creates a new UsersOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewUsersOptionsParamsWithHTTPClient(client *http.Client) *UsersOptionsParams { - return &UsersOptionsParams{ HTTPClient: client, } } -/*UsersOptionsParams contains all the parameters to send to the API endpoint -for the users options operation typically these are written to a http.Request +/* UsersOptionsParams contains all the parameters to send to the API endpoint + for the users options operation. + + Typically these are written to a http.Request. */ type UsersOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type UsersOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the users options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UsersOptionsParams) WithDefaults() *UsersOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the users options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UsersOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the users options params func (o *UsersOptionsParams) WithTimeout(timeout time.Duration) *UsersOptionsParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/cors/users_options_responses.go b/api/devops/devops_client/cors/users_options_responses.go index 7c8e0df..1fe859c 100644 --- a/api/devops/devops_client/cors/users_options_responses.go +++ b/api/devops/devops_client/cors/users_options_responses.go @@ -30,9 +30,8 @@ func (o *UsersOptionsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewUsersOptionsOK() *UsersOptionsOK { return &UsersOptionsOK{} } -/*UsersOptionsOK handles this case with default header values. +/* UsersOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type UsersOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *UsersOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *UsersOptionsOK) Error() string { func (o *UsersOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/devops/devops_client/database/database_client.go b/api/devops/devops_client/database/database_client.go index 90afaf1..7592ee5 100644 --- a/api/devops/devops_client/database/database_client.go +++ b/api/devops/devops_client/database/database_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetDatabase(params *GetDatabaseParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabaseOK, error) + GetDatabase(params *GetDatabaseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabaseOK, error) - GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabasesOK, error) + GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabasesOK, error) - GetDatabasesObservable(params *GetDatabasesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabasesObservableOK, error) + GetDatabasesObservable(params *GetDatabasesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabasesObservableOK, error) - PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PostDatabasesOK, error) + PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDatabasesOK, error) - PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PutDatabasesOK, error) + PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDatabasesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Return a single Database object from datastore as a Singleton */ -func (a *Client) GetDatabase(params *GetDatabaseParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabaseOK, error) { +func (a *Client) GetDatabase(params *GetDatabaseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabaseOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDatabaseParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDatabase", Method: "GET", PathPattern: "/databases/{databaseIdPath}", @@ -67,7 +69,12 @@ func (a *Client) GetDatabase(params *GetDatabaseParams, authInfo runtime.ClientA 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 } @@ -86,13 +93,12 @@ func (a *Client) GetDatabase(params *GetDatabaseParams, authInfo runtime.ClientA Return a list of Database records from the datastore */ -func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabasesOK, error) { +func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDatabasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDatabases", Method: "GET", PathPattern: "/databases", @@ -104,7 +110,12 @@ func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.Clien 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 } @@ -123,13 +134,12 @@ func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.Clien Returns a Database retrieval in a observable array */ -func (a *Client) GetDatabasesObservable(params *GetDatabasesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabasesObservableOK, error) { +func (a *Client) GetDatabasesObservable(params *GetDatabasesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabasesObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDatabasesObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDatabasesObservable", Method: "GET", PathPattern: "/databases/observable", @@ -141,7 +151,12 @@ func (a *Client) GetDatabasesObservable(params *GetDatabasesObservableParams, au 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 } @@ -160,13 +175,12 @@ func (a *Client) GetDatabasesObservable(params *GetDatabasesObservableParams, au Create Databases in Taxnexus */ -func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PostDatabasesOK, error) { +func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDatabasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostDatabasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postDatabases", Method: "POST", PathPattern: "/databases", @@ -178,7 +192,12 @@ func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.Cli 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 } @@ -197,13 +216,12 @@ func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.Cli Update Database in Taxnexus */ -func (a *Client) PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PutDatabasesOK, error) { +func (a *Client) PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDatabasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutDatabasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putDatabases", Method: "PUT", PathPattern: "/databases", @@ -215,7 +233,12 @@ func (a *Client) PutDatabases(params *PutDatabasesParams, authInfo runtime.Clien 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 } diff --git a/api/devops/devops_client/database/get_database_parameters.go b/api/devops/devops_client/database/get_database_parameters.go index 63d9a59..e87e702 100644 --- a/api/devops/devops_client/database/get_database_parameters.go +++ b/api/devops/devops_client/database/get_database_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetDatabaseParams creates a new GetDatabaseParams object -// with the default values initialized. +// NewGetDatabaseParams creates a new GetDatabaseParams 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 NewGetDatabaseParams() *GetDatabaseParams { - var () return &GetDatabaseParams{ - timeout: cr.DefaultTimeout, } } // NewGetDatabaseParamsWithTimeout creates a new GetDatabaseParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDatabaseParamsWithTimeout(timeout time.Duration) *GetDatabaseParams { - var () return &GetDatabaseParams{ - timeout: timeout, } } // NewGetDatabaseParamsWithContext creates a new GetDatabaseParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDatabaseParamsWithContext(ctx context.Context) *GetDatabaseParams { - var () return &GetDatabaseParams{ - Context: ctx, } } // NewGetDatabaseParamsWithHTTPClient creates a new GetDatabaseParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDatabaseParamsWithHTTPClient(client *http.Client) *GetDatabaseParams { - var () return &GetDatabaseParams{ HTTPClient: client, } } -/*GetDatabaseParams contains all the parameters to send to the API endpoint -for the get database operation typically these are written to a http.Request +/* GetDatabaseParams contains all the parameters to send to the API endpoint + for the get database operation. + + Typically these are written to a http.Request. */ type GetDatabaseParams struct { - /*DatabaseIDPath - Taxnexus Record Id of a Database + /* DatabaseIDPath. + Taxnexus Record Id of a Database */ DatabaseIDPath string @@ -75,6 +74,21 @@ type GetDatabaseParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get database params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabaseParams) WithDefaults() *GetDatabaseParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get database params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabaseParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get database params func (o *GetDatabaseParams) WithTimeout(timeout time.Duration) *GetDatabaseParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/database/get_database_responses.go b/api/devops/devops_client/database/get_database_responses.go index 69089e4..44c89bf 100644 --- a/api/devops/devops_client/database/get_database_responses.go +++ b/api/devops/devops_client/database/get_database_responses.go @@ -63,9 +63,8 @@ func (o *GetDatabaseReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetDatabaseOK() *GetDatabaseOK { return &GetDatabaseOK{} } -/*GetDatabaseOK handles this case with default header values. +/* GetDatabaseOK describes a response with status code 200, with default header values. Single Database record response */ type GetDatabaseOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Database } @@ -89,18 +87,25 @@ type GetDatabaseOK struct { func (o *GetDatabaseOK) Error() string { return fmt.Sprintf("[GET /databases/{databaseIdPath}][%d] getDatabaseOK %+v", 200, o.Payload) } - func (o *GetDatabaseOK) GetPayload() *devops_models.Database { return o.Payload } func (o *GetDatabaseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Database) @@ -117,14 +122,13 @@ func NewGetDatabaseUnauthorized() *GetDatabaseUnauthorized { return &GetDatabaseUnauthorized{} } -/*GetDatabaseUnauthorized handles this case with default header values. +/* GetDatabaseUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetDatabaseUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetDatabaseUnauthorized struct { func (o *GetDatabaseUnauthorized) Error() string { return fmt.Sprintf("[GET /databases/{databaseIdPath}][%d] getDatabaseUnauthorized %+v", 401, o.Payload) } - func (o *GetDatabaseUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabaseUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetDatabaseForbidden() *GetDatabaseForbidden { return &GetDatabaseForbidden{} } -/*GetDatabaseForbidden handles this case with default header values. +/* GetDatabaseForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetDatabaseForbidden struct { func (o *GetDatabaseForbidden) Error() string { return fmt.Sprintf("[GET /databases/{databaseIdPath}][%d] getDatabaseForbidden %+v", 403, o.Payload) } - func (o *GetDatabaseForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabaseForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetDatabaseNotFound() *GetDatabaseNotFound { return &GetDatabaseNotFound{} } -/*GetDatabaseNotFound handles this case with default header values. +/* GetDatabaseNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetDatabaseNotFound struct { func (o *GetDatabaseNotFound) Error() string { return fmt.Sprintf("[GET /databases/{databaseIdPath}][%d] getDatabaseNotFound %+v", 404, o.Payload) } - func (o *GetDatabaseNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabaseNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetDatabaseUnprocessableEntity() *GetDatabaseUnprocessableEntity { return &GetDatabaseUnprocessableEntity{} } -/*GetDatabaseUnprocessableEntity handles this case with default header values. +/* GetDatabaseUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetDatabaseUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetDatabaseUnprocessableEntity struct { func (o *GetDatabaseUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /databases/{databaseIdPath}][%d] getDatabaseUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetDatabaseUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabaseUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetDatabaseInternalServerError() *GetDatabaseInternalServerError { return &GetDatabaseInternalServerError{} } -/*GetDatabaseInternalServerError handles this case with default header values. +/* GetDatabaseInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetDatabaseInternalServerError struct { func (o *GetDatabaseInternalServerError) Error() string { return fmt.Sprintf("[GET /databases/{databaseIdPath}][%d] getDatabaseInternalServerError %+v", 500, o.Payload) } - func (o *GetDatabaseInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabaseInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/database/get_databases_observable_parameters.go b/api/devops/devops_client/database/get_databases_observable_parameters.go index cf4794d..1ca9f26 100644 --- a/api/devops/devops_client/database/get_databases_observable_parameters.go +++ b/api/devops/devops_client/database/get_databases_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetDatabasesObservableParams creates a new GetDatabasesObservableParams object -// with the default values initialized. +// NewGetDatabasesObservableParams creates a new GetDatabasesObservableParams 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 NewGetDatabasesObservableParams() *GetDatabasesObservableParams { - return &GetDatabasesObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetDatabasesObservableParamsWithTimeout creates a new GetDatabasesObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDatabasesObservableParamsWithTimeout(timeout time.Duration) *GetDatabasesObservableParams { - return &GetDatabasesObservableParams{ - timeout: timeout, } } // NewGetDatabasesObservableParamsWithContext creates a new GetDatabasesObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDatabasesObservableParamsWithContext(ctx context.Context) *GetDatabasesObservableParams { - return &GetDatabasesObservableParams{ - Context: ctx, } } // NewGetDatabasesObservableParamsWithHTTPClient creates a new GetDatabasesObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDatabasesObservableParamsWithHTTPClient(client *http.Client) *GetDatabasesObservableParams { - return &GetDatabasesObservableParams{ HTTPClient: client, } } -/*GetDatabasesObservableParams contains all the parameters to send to the API endpoint -for the get databases observable operation typically these are written to a http.Request +/* GetDatabasesObservableParams contains all the parameters to send to the API endpoint + for the get databases observable operation. + + Typically these are written to a http.Request. */ type GetDatabasesObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetDatabasesObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get databases observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabasesObservableParams) WithDefaults() *GetDatabasesObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get databases observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabasesObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get databases observable params func (o *GetDatabasesObservableParams) WithTimeout(timeout time.Duration) *GetDatabasesObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/database/get_databases_observable_responses.go b/api/devops/devops_client/database/get_databases_observable_responses.go index 2564bd4..7f72914 100644 --- a/api/devops/devops_client/database/get_databases_observable_responses.go +++ b/api/devops/devops_client/database/get_databases_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetDatabasesObservableReader) ReadResponse(response runtime.ClientRespo return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetDatabasesObservableOK() *GetDatabasesObservableOK { return &GetDatabasesObservableOK{} } -/*GetDatabasesObservableOK handles this case with default header values. +/* GetDatabasesObservableOK describes a response with status code 200, with default header values. Single Database record response */ type GetDatabasesObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.Database } @@ -89,18 +87,25 @@ type GetDatabasesObservableOK struct { func (o *GetDatabasesObservableOK) Error() string { return fmt.Sprintf("[GET /databases/observable][%d] getDatabasesObservableOK %+v", 200, o.Payload) } - func (o *GetDatabasesObservableOK) GetPayload() []*devops_models.Database { return o.Payload } func (o *GetDatabasesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetDatabasesObservableUnauthorized() *GetDatabasesObservableUnauthorized return &GetDatabasesObservableUnauthorized{} } -/*GetDatabasesObservableUnauthorized handles this case with default header values. +/* GetDatabasesObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetDatabasesObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetDatabasesObservableUnauthorized struct { func (o *GetDatabasesObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /databases/observable][%d] getDatabasesObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetDatabasesObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetDatabasesObservableForbidden() *GetDatabasesObservableForbidden { return &GetDatabasesObservableForbidden{} } -/*GetDatabasesObservableForbidden handles this case with default header values. +/* GetDatabasesObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetDatabasesObservableForbidden struct { func (o *GetDatabasesObservableForbidden) Error() string { return fmt.Sprintf("[GET /databases/observable][%d] getDatabasesObservableForbidden %+v", 403, o.Payload) } - func (o *GetDatabasesObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetDatabasesObservableNotFound() *GetDatabasesObservableNotFound { return &GetDatabasesObservableNotFound{} } -/*GetDatabasesObservableNotFound handles this case with default header values. +/* GetDatabasesObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetDatabasesObservableNotFound struct { func (o *GetDatabasesObservableNotFound) Error() string { return fmt.Sprintf("[GET /databases/observable][%d] getDatabasesObservableNotFound %+v", 404, o.Payload) } - func (o *GetDatabasesObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetDatabasesObservableUnprocessableEntity() *GetDatabasesObservableUnpro return &GetDatabasesObservableUnprocessableEntity{} } -/*GetDatabasesObservableUnprocessableEntity handles this case with default header values. +/* GetDatabasesObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetDatabasesObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetDatabasesObservableUnprocessableEntity struct { func (o *GetDatabasesObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /databases/observable][%d] getDatabasesObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetDatabasesObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetDatabasesObservableInternalServerError() *GetDatabasesObservableInter return &GetDatabasesObservableInternalServerError{} } -/*GetDatabasesObservableInternalServerError handles this case with default header values. +/* GetDatabasesObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetDatabasesObservableInternalServerError struct { func (o *GetDatabasesObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /databases/observable][%d] getDatabasesObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetDatabasesObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/database/get_databases_parameters.go b/api/devops/devops_client/database/get_databases_parameters.go index 009a1af..4da19e3 100644 --- a/api/devops/devops_client/database/get_databases_parameters.go +++ b/api/devops/devops_client/database/get_databases_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetDatabasesParams creates a new GetDatabasesParams object -// with the default values initialized. +// NewGetDatabasesParams creates a new GetDatabasesParams 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 NewGetDatabasesParams() *GetDatabasesParams { - var () return &GetDatabasesParams{ - timeout: cr.DefaultTimeout, } } // NewGetDatabasesParamsWithTimeout creates a new GetDatabasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDatabasesParamsWithTimeout(timeout time.Duration) *GetDatabasesParams { - var () return &GetDatabasesParams{ - timeout: timeout, } } // NewGetDatabasesParamsWithContext creates a new GetDatabasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDatabasesParamsWithContext(ctx context.Context) *GetDatabasesParams { - var () return &GetDatabasesParams{ - Context: ctx, } } // NewGetDatabasesParamsWithHTTPClient creates a new GetDatabasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDatabasesParamsWithHTTPClient(client *http.Client) *GetDatabasesParams { - var () return &GetDatabasesParams{ HTTPClient: client, } } -/*GetDatabasesParams contains all the parameters to send to the API endpoint -for the get databases operation typically these are written to a http.Request +/* GetDatabasesParams contains all the parameters to send to the API endpoint + for the get databases operation. + + Typically these are written to a http.Request. */ type GetDatabasesParams struct { - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + Taxnexus Record Id of a Company */ CompanyID *string - /*DatabaseID - Taxnexus Record Id of a Database + /* DatabaseID. + + Taxnexus Record Id of a Database */ DatabaseID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetDatabasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabasesParams) WithDefaults() *GetDatabasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get databases params func (o *GetDatabasesParams) WithTimeout(timeout time.Duration) *GetDatabasesParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetDatabasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.DatabaseID != nil { // query param databaseId var qrDatabaseID string + if o.DatabaseID != nil { qrDatabaseID = *o.DatabaseID } qDatabaseID := qrDatabaseID if qDatabaseID != "" { + if err := r.SetQueryParam("databaseId", qDatabaseID); 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 { diff --git a/api/devops/devops_client/database/get_databases_responses.go b/api/devops/devops_client/database/get_databases_responses.go index a01df8b..b50f5eb 100644 --- a/api/devops/devops_client/database/get_databases_responses.go +++ b/api/devops/devops_client/database/get_databases_responses.go @@ -63,9 +63,8 @@ func (o *GetDatabasesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetDatabasesOK() *GetDatabasesOK { return &GetDatabasesOK{} } -/*GetDatabasesOK handles this case with default header values. +/* GetDatabasesOK describes a response with status code 200, with default header values. Taxnexus Response with Database objects */ @@ -87,15 +86,18 @@ type GetDatabasesOK struct { func (o *GetDatabasesOK) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesOK %+v", 200, o.Payload) } - func (o *GetDatabasesOK) GetPayload() *devops_models.DatabaseResponse { return o.Payload } func (o *GetDatabasesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.DatabaseResponse) @@ -112,14 +114,13 @@ func NewGetDatabasesUnauthorized() *GetDatabasesUnauthorized { return &GetDatabasesUnauthorized{} } -/*GetDatabasesUnauthorized handles this case with default header values. +/* GetDatabasesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetDatabasesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -127,18 +128,25 @@ type GetDatabasesUnauthorized struct { func (o *GetDatabasesUnauthorized) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesUnauthorized %+v", 401, o.Payload) } - func (o *GetDatabasesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -155,7 +163,7 @@ func NewGetDatabasesForbidden() *GetDatabasesForbidden { return &GetDatabasesForbidden{} } -/*GetDatabasesForbidden handles this case with default header values. +/* GetDatabasesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetDatabasesForbidden struct { func (o *GetDatabasesForbidden) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesForbidden %+v", 403, o.Payload) } - func (o *GetDatabasesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -193,7 +204,7 @@ func NewGetDatabasesNotFound() *GetDatabasesNotFound { return &GetDatabasesNotFound{} } -/*GetDatabasesNotFound handles this case with default header values. +/* GetDatabasesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetDatabasesNotFound struct { func (o *GetDatabasesNotFound) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesNotFound %+v", 404, o.Payload) } - func (o *GetDatabasesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -231,14 +245,13 @@ func NewGetDatabasesUnprocessableEntity() *GetDatabasesUnprocessableEntity { return &GetDatabasesUnprocessableEntity{} } -/*GetDatabasesUnprocessableEntity handles this case with default header values. +/* GetDatabasesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetDatabasesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -246,18 +259,25 @@ type GetDatabasesUnprocessableEntity struct { func (o *GetDatabasesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetDatabasesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -274,7 +294,7 @@ func NewGetDatabasesInternalServerError() *GetDatabasesInternalServerError { return &GetDatabasesInternalServerError{} } -/*GetDatabasesInternalServerError handles this case with default header values. +/* GetDatabasesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -287,15 +307,18 @@ type GetDatabasesInternalServerError struct { func (o *GetDatabasesInternalServerError) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesInternalServerError %+v", 500, o.Payload) } - func (o *GetDatabasesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetDatabasesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/database/post_databases_parameters.go b/api/devops/devops_client/database/post_databases_parameters.go index a402309..ed095c3 100644 --- a/api/devops/devops_client/database/post_databases_parameters.go +++ b/api/devops/devops_client/database/post_databases_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostDatabasesParams creates a new PostDatabasesParams object -// with the default values initialized. +// NewPostDatabasesParams creates a new PostDatabasesParams 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 NewPostDatabasesParams() *PostDatabasesParams { - var () return &PostDatabasesParams{ - timeout: cr.DefaultTimeout, } } // NewPostDatabasesParamsWithTimeout creates a new PostDatabasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostDatabasesParamsWithTimeout(timeout time.Duration) *PostDatabasesParams { - var () return &PostDatabasesParams{ - timeout: timeout, } } // NewPostDatabasesParamsWithContext creates a new PostDatabasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostDatabasesParamsWithContext(ctx context.Context) *PostDatabasesParams { - var () return &PostDatabasesParams{ - Context: ctx, } } // NewPostDatabasesParamsWithHTTPClient creates a new PostDatabasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostDatabasesParamsWithHTTPClient(client *http.Client) *PostDatabasesParams { - var () return &PostDatabasesParams{ HTTPClient: client, } } -/*PostDatabasesParams contains all the parameters to send to the API endpoint -for the post databases operation typically these are written to a http.Request +/* PostDatabasesParams contains all the parameters to send to the API endpoint + for the post databases operation. + + Typically these are written to a http.Request. */ type PostDatabasesParams struct { - /*DatabaseRequest - An array of Database records + /* DatabaseRequest. + An array of Database records */ DatabaseRequest *devops_models.DatabaseRequest @@ -77,6 +76,21 @@ type PostDatabasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostDatabasesParams) WithDefaults() *PostDatabasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostDatabasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post databases params func (o *PostDatabasesParams) WithTimeout(timeout time.Duration) *PostDatabasesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostDatabasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.DatabaseRequest != nil { if err := r.SetBodyParam(o.DatabaseRequest); err != nil { return err diff --git a/api/devops/devops_client/database/post_databases_responses.go b/api/devops/devops_client/database/post_databases_responses.go index a6ff9bb..bbc6b7c 100644 --- a/api/devops/devops_client/database/post_databases_responses.go +++ b/api/devops/devops_client/database/post_databases_responses.go @@ -63,9 +63,8 @@ func (o *PostDatabasesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostDatabasesOK() *PostDatabasesOK { return &PostDatabasesOK{} } -/*PostDatabasesOK handles this case with default header values. +/* PostDatabasesOK describes a response with status code 200, with default header values. Taxnexus Response with Database objects */ @@ -87,15 +86,18 @@ type PostDatabasesOK struct { func (o *PostDatabasesOK) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesOK %+v", 200, o.Payload) } - func (o *PostDatabasesOK) GetPayload() *devops_models.DatabaseResponse { return o.Payload } func (o *PostDatabasesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.DatabaseResponse) @@ -112,14 +114,13 @@ func NewPostDatabasesUnauthorized() *PostDatabasesUnauthorized { return &PostDatabasesUnauthorized{} } -/*PostDatabasesUnauthorized handles this case with default header values. +/* PostDatabasesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostDatabasesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -127,18 +128,25 @@ type PostDatabasesUnauthorized struct { func (o *PostDatabasesUnauthorized) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesUnauthorized %+v", 401, o.Payload) } - func (o *PostDatabasesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostDatabasesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -155,7 +163,7 @@ func NewPostDatabasesForbidden() *PostDatabasesForbidden { return &PostDatabasesForbidden{} } -/*PostDatabasesForbidden handles this case with default header values. +/* PostDatabasesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostDatabasesForbidden struct { func (o *PostDatabasesForbidden) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesForbidden %+v", 403, o.Payload) } - func (o *PostDatabasesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostDatabasesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -193,7 +204,7 @@ func NewPostDatabasesNotFound() *PostDatabasesNotFound { return &PostDatabasesNotFound{} } -/*PostDatabasesNotFound handles this case with default header values. +/* PostDatabasesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostDatabasesNotFound struct { func (o *PostDatabasesNotFound) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesNotFound %+v", 404, o.Payload) } - func (o *PostDatabasesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostDatabasesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -231,14 +245,13 @@ func NewPostDatabasesUnprocessableEntity() *PostDatabasesUnprocessableEntity { return &PostDatabasesUnprocessableEntity{} } -/*PostDatabasesUnprocessableEntity handles this case with default header values. +/* PostDatabasesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostDatabasesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -246,18 +259,25 @@ type PostDatabasesUnprocessableEntity struct { func (o *PostDatabasesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostDatabasesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostDatabasesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -274,7 +294,7 @@ func NewPostDatabasesInternalServerError() *PostDatabasesInternalServerError { return &PostDatabasesInternalServerError{} } -/*PostDatabasesInternalServerError handles this case with default header values. +/* PostDatabasesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -287,15 +307,18 @@ type PostDatabasesInternalServerError struct { func (o *PostDatabasesInternalServerError) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesInternalServerError %+v", 500, o.Payload) } - func (o *PostDatabasesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostDatabasesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/database/put_databases_parameters.go b/api/devops/devops_client/database/put_databases_parameters.go index f051746..58c14cb 100644 --- a/api/devops/devops_client/database/put_databases_parameters.go +++ b/api/devops/devops_client/database/put_databases_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPutDatabasesParams creates a new PutDatabasesParams object -// with the default values initialized. +// NewPutDatabasesParams creates a new PutDatabasesParams 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 NewPutDatabasesParams() *PutDatabasesParams { - var () return &PutDatabasesParams{ - timeout: cr.DefaultTimeout, } } // NewPutDatabasesParamsWithTimeout creates a new PutDatabasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutDatabasesParamsWithTimeout(timeout time.Duration) *PutDatabasesParams { - var () return &PutDatabasesParams{ - timeout: timeout, } } // NewPutDatabasesParamsWithContext creates a new PutDatabasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutDatabasesParamsWithContext(ctx context.Context) *PutDatabasesParams { - var () return &PutDatabasesParams{ - Context: ctx, } } // NewPutDatabasesParamsWithHTTPClient creates a new PutDatabasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutDatabasesParamsWithHTTPClient(client *http.Client) *PutDatabasesParams { - var () return &PutDatabasesParams{ HTTPClient: client, } } -/*PutDatabasesParams contains all the parameters to send to the API endpoint -for the put databases operation typically these are written to a http.Request +/* PutDatabasesParams contains all the parameters to send to the API endpoint + for the put databases operation. + + Typically these are written to a http.Request. */ type PutDatabasesParams struct { - /*DatabaseRequest - An array of Database records + /* DatabaseRequest. + An array of Database records */ DatabaseRequest *devops_models.DatabaseRequest @@ -77,6 +76,21 @@ type PutDatabasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutDatabasesParams) WithDefaults() *PutDatabasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutDatabasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put databases params func (o *PutDatabasesParams) WithTimeout(timeout time.Duration) *PutDatabasesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutDatabasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.DatabaseRequest != nil { if err := r.SetBodyParam(o.DatabaseRequest); err != nil { return err diff --git a/api/devops/devops_client/database/put_databases_responses.go b/api/devops/devops_client/database/put_databases_responses.go index c7a716b..f6a5e0e 100644 --- a/api/devops/devops_client/database/put_databases_responses.go +++ b/api/devops/devops_client/database/put_databases_responses.go @@ -63,9 +63,8 @@ func (o *PutDatabasesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutDatabasesOK() *PutDatabasesOK { return &PutDatabasesOK{} } -/*PutDatabasesOK handles this case with default header values. +/* PutDatabasesOK describes a response with status code 200, with default header values. Taxnexus Response with Database objects */ @@ -87,15 +86,18 @@ type PutDatabasesOK struct { func (o *PutDatabasesOK) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesOK %+v", 200, o.Payload) } - func (o *PutDatabasesOK) GetPayload() *devops_models.DatabaseResponse { return o.Payload } func (o *PutDatabasesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.DatabaseResponse) @@ -112,14 +114,13 @@ func NewPutDatabasesUnauthorized() *PutDatabasesUnauthorized { return &PutDatabasesUnauthorized{} } -/*PutDatabasesUnauthorized handles this case with default header values. +/* PutDatabasesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PutDatabasesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -127,18 +128,25 @@ type PutDatabasesUnauthorized struct { func (o *PutDatabasesUnauthorized) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesUnauthorized %+v", 401, o.Payload) } - func (o *PutDatabasesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PutDatabasesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -155,7 +163,7 @@ func NewPutDatabasesForbidden() *PutDatabasesForbidden { return &PutDatabasesForbidden{} } -/*PutDatabasesForbidden handles this case with default header values. +/* PutDatabasesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutDatabasesForbidden struct { func (o *PutDatabasesForbidden) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesForbidden %+v", 403, o.Payload) } - func (o *PutDatabasesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PutDatabasesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -193,7 +204,7 @@ func NewPutDatabasesNotFound() *PutDatabasesNotFound { return &PutDatabasesNotFound{} } -/*PutDatabasesNotFound handles this case with default header values. +/* PutDatabasesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutDatabasesNotFound struct { func (o *PutDatabasesNotFound) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesNotFound %+v", 404, o.Payload) } - func (o *PutDatabasesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PutDatabasesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -231,14 +245,13 @@ func NewPutDatabasesUnprocessableEntity() *PutDatabasesUnprocessableEntity { return &PutDatabasesUnprocessableEntity{} } -/*PutDatabasesUnprocessableEntity handles this case with default header values. +/* PutDatabasesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PutDatabasesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -246,18 +259,25 @@ type PutDatabasesUnprocessableEntity struct { func (o *PutDatabasesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutDatabasesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PutDatabasesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -274,7 +294,7 @@ func NewPutDatabasesInternalServerError() *PutDatabasesInternalServerError { return &PutDatabasesInternalServerError{} } -/*PutDatabasesInternalServerError handles this case with default header values. +/* PutDatabasesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -287,15 +307,18 @@ type PutDatabasesInternalServerError struct { func (o *PutDatabasesInternalServerError) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesInternalServerError %+v", 500, o.Payload) } - func (o *PutDatabasesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PutDatabasesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/ingest/get_ingest_parameters.go b/api/devops/devops_client/ingest/get_ingest_parameters.go index 2334272..82413aa 100644 --- a/api/devops/devops_client/ingest/get_ingest_parameters.go +++ b/api/devops/devops_client/ingest/get_ingest_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetIngestParams creates a new GetIngestParams object -// with the default values initialized. +// NewGetIngestParams creates a new GetIngestParams 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 NewGetIngestParams() *GetIngestParams { - var () return &GetIngestParams{ - timeout: cr.DefaultTimeout, } } // NewGetIngestParamsWithTimeout creates a new GetIngestParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetIngestParamsWithTimeout(timeout time.Duration) *GetIngestParams { - var () return &GetIngestParams{ - timeout: timeout, } } // NewGetIngestParamsWithContext creates a new GetIngestParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetIngestParamsWithContext(ctx context.Context) *GetIngestParams { - var () return &GetIngestParams{ - Context: ctx, } } // NewGetIngestParamsWithHTTPClient creates a new GetIngestParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetIngestParamsWithHTTPClient(client *http.Client) *GetIngestParams { - var () return &GetIngestParams{ HTTPClient: client, } } -/*GetIngestParams contains all the parameters to send to the API endpoint -for the get ingest operation typically these are written to a http.Request +/* GetIngestParams contains all the parameters to send to the API endpoint + for the get ingest operation. + + Typically these are written to a http.Request. */ type GetIngestParams struct { - /*IngestIDPath - Taxnexus Record Id of a Ingest + /* IngestIDPath. + Taxnexus Record Id of a Ingest */ IngestIDPath string @@ -75,6 +74,21 @@ type GetIngestParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get ingest params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestParams) WithDefaults() *GetIngestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get ingest params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get ingest params func (o *GetIngestParams) WithTimeout(timeout time.Duration) *GetIngestParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/ingest/get_ingest_responses.go b/api/devops/devops_client/ingest/get_ingest_responses.go index a90412d..0c7995b 100644 --- a/api/devops/devops_client/ingest/get_ingest_responses.go +++ b/api/devops/devops_client/ingest/get_ingest_responses.go @@ -63,9 +63,8 @@ func (o *GetIngestReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetIngestOK() *GetIngestOK { return &GetIngestOK{} } -/*GetIngestOK handles this case with default header values. +/* GetIngestOK describes a response with status code 200, with default header values. Single Ingest record response */ type GetIngestOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Ingest } @@ -89,18 +87,25 @@ type GetIngestOK struct { func (o *GetIngestOK) Error() string { return fmt.Sprintf("[GET /ingests/{ingestIdPath}][%d] getIngestOK %+v", 200, o.Payload) } - func (o *GetIngestOK) GetPayload() *devops_models.Ingest { return o.Payload } func (o *GetIngestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Ingest) @@ -117,14 +122,13 @@ func NewGetIngestUnauthorized() *GetIngestUnauthorized { return &GetIngestUnauthorized{} } -/*GetIngestUnauthorized handles this case with default header values. +/* GetIngestUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetIngestUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetIngestUnauthorized struct { func (o *GetIngestUnauthorized) Error() string { return fmt.Sprintf("[GET /ingests/{ingestIdPath}][%d] getIngestUnauthorized %+v", 401, o.Payload) } - func (o *GetIngestUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetIngestForbidden() *GetIngestForbidden { return &GetIngestForbidden{} } -/*GetIngestForbidden handles this case with default header values. +/* GetIngestForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetIngestForbidden struct { func (o *GetIngestForbidden) Error() string { return fmt.Sprintf("[GET /ingests/{ingestIdPath}][%d] getIngestForbidden %+v", 403, o.Payload) } - func (o *GetIngestForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetIngestNotFound() *GetIngestNotFound { return &GetIngestNotFound{} } -/*GetIngestNotFound handles this case with default header values. +/* GetIngestNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetIngestNotFound struct { func (o *GetIngestNotFound) Error() string { return fmt.Sprintf("[GET /ingests/{ingestIdPath}][%d] getIngestNotFound %+v", 404, o.Payload) } - func (o *GetIngestNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetIngestUnprocessableEntity() *GetIngestUnprocessableEntity { return &GetIngestUnprocessableEntity{} } -/*GetIngestUnprocessableEntity handles this case with default header values. +/* GetIngestUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetIngestUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetIngestUnprocessableEntity struct { func (o *GetIngestUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /ingests/{ingestIdPath}][%d] getIngestUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetIngestUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetIngestInternalServerError() *GetIngestInternalServerError { return &GetIngestInternalServerError{} } -/*GetIngestInternalServerError handles this case with default header values. +/* GetIngestInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetIngestInternalServerError struct { func (o *GetIngestInternalServerError) Error() string { return fmt.Sprintf("[GET /ingests/{ingestIdPath}][%d] getIngestInternalServerError %+v", 500, o.Payload) } - func (o *GetIngestInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/ingest/get_ingests_observable_parameters.go b/api/devops/devops_client/ingest/get_ingests_observable_parameters.go index fcc3b2a..81a389a 100644 --- a/api/devops/devops_client/ingest/get_ingests_observable_parameters.go +++ b/api/devops/devops_client/ingest/get_ingests_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetIngestsObservableParams creates a new GetIngestsObservableParams object -// with the default values initialized. +// NewGetIngestsObservableParams creates a new GetIngestsObservableParams 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 NewGetIngestsObservableParams() *GetIngestsObservableParams { - return &GetIngestsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetIngestsObservableParamsWithTimeout creates a new GetIngestsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetIngestsObservableParamsWithTimeout(timeout time.Duration) *GetIngestsObservableParams { - return &GetIngestsObservableParams{ - timeout: timeout, } } // NewGetIngestsObservableParamsWithContext creates a new GetIngestsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetIngestsObservableParamsWithContext(ctx context.Context) *GetIngestsObservableParams { - return &GetIngestsObservableParams{ - Context: ctx, } } // NewGetIngestsObservableParamsWithHTTPClient creates a new GetIngestsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetIngestsObservableParamsWithHTTPClient(client *http.Client) *GetIngestsObservableParams { - return &GetIngestsObservableParams{ HTTPClient: client, } } -/*GetIngestsObservableParams contains all the parameters to send to the API endpoint -for the get ingests observable operation typically these are written to a http.Request +/* GetIngestsObservableParams contains all the parameters to send to the API endpoint + for the get ingests observable operation. + + Typically these are written to a http.Request. */ type GetIngestsObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetIngestsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get ingests observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestsObservableParams) WithDefaults() *GetIngestsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get ingests observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get ingests observable params func (o *GetIngestsObservableParams) WithTimeout(timeout time.Duration) *GetIngestsObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/ingest/get_ingests_observable_responses.go b/api/devops/devops_client/ingest/get_ingests_observable_responses.go index b72ccd1..2982b39 100644 --- a/api/devops/devops_client/ingest/get_ingests_observable_responses.go +++ b/api/devops/devops_client/ingest/get_ingests_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetIngestsObservableReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetIngestsObservableOK() *GetIngestsObservableOK { return &GetIngestsObservableOK{} } -/*GetIngestsObservableOK handles this case with default header values. +/* GetIngestsObservableOK describes a response with status code 200, with default header values. Single Ingest record response */ type GetIngestsObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.Ingest } @@ -89,18 +87,25 @@ type GetIngestsObservableOK struct { func (o *GetIngestsObservableOK) Error() string { return fmt.Sprintf("[GET /ingests/observable][%d] getIngestsObservableOK %+v", 200, o.Payload) } - func (o *GetIngestsObservableOK) GetPayload() []*devops_models.Ingest { return o.Payload } func (o *GetIngestsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetIngestsObservableUnauthorized() *GetIngestsObservableUnauthorized { return &GetIngestsObservableUnauthorized{} } -/*GetIngestsObservableUnauthorized handles this case with default header values. +/* GetIngestsObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetIngestsObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetIngestsObservableUnauthorized struct { func (o *GetIngestsObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /ingests/observable][%d] getIngestsObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetIngestsObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetIngestsObservableForbidden() *GetIngestsObservableForbidden { return &GetIngestsObservableForbidden{} } -/*GetIngestsObservableForbidden handles this case with default header values. +/* GetIngestsObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetIngestsObservableForbidden struct { func (o *GetIngestsObservableForbidden) Error() string { return fmt.Sprintf("[GET /ingests/observable][%d] getIngestsObservableForbidden %+v", 403, o.Payload) } - func (o *GetIngestsObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetIngestsObservableNotFound() *GetIngestsObservableNotFound { return &GetIngestsObservableNotFound{} } -/*GetIngestsObservableNotFound handles this case with default header values. +/* GetIngestsObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetIngestsObservableNotFound struct { func (o *GetIngestsObservableNotFound) Error() string { return fmt.Sprintf("[GET /ingests/observable][%d] getIngestsObservableNotFound %+v", 404, o.Payload) } - func (o *GetIngestsObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetIngestsObservableUnprocessableEntity() *GetIngestsObservableUnprocess return &GetIngestsObservableUnprocessableEntity{} } -/*GetIngestsObservableUnprocessableEntity handles this case with default header values. +/* GetIngestsObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetIngestsObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetIngestsObservableUnprocessableEntity struct { func (o *GetIngestsObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /ingests/observable][%d] getIngestsObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetIngestsObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetIngestsObservableInternalServerError() *GetIngestsObservableInternalS return &GetIngestsObservableInternalServerError{} } -/*GetIngestsObservableInternalServerError handles this case with default header values. +/* GetIngestsObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetIngestsObservableInternalServerError struct { func (o *GetIngestsObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /ingests/observable][%d] getIngestsObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetIngestsObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/ingest/get_ingests_parameters.go b/api/devops/devops_client/ingest/get_ingests_parameters.go index 1d1a4a5..4b5e5a8 100644 --- a/api/devops/devops_client/ingest/get_ingests_parameters.go +++ b/api/devops/devops_client/ingest/get_ingests_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetIngestsParams creates a new GetIngestsParams object -// with the default values initialized. +// NewGetIngestsParams creates a new GetIngestsParams 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 NewGetIngestsParams() *GetIngestsParams { - var () return &GetIngestsParams{ - timeout: cr.DefaultTimeout, } } // NewGetIngestsParamsWithTimeout creates a new GetIngestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetIngestsParamsWithTimeout(timeout time.Duration) *GetIngestsParams { - var () return &GetIngestsParams{ - timeout: timeout, } } // NewGetIngestsParamsWithContext creates a new GetIngestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetIngestsParamsWithContext(ctx context.Context) *GetIngestsParams { - var () return &GetIngestsParams{ - Context: ctx, } } // NewGetIngestsParamsWithHTTPClient creates a new GetIngestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetIngestsParamsWithHTTPClient(client *http.Client) *GetIngestsParams { - var () return &GetIngestsParams{ HTTPClient: client, } } -/*GetIngestsParams contains all the parameters to send to the API endpoint -for the get ingests operation typically these are written to a http.Request +/* GetIngestsParams contains all the parameters to send to the API endpoint + for the get ingests operation. + + Typically these are written to a http.Request. */ type GetIngestsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + + Taxnexus Record Id of a Company */ CompanyID *string - /*IngestID - Taxnexus Record Id of an Ingest + /* IngestID. + + Taxnexus Record Id of an Ingest */ IngestID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -96,6 +103,21 @@ type GetIngestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestsParams) WithDefaults() *GetIngestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get ingests params func (o *GetIngestsParams) WithTimeout(timeout time.Duration) *GetIngestsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetIngestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // 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.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.IngestID != nil { // query param ingestId var qrIngestID string + if o.IngestID != nil { qrIngestID = *o.IngestID } qIngestID := qrIngestID if qIngestID != "" { + if err := r.SetQueryParam("ingestId", qIngestID); 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 { diff --git a/api/devops/devops_client/ingest/get_ingests_responses.go b/api/devops/devops_client/ingest/get_ingests_responses.go index b4a8371..e8480d6 100644 --- a/api/devops/devops_client/ingest/get_ingests_responses.go +++ b/api/devops/devops_client/ingest/get_ingests_responses.go @@ -63,9 +63,8 @@ func (o *GetIngestsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetIngestsOK() *GetIngestsOK { return &GetIngestsOK{} } -/*GetIngestsOK handles this case with default header values. +/* GetIngestsOK describes a response with status code 200, with default header values. Taxnexus Response with Ingest objects */ type GetIngestsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.IngestResponse } @@ -89,18 +87,25 @@ type GetIngestsOK struct { func (o *GetIngestsOK) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsOK %+v", 200, o.Payload) } - func (o *GetIngestsOK) GetPayload() *devops_models.IngestResponse { return o.Payload } func (o *GetIngestsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.IngestResponse) @@ -117,14 +122,13 @@ func NewGetIngestsUnauthorized() *GetIngestsUnauthorized { return &GetIngestsUnauthorized{} } -/*GetIngestsUnauthorized handles this case with default header values. +/* GetIngestsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetIngestsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetIngestsUnauthorized struct { func (o *GetIngestsUnauthorized) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsUnauthorized %+v", 401, o.Payload) } - func (o *GetIngestsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetIngestsForbidden() *GetIngestsForbidden { return &GetIngestsForbidden{} } -/*GetIngestsForbidden handles this case with default header values. +/* GetIngestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetIngestsForbidden struct { func (o *GetIngestsForbidden) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsForbidden %+v", 403, o.Payload) } - func (o *GetIngestsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetIngestsNotFound() *GetIngestsNotFound { return &GetIngestsNotFound{} } -/*GetIngestsNotFound handles this case with default header values. +/* GetIngestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetIngestsNotFound struct { func (o *GetIngestsNotFound) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsNotFound %+v", 404, o.Payload) } - func (o *GetIngestsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetIngestsUnprocessableEntity() *GetIngestsUnprocessableEntity { return &GetIngestsUnprocessableEntity{} } -/*GetIngestsUnprocessableEntity handles this case with default header values. +/* GetIngestsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetIngestsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetIngestsUnprocessableEntity struct { func (o *GetIngestsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetIngestsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetIngestsInternalServerError() *GetIngestsInternalServerError { return &GetIngestsInternalServerError{} } -/*GetIngestsInternalServerError handles this case with default header values. +/* GetIngestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetIngestsInternalServerError struct { func (o *GetIngestsInternalServerError) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsInternalServerError %+v", 500, o.Payload) } - func (o *GetIngestsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetIngestsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/ingest/ingest_client.go b/api/devops/devops_client/ingest/ingest_client.go index 68931aa..c8ad36f 100644 --- a/api/devops/devops_client/ingest/ingest_client.go +++ b/api/devops/devops_client/ingest/ingest_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetIngest(params *GetIngestParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestOK, error) + GetIngest(params *GetIngestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestOK, error) - GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestsOK, error) + GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestsOK, error) - GetIngestsObservable(params *GetIngestsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestsObservableOK, error) + GetIngestsObservable(params *GetIngestsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestsObservableOK, error) - PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PostIngestsOK, error) + PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIngestsOK, error) - PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PutIngestsOK, error) + PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIngestsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Return a single Ingest object from datastore as a Singleton */ -func (a *Client) GetIngest(params *GetIngestParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestOK, error) { +func (a *Client) GetIngest(params *GetIngestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetIngestParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getIngest", Method: "GET", PathPattern: "/ingests/{ingestIdPath}", @@ -67,7 +69,12 @@ func (a *Client) GetIngest(params *GetIngestParams, authInfo runtime.ClientAuthI 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 } @@ -86,13 +93,12 @@ func (a *Client) GetIngest(params *GetIngestParams, authInfo runtime.ClientAuthI Return a list of Ingest records */ -func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestsOK, error) { +func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetIngestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getIngests", Method: "GET", PathPattern: "/ingests", @@ -104,7 +110,12 @@ func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAut 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 } @@ -123,13 +134,12 @@ func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAut Returns a Ingest retrieval in a observable array */ -func (a *Client) GetIngestsObservable(params *GetIngestsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestsObservableOK, error) { +func (a *Client) GetIngestsObservable(params *GetIngestsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetIngestsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getIngestsObservable", Method: "GET", PathPattern: "/ingests/observable", @@ -141,7 +151,12 @@ func (a *Client) GetIngestsObservable(params *GetIngestsObservableParams, authIn 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 } @@ -160,13 +175,12 @@ func (a *Client) GetIngestsObservable(params *GetIngestsObservableParams, authIn Create new Ingests */ -func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PostIngestsOK, error) { +func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIngestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostIngestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postIngests", Method: "POST", PathPattern: "/ingests", @@ -178,7 +192,12 @@ func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientA 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 } @@ -197,13 +216,12 @@ func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientA Update Ingests */ -func (a *Client) PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PutIngestsOK, error) { +func (a *Client) PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIngestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutIngestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putIngests", Method: "PUT", PathPattern: "/ingests", @@ -215,7 +233,12 @@ func (a *Client) PutIngests(params *PutIngestsParams, authInfo runtime.ClientAut 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 } diff --git a/api/devops/devops_client/ingest/post_ingests_parameters.go b/api/devops/devops_client/ingest/post_ingests_parameters.go index 9807993..3312f23 100644 --- a/api/devops/devops_client/ingest/post_ingests_parameters.go +++ b/api/devops/devops_client/ingest/post_ingests_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostIngestsParams creates a new PostIngestsParams object -// with the default values initialized. +// NewPostIngestsParams creates a new PostIngestsParams 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 NewPostIngestsParams() *PostIngestsParams { - var () return &PostIngestsParams{ - timeout: cr.DefaultTimeout, } } // NewPostIngestsParamsWithTimeout creates a new PostIngestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostIngestsParamsWithTimeout(timeout time.Duration) *PostIngestsParams { - var () return &PostIngestsParams{ - timeout: timeout, } } // NewPostIngestsParamsWithContext creates a new PostIngestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostIngestsParamsWithContext(ctx context.Context) *PostIngestsParams { - var () return &PostIngestsParams{ - Context: ctx, } } // NewPostIngestsParamsWithHTTPClient creates a new PostIngestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostIngestsParamsWithHTTPClient(client *http.Client) *PostIngestsParams { - var () return &PostIngestsParams{ HTTPClient: client, } } -/*PostIngestsParams contains all the parameters to send to the API endpoint -for the post ingests operation typically these are written to a http.Request +/* PostIngestsParams contains all the parameters to send to the API endpoint + for the post ingests operation. + + Typically these are written to a http.Request. */ type PostIngestsParams struct { - /*IngestRequest - An array of Ingest records + /* IngestRequest. + An array of Ingest records */ IngestRequest *devops_models.IngestRequest @@ -77,6 +76,21 @@ type PostIngestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostIngestsParams) WithDefaults() *PostIngestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostIngestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post ingests params func (o *PostIngestsParams) WithTimeout(timeout time.Duration) *PostIngestsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostIngestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.IngestRequest != nil { if err := r.SetBodyParam(o.IngestRequest); err != nil { return err diff --git a/api/devops/devops_client/ingest/post_ingests_responses.go b/api/devops/devops_client/ingest/post_ingests_responses.go index e4611ab..8a6a11e 100644 --- a/api/devops/devops_client/ingest/post_ingests_responses.go +++ b/api/devops/devops_client/ingest/post_ingests_responses.go @@ -63,9 +63,8 @@ func (o *PostIngestsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostIngestsOK() *PostIngestsOK { return &PostIngestsOK{} } -/*PostIngestsOK handles this case with default header values. +/* PostIngestsOK describes a response with status code 200, with default header values. Taxnexus Response with Ingest objects */ type PostIngestsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.IngestResponse } @@ -89,18 +87,25 @@ type PostIngestsOK struct { func (o *PostIngestsOK) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsOK %+v", 200, o.Payload) } - func (o *PostIngestsOK) GetPayload() *devops_models.IngestResponse { return o.Payload } func (o *PostIngestsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.IngestResponse) @@ -117,14 +122,13 @@ func NewPostIngestsUnauthorized() *PostIngestsUnauthorized { return &PostIngestsUnauthorized{} } -/*PostIngestsUnauthorized handles this case with default header values. +/* PostIngestsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostIngestsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PostIngestsUnauthorized struct { func (o *PostIngestsUnauthorized) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsUnauthorized %+v", 401, o.Payload) } - func (o *PostIngestsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostIngestsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPostIngestsForbidden() *PostIngestsForbidden { return &PostIngestsForbidden{} } -/*PostIngestsForbidden handles this case with default header values. +/* PostIngestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PostIngestsForbidden struct { func (o *PostIngestsForbidden) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsForbidden %+v", 403, o.Payload) } - func (o *PostIngestsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostIngestsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPostIngestsNotFound() *PostIngestsNotFound { return &PostIngestsNotFound{} } -/*PostIngestsNotFound handles this case with default header values. +/* PostIngestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PostIngestsNotFound struct { func (o *PostIngestsNotFound) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsNotFound %+v", 404, o.Payload) } - func (o *PostIngestsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostIngestsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPostIngestsUnprocessableEntity() *PostIngestsUnprocessableEntity { return &PostIngestsUnprocessableEntity{} } -/*PostIngestsUnprocessableEntity handles this case with default header values. +/* PostIngestsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostIngestsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PostIngestsUnprocessableEntity struct { func (o *PostIngestsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostIngestsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostIngestsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPostIngestsInternalServerError() *PostIngestsInternalServerError { return &PostIngestsInternalServerError{} } -/*PostIngestsInternalServerError handles this case with default header values. +/* PostIngestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PostIngestsInternalServerError struct { func (o *PostIngestsInternalServerError) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsInternalServerError %+v", 500, o.Payload) } - func (o *PostIngestsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostIngestsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/ingest/put_ingests_parameters.go b/api/devops/devops_client/ingest/put_ingests_parameters.go index bbd3e92..4124583 100644 --- a/api/devops/devops_client/ingest/put_ingests_parameters.go +++ b/api/devops/devops_client/ingest/put_ingests_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPutIngestsParams creates a new PutIngestsParams object -// with the default values initialized. +// NewPutIngestsParams creates a new PutIngestsParams 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 NewPutIngestsParams() *PutIngestsParams { - var () return &PutIngestsParams{ - timeout: cr.DefaultTimeout, } } // NewPutIngestsParamsWithTimeout creates a new PutIngestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutIngestsParamsWithTimeout(timeout time.Duration) *PutIngestsParams { - var () return &PutIngestsParams{ - timeout: timeout, } } // NewPutIngestsParamsWithContext creates a new PutIngestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutIngestsParamsWithContext(ctx context.Context) *PutIngestsParams { - var () return &PutIngestsParams{ - Context: ctx, } } // NewPutIngestsParamsWithHTTPClient creates a new PutIngestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutIngestsParamsWithHTTPClient(client *http.Client) *PutIngestsParams { - var () return &PutIngestsParams{ HTTPClient: client, } } -/*PutIngestsParams contains all the parameters to send to the API endpoint -for the put ingests operation typically these are written to a http.Request +/* PutIngestsParams contains all the parameters to send to the API endpoint + for the put ingests operation. + + Typically these are written to a http.Request. */ type PutIngestsParams struct { - /*IngestRequest - An array of Ingest records + /* IngestRequest. + An array of Ingest records */ IngestRequest *devops_models.IngestRequest @@ -77,6 +76,21 @@ type PutIngestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutIngestsParams) WithDefaults() *PutIngestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutIngestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put ingests params func (o *PutIngestsParams) WithTimeout(timeout time.Duration) *PutIngestsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutIngestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.IngestRequest != nil { if err := r.SetBodyParam(o.IngestRequest); err != nil { return err diff --git a/api/devops/devops_client/ingest/put_ingests_responses.go b/api/devops/devops_client/ingest/put_ingests_responses.go index 95946a1..ca718a1 100644 --- a/api/devops/devops_client/ingest/put_ingests_responses.go +++ b/api/devops/devops_client/ingest/put_ingests_responses.go @@ -63,9 +63,8 @@ func (o *PutIngestsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutIngestsOK() *PutIngestsOK { return &PutIngestsOK{} } -/*PutIngestsOK handles this case with default header values. +/* PutIngestsOK describes a response with status code 200, with default header values. Taxnexus Response with Ingest objects */ type PutIngestsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.IngestResponse } @@ -89,18 +87,25 @@ type PutIngestsOK struct { func (o *PutIngestsOK) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsOK %+v", 200, o.Payload) } - func (o *PutIngestsOK) GetPayload() *devops_models.IngestResponse { return o.Payload } func (o *PutIngestsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.IngestResponse) @@ -117,14 +122,13 @@ func NewPutIngestsUnauthorized() *PutIngestsUnauthorized { return &PutIngestsUnauthorized{} } -/*PutIngestsUnauthorized handles this case with default header values. +/* PutIngestsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PutIngestsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PutIngestsUnauthorized struct { func (o *PutIngestsUnauthorized) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsUnauthorized %+v", 401, o.Payload) } - func (o *PutIngestsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PutIngestsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPutIngestsForbidden() *PutIngestsForbidden { return &PutIngestsForbidden{} } -/*PutIngestsForbidden handles this case with default header values. +/* PutIngestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PutIngestsForbidden struct { func (o *PutIngestsForbidden) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsForbidden %+v", 403, o.Payload) } - func (o *PutIngestsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PutIngestsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPutIngestsNotFound() *PutIngestsNotFound { return &PutIngestsNotFound{} } -/*PutIngestsNotFound handles this case with default header values. +/* PutIngestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PutIngestsNotFound struct { func (o *PutIngestsNotFound) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsNotFound %+v", 404, o.Payload) } - func (o *PutIngestsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PutIngestsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPutIngestsUnprocessableEntity() *PutIngestsUnprocessableEntity { return &PutIngestsUnprocessableEntity{} } -/*PutIngestsUnprocessableEntity handles this case with default header values. +/* PutIngestsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PutIngestsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PutIngestsUnprocessableEntity struct { func (o *PutIngestsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutIngestsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PutIngestsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPutIngestsInternalServerError() *PutIngestsInternalServerError { return &PutIngestsInternalServerError{} } -/*PutIngestsInternalServerError handles this case with default header values. +/* PutIngestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PutIngestsInternalServerError struct { func (o *PutIngestsInternalServerError) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsInternalServerError %+v", 500, o.Payload) } - func (o *PutIngestsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PutIngestsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/job/get_job_parameters.go b/api/devops/devops_client/job/get_job_parameters.go index c03ba95..73d4de7 100644 --- a/api/devops/devops_client/job/get_job_parameters.go +++ b/api/devops/devops_client/job/get_job_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetJobParams creates a new GetJobParams object -// with the default values initialized. +// NewGetJobParams creates a new GetJobParams 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 NewGetJobParams() *GetJobParams { - var () return &GetJobParams{ - timeout: cr.DefaultTimeout, } } // NewGetJobParamsWithTimeout creates a new GetJobParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetJobParamsWithTimeout(timeout time.Duration) *GetJobParams { - var () return &GetJobParams{ - timeout: timeout, } } // NewGetJobParamsWithContext creates a new GetJobParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetJobParamsWithContext(ctx context.Context) *GetJobParams { - var () return &GetJobParams{ - Context: ctx, } } // NewGetJobParamsWithHTTPClient creates a new GetJobParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetJobParamsWithHTTPClient(client *http.Client) *GetJobParams { - var () return &GetJobParams{ HTTPClient: client, } } -/*GetJobParams contains all the parameters to send to the API endpoint -for the get job operation typically these are written to a http.Request +/* GetJobParams contains all the parameters to send to the API endpoint + for the get job operation. + + Typically these are written to a http.Request. */ type GetJobParams struct { - /*JobIDPath - Taxnexus Record Id of a Job + /* JobIDPath. + Taxnexus Record Id of a Job */ JobIDPath string @@ -75,6 +74,21 @@ type GetJobParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get job params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobParams) WithDefaults() *GetJobParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get job params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get job params func (o *GetJobParams) WithTimeout(timeout time.Duration) *GetJobParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/job/get_job_responses.go b/api/devops/devops_client/job/get_job_responses.go index 28682f5..6034de4 100644 --- a/api/devops/devops_client/job/get_job_responses.go +++ b/api/devops/devops_client/job/get_job_responses.go @@ -63,9 +63,8 @@ func (o *GetJobReader) ReadResponse(response runtime.ClientResponse, consumer ru return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetJobOK() *GetJobOK { return &GetJobOK{} } -/*GetJobOK handles this case with default header values. +/* GetJobOK describes a response with status code 200, with default header values. Single Job record response */ type GetJobOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Job } @@ -89,18 +87,25 @@ type GetJobOK struct { func (o *GetJobOK) Error() string { return fmt.Sprintf("[GET /jobs/{jobIdPath}][%d] getJobOK %+v", 200, o.Payload) } - func (o *GetJobOK) GetPayload() *devops_models.Job { return o.Payload } func (o *GetJobOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Job) @@ -117,14 +122,13 @@ func NewGetJobUnauthorized() *GetJobUnauthorized { return &GetJobUnauthorized{} } -/*GetJobUnauthorized handles this case with default header values. +/* GetJobUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetJobUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetJobUnauthorized struct { func (o *GetJobUnauthorized) Error() string { return fmt.Sprintf("[GET /jobs/{jobIdPath}][%d] getJobUnauthorized %+v", 401, o.Payload) } - func (o *GetJobUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetJobForbidden() *GetJobForbidden { return &GetJobForbidden{} } -/*GetJobForbidden handles this case with default header values. +/* GetJobForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetJobForbidden struct { func (o *GetJobForbidden) Error() string { return fmt.Sprintf("[GET /jobs/{jobIdPath}][%d] getJobForbidden %+v", 403, o.Payload) } - func (o *GetJobForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetJobNotFound() *GetJobNotFound { return &GetJobNotFound{} } -/*GetJobNotFound handles this case with default header values. +/* GetJobNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetJobNotFound struct { func (o *GetJobNotFound) Error() string { return fmt.Sprintf("[GET /jobs/{jobIdPath}][%d] getJobNotFound %+v", 404, o.Payload) } - func (o *GetJobNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetJobUnprocessableEntity() *GetJobUnprocessableEntity { return &GetJobUnprocessableEntity{} } -/*GetJobUnprocessableEntity handles this case with default header values. +/* GetJobUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetJobUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetJobUnprocessableEntity struct { func (o *GetJobUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /jobs/{jobIdPath}][%d] getJobUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetJobUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetJobInternalServerError() *GetJobInternalServerError { return &GetJobInternalServerError{} } -/*GetJobInternalServerError handles this case with default header values. +/* GetJobInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetJobInternalServerError struct { func (o *GetJobInternalServerError) Error() string { return fmt.Sprintf("[GET /jobs/{jobIdPath}][%d] getJobInternalServerError %+v", 500, o.Payload) } - func (o *GetJobInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/job/get_jobs_observable_parameters.go b/api/devops/devops_client/job/get_jobs_observable_parameters.go index ee6aee0..062f41e 100644 --- a/api/devops/devops_client/job/get_jobs_observable_parameters.go +++ b/api/devops/devops_client/job/get_jobs_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetJobsObservableParams creates a new GetJobsObservableParams object -// with the default values initialized. +// NewGetJobsObservableParams creates a new GetJobsObservableParams 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 NewGetJobsObservableParams() *GetJobsObservableParams { - return &GetJobsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetJobsObservableParamsWithTimeout creates a new GetJobsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetJobsObservableParamsWithTimeout(timeout time.Duration) *GetJobsObservableParams { - return &GetJobsObservableParams{ - timeout: timeout, } } // NewGetJobsObservableParamsWithContext creates a new GetJobsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetJobsObservableParamsWithContext(ctx context.Context) *GetJobsObservableParams { - return &GetJobsObservableParams{ - Context: ctx, } } // NewGetJobsObservableParamsWithHTTPClient creates a new GetJobsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetJobsObservableParamsWithHTTPClient(client *http.Client) *GetJobsObservableParams { - return &GetJobsObservableParams{ HTTPClient: client, } } -/*GetJobsObservableParams contains all the parameters to send to the API endpoint -for the get jobs observable operation typically these are written to a http.Request +/* GetJobsObservableParams contains all the parameters to send to the API endpoint + for the get jobs observable operation. + + Typically these are written to a http.Request. */ type GetJobsObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetJobsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get jobs observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobsObservableParams) WithDefaults() *GetJobsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get jobs observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get jobs observable params func (o *GetJobsObservableParams) WithTimeout(timeout time.Duration) *GetJobsObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/job/get_jobs_observable_responses.go b/api/devops/devops_client/job/get_jobs_observable_responses.go index e190326..68f736b 100644 --- a/api/devops/devops_client/job/get_jobs_observable_responses.go +++ b/api/devops/devops_client/job/get_jobs_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetJobsObservableReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetJobsObservableOK() *GetJobsObservableOK { return &GetJobsObservableOK{} } -/*GetJobsObservableOK handles this case with default header values. +/* GetJobsObservableOK describes a response with status code 200, with default header values. Single Job record response */ type GetJobsObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.Job } @@ -89,18 +87,25 @@ type GetJobsObservableOK struct { func (o *GetJobsObservableOK) Error() string { return fmt.Sprintf("[GET /jobs/observable][%d] getJobsObservableOK %+v", 200, o.Payload) } - func (o *GetJobsObservableOK) GetPayload() []*devops_models.Job { return o.Payload } func (o *GetJobsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetJobsObservableUnauthorized() *GetJobsObservableUnauthorized { return &GetJobsObservableUnauthorized{} } -/*GetJobsObservableUnauthorized handles this case with default header values. +/* GetJobsObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetJobsObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetJobsObservableUnauthorized struct { func (o *GetJobsObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /jobs/observable][%d] getJobsObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetJobsObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetJobsObservableForbidden() *GetJobsObservableForbidden { return &GetJobsObservableForbidden{} } -/*GetJobsObservableForbidden handles this case with default header values. +/* GetJobsObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetJobsObservableForbidden struct { func (o *GetJobsObservableForbidden) Error() string { return fmt.Sprintf("[GET /jobs/observable][%d] getJobsObservableForbidden %+v", 403, o.Payload) } - func (o *GetJobsObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetJobsObservableNotFound() *GetJobsObservableNotFound { return &GetJobsObservableNotFound{} } -/*GetJobsObservableNotFound handles this case with default header values. +/* GetJobsObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetJobsObservableNotFound struct { func (o *GetJobsObservableNotFound) Error() string { return fmt.Sprintf("[GET /jobs/observable][%d] getJobsObservableNotFound %+v", 404, o.Payload) } - func (o *GetJobsObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetJobsObservableUnprocessableEntity() *GetJobsObservableUnprocessableEn return &GetJobsObservableUnprocessableEntity{} } -/*GetJobsObservableUnprocessableEntity handles this case with default header values. +/* GetJobsObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetJobsObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetJobsObservableUnprocessableEntity struct { func (o *GetJobsObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /jobs/observable][%d] getJobsObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetJobsObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetJobsObservableInternalServerError() *GetJobsObservableInternalServerE return &GetJobsObservableInternalServerError{} } -/*GetJobsObservableInternalServerError handles this case with default header values. +/* GetJobsObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetJobsObservableInternalServerError struct { func (o *GetJobsObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /jobs/observable][%d] getJobsObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetJobsObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/job/get_jobs_parameters.go b/api/devops/devops_client/job/get_jobs_parameters.go index 24a8ffc..b20206b 100644 --- a/api/devops/devops_client/job/get_jobs_parameters.go +++ b/api/devops/devops_client/job/get_jobs_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetJobsParams creates a new GetJobsParams object -// with the default values initialized. +// NewGetJobsParams creates a new GetJobsParams 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 NewGetJobsParams() *GetJobsParams { - var () return &GetJobsParams{ - timeout: cr.DefaultTimeout, } } // NewGetJobsParamsWithTimeout creates a new GetJobsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetJobsParamsWithTimeout(timeout time.Duration) *GetJobsParams { - var () return &GetJobsParams{ - timeout: timeout, } } // NewGetJobsParamsWithContext creates a new GetJobsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetJobsParamsWithContext(ctx context.Context) *GetJobsParams { - var () return &GetJobsParams{ - Context: ctx, } } // NewGetJobsParamsWithHTTPClient creates a new GetJobsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetJobsParamsWithHTTPClient(client *http.Client) *GetJobsParams { - var () return &GetJobsParams{ HTTPClient: client, } } -/*GetJobsParams contains all the parameters to send to the API endpoint -for the get jobs operation typically these are written to a http.Request +/* GetJobsParams contains all the parameters to send to the API endpoint + for the get jobs operation. + + Typically these are written to a http.Request. */ type GetJobsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*Active - Retrieve active records only? + /* Active. + + Retrieve active records only? */ Active *bool - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + + Taxnexus Record Id of a Company */ CompanyID *string - /*JobID - Taxnexus Record Id of a Job + /* JobID. + + Taxnexus Record Id of a Job */ JobID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetJobsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobsParams) WithDefaults() *GetJobsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get jobs params func (o *GetJobsParams) WithTimeout(timeout time.Duration) *GetJobsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.JobID != nil { // query param jobId var qrJobID string + if o.JobID != nil { qrJobID = *o.JobID } qJobID := qrJobID if qJobID != "" { + if err := r.SetQueryParam("jobId", qJobID); 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 { diff --git a/api/devops/devops_client/job/get_jobs_responses.go b/api/devops/devops_client/job/get_jobs_responses.go index 650e460..dfbbae9 100644 --- a/api/devops/devops_client/job/get_jobs_responses.go +++ b/api/devops/devops_client/job/get_jobs_responses.go @@ -63,9 +63,8 @@ func (o *GetJobsReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetJobsOK() *GetJobsOK { return &GetJobsOK{} } -/*GetJobsOK handles this case with default header values. +/* GetJobsOK describes a response with status code 200, with default header values. Taxnexus Response with Job objects */ type GetJobsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.JobResponse } @@ -89,18 +87,25 @@ type GetJobsOK struct { func (o *GetJobsOK) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsOK %+v", 200, o.Payload) } - func (o *GetJobsOK) GetPayload() *devops_models.JobResponse { return o.Payload } func (o *GetJobsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.JobResponse) @@ -117,14 +122,13 @@ func NewGetJobsUnauthorized() *GetJobsUnauthorized { return &GetJobsUnauthorized{} } -/*GetJobsUnauthorized handles this case with default header values. +/* GetJobsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetJobsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetJobsUnauthorized struct { func (o *GetJobsUnauthorized) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsUnauthorized %+v", 401, o.Payload) } - func (o *GetJobsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetJobsForbidden() *GetJobsForbidden { return &GetJobsForbidden{} } -/*GetJobsForbidden handles this case with default header values. +/* GetJobsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetJobsForbidden struct { func (o *GetJobsForbidden) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsForbidden %+v", 403, o.Payload) } - func (o *GetJobsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetJobsNotFound() *GetJobsNotFound { return &GetJobsNotFound{} } -/*GetJobsNotFound handles this case with default header values. +/* GetJobsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetJobsNotFound struct { func (o *GetJobsNotFound) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsNotFound %+v", 404, o.Payload) } - func (o *GetJobsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetJobsUnprocessableEntity() *GetJobsUnprocessableEntity { return &GetJobsUnprocessableEntity{} } -/*GetJobsUnprocessableEntity handles this case with default header values. +/* GetJobsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetJobsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetJobsUnprocessableEntity struct { func (o *GetJobsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetJobsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetJobsInternalServerError() *GetJobsInternalServerError { return &GetJobsInternalServerError{} } -/*GetJobsInternalServerError handles this case with default header values. +/* GetJobsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetJobsInternalServerError struct { func (o *GetJobsInternalServerError) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsInternalServerError %+v", 500, o.Payload) } - func (o *GetJobsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetJobsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/job/job_client.go b/api/devops/devops_client/job/job_client.go index 8e30ebd..8316fbb 100644 --- a/api/devops/devops_client/job/job_client.go +++ b/api/devops/devops_client/job/job_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetJob(params *GetJobParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobOK, error) + GetJob(params *GetJobParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobOK, error) - GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobsOK, error) + GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobsOK, error) - GetJobsObservable(params *GetJobsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobsObservableOK, error) + GetJobsObservable(params *GetJobsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobsObservableOK, error) - PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PostJobsOK, error) + PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostJobsOK, error) - PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PutJobsOK, error) + PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutJobsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Return a single Job object from datastore as a Singleton */ -func (a *Client) GetJob(params *GetJobParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobOK, error) { +func (a *Client) GetJob(params *GetJobParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetJobParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getJob", Method: "GET", PathPattern: "/jobs/{jobIdPath}", @@ -67,7 +69,12 @@ func (a *Client) GetJob(params *GetJobParams, authInfo runtime.ClientAuthInfoWri 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 } @@ -86,13 +93,12 @@ func (a *Client) GetJob(params *GetJobParams, authInfo runtime.ClientAuthInfoWri Return a list of Job records from the datastore */ -func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobsOK, error) { +func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetJobsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getJobs", Method: "GET", PathPattern: "/jobs", @@ -104,7 +110,12 @@ func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoW 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 } @@ -123,13 +134,12 @@ func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoW Returns a Job retrieval in a observable array */ -func (a *Client) GetJobsObservable(params *GetJobsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobsObservableOK, error) { +func (a *Client) GetJobsObservable(params *GetJobsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetJobsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getJobsObservable", Method: "GET", PathPattern: "/jobs/observable", @@ -141,7 +151,12 @@ func (a *Client) GetJobsObservable(params *GetJobsObservableParams, authInfo run 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 } @@ -160,13 +175,12 @@ func (a *Client) GetJobsObservable(params *GetJobsObservableParams, authInfo run Create and enqueue Jobs in Taxnexus */ -func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PostJobsOK, error) { +func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostJobsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostJobsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postJobs", Method: "POST", PathPattern: "/jobs", @@ -178,7 +192,12 @@ func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInf 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 } @@ -197,13 +216,12 @@ func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInf Update Jobs in Taxnexus */ -func (a *Client) PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PutJobsOK, error) { +func (a *Client) PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutJobsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutJobsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putJobs", Method: "PUT", PathPattern: "/jobs", @@ -215,7 +233,12 @@ func (a *Client) PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoW 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 } diff --git a/api/devops/devops_client/job/post_jobs_parameters.go b/api/devops/devops_client/job/post_jobs_parameters.go index d4d795e..0cb8035 100644 --- a/api/devops/devops_client/job/post_jobs_parameters.go +++ b/api/devops/devops_client/job/post_jobs_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostJobsParams creates a new PostJobsParams object -// with the default values initialized. +// NewPostJobsParams creates a new PostJobsParams 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 NewPostJobsParams() *PostJobsParams { - var () return &PostJobsParams{ - timeout: cr.DefaultTimeout, } } // NewPostJobsParamsWithTimeout creates a new PostJobsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostJobsParamsWithTimeout(timeout time.Duration) *PostJobsParams { - var () return &PostJobsParams{ - timeout: timeout, } } // NewPostJobsParamsWithContext creates a new PostJobsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostJobsParamsWithContext(ctx context.Context) *PostJobsParams { - var () return &PostJobsParams{ - Context: ctx, } } // NewPostJobsParamsWithHTTPClient creates a new PostJobsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostJobsParamsWithHTTPClient(client *http.Client) *PostJobsParams { - var () return &PostJobsParams{ HTTPClient: client, } } -/*PostJobsParams contains all the parameters to send to the API endpoint -for the post jobs operation typically these are written to a http.Request +/* PostJobsParams contains all the parameters to send to the API endpoint + for the post jobs operation. + + Typically these are written to a http.Request. */ type PostJobsParams struct { - /*JobRequest - An array of Job records + /* JobRequest. + An array of Job records */ JobRequest *devops_models.JobRequest @@ -77,6 +76,21 @@ type PostJobsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostJobsParams) WithDefaults() *PostJobsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostJobsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post jobs params func (o *PostJobsParams) WithTimeout(timeout time.Duration) *PostJobsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.JobRequest != nil { if err := r.SetBodyParam(o.JobRequest); err != nil { return err diff --git a/api/devops/devops_client/job/post_jobs_responses.go b/api/devops/devops_client/job/post_jobs_responses.go index 055629e..350c8c6 100644 --- a/api/devops/devops_client/job/post_jobs_responses.go +++ b/api/devops/devops_client/job/post_jobs_responses.go @@ -63,9 +63,8 @@ func (o *PostJobsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostJobsOK() *PostJobsOK { return &PostJobsOK{} } -/*PostJobsOK handles this case with default header values. +/* PostJobsOK describes a response with status code 200, with default header values. Taxnexus Response with Job objects */ type PostJobsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.JobResponse } @@ -89,18 +87,25 @@ type PostJobsOK struct { func (o *PostJobsOK) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsOK %+v", 200, o.Payload) } - func (o *PostJobsOK) GetPayload() *devops_models.JobResponse { return o.Payload } func (o *PostJobsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.JobResponse) @@ -117,14 +122,13 @@ func NewPostJobsUnauthorized() *PostJobsUnauthorized { return &PostJobsUnauthorized{} } -/*PostJobsUnauthorized handles this case with default header values. +/* PostJobsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostJobsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PostJobsUnauthorized struct { func (o *PostJobsUnauthorized) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsUnauthorized %+v", 401, o.Payload) } - func (o *PostJobsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostJobsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPostJobsForbidden() *PostJobsForbidden { return &PostJobsForbidden{} } -/*PostJobsForbidden handles this case with default header values. +/* PostJobsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PostJobsForbidden struct { func (o *PostJobsForbidden) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsForbidden %+v", 403, o.Payload) } - func (o *PostJobsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostJobsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPostJobsNotFound() *PostJobsNotFound { return &PostJobsNotFound{} } -/*PostJobsNotFound handles this case with default header values. +/* PostJobsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PostJobsNotFound struct { func (o *PostJobsNotFound) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsNotFound %+v", 404, o.Payload) } - func (o *PostJobsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostJobsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPostJobsUnprocessableEntity() *PostJobsUnprocessableEntity { return &PostJobsUnprocessableEntity{} } -/*PostJobsUnprocessableEntity handles this case with default header values. +/* PostJobsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostJobsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PostJobsUnprocessableEntity struct { func (o *PostJobsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostJobsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostJobsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPostJobsInternalServerError() *PostJobsInternalServerError { return &PostJobsInternalServerError{} } -/*PostJobsInternalServerError handles this case with default header values. +/* PostJobsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PostJobsInternalServerError struct { func (o *PostJobsInternalServerError) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsInternalServerError %+v", 500, o.Payload) } - func (o *PostJobsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostJobsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/job/put_jobs_parameters.go b/api/devops/devops_client/job/put_jobs_parameters.go index 964f05f..7f34ba2 100644 --- a/api/devops/devops_client/job/put_jobs_parameters.go +++ b/api/devops/devops_client/job/put_jobs_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPutJobsParams creates a new PutJobsParams object -// with the default values initialized. +// NewPutJobsParams creates a new PutJobsParams 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 NewPutJobsParams() *PutJobsParams { - var () return &PutJobsParams{ - timeout: cr.DefaultTimeout, } } // NewPutJobsParamsWithTimeout creates a new PutJobsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutJobsParamsWithTimeout(timeout time.Duration) *PutJobsParams { - var () return &PutJobsParams{ - timeout: timeout, } } // NewPutJobsParamsWithContext creates a new PutJobsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutJobsParamsWithContext(ctx context.Context) *PutJobsParams { - var () return &PutJobsParams{ - Context: ctx, } } // NewPutJobsParamsWithHTTPClient creates a new PutJobsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutJobsParamsWithHTTPClient(client *http.Client) *PutJobsParams { - var () return &PutJobsParams{ HTTPClient: client, } } -/*PutJobsParams contains all the parameters to send to the API endpoint -for the put jobs operation typically these are written to a http.Request +/* PutJobsParams contains all the parameters to send to the API endpoint + for the put jobs operation. + + Typically these are written to a http.Request. */ type PutJobsParams struct { - /*JobRequest - An array of Job records + /* JobRequest. + An array of Job records */ JobRequest *devops_models.JobRequest @@ -77,6 +76,21 @@ type PutJobsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutJobsParams) WithDefaults() *PutJobsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutJobsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put jobs params func (o *PutJobsParams) WithTimeout(timeout time.Duration) *PutJobsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis return err } var res []error - if o.JobRequest != nil { if err := r.SetBodyParam(o.JobRequest); err != nil { return err diff --git a/api/devops/devops_client/job/put_jobs_responses.go b/api/devops/devops_client/job/put_jobs_responses.go index 7493d81..d0104f4 100644 --- a/api/devops/devops_client/job/put_jobs_responses.go +++ b/api/devops/devops_client/job/put_jobs_responses.go @@ -63,9 +63,8 @@ func (o *PutJobsReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutJobsOK() *PutJobsOK { return &PutJobsOK{} } -/*PutJobsOK handles this case with default header values. +/* PutJobsOK describes a response with status code 200, with default header values. Taxnexus Response with Job objects */ type PutJobsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.JobResponse } @@ -89,18 +87,25 @@ type PutJobsOK struct { func (o *PutJobsOK) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsOK %+v", 200, o.Payload) } - func (o *PutJobsOK) GetPayload() *devops_models.JobResponse { return o.Payload } func (o *PutJobsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.JobResponse) @@ -117,14 +122,13 @@ func NewPutJobsUnauthorized() *PutJobsUnauthorized { return &PutJobsUnauthorized{} } -/*PutJobsUnauthorized handles this case with default header values. +/* PutJobsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PutJobsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PutJobsUnauthorized struct { func (o *PutJobsUnauthorized) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsUnauthorized %+v", 401, o.Payload) } - func (o *PutJobsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PutJobsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPutJobsForbidden() *PutJobsForbidden { return &PutJobsForbidden{} } -/*PutJobsForbidden handles this case with default header values. +/* PutJobsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PutJobsForbidden struct { func (o *PutJobsForbidden) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsForbidden %+v", 403, o.Payload) } - func (o *PutJobsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PutJobsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPutJobsNotFound() *PutJobsNotFound { return &PutJobsNotFound{} } -/*PutJobsNotFound handles this case with default header values. +/* PutJobsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PutJobsNotFound struct { func (o *PutJobsNotFound) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsNotFound %+v", 404, o.Payload) } - func (o *PutJobsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PutJobsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPutJobsUnprocessableEntity() *PutJobsUnprocessableEntity { return &PutJobsUnprocessableEntity{} } -/*PutJobsUnprocessableEntity handles this case with default header values. +/* PutJobsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PutJobsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PutJobsUnprocessableEntity struct { func (o *PutJobsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutJobsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PutJobsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPutJobsInternalServerError() *PutJobsInternalServerError { return &PutJobsInternalServerError{} } -/*PutJobsInternalServerError handles this case with default header values. +/* PutJobsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PutJobsInternalServerError struct { func (o *PutJobsInternalServerError) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsInternalServerError %+v", 500, o.Payload) } - func (o *PutJobsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PutJobsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/service/get_service_parameters.go b/api/devops/devops_client/service/get_service_parameters.go index 5d88daa..e3b9006 100644 --- a/api/devops/devops_client/service/get_service_parameters.go +++ b/api/devops/devops_client/service/get_service_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetServiceParams creates a new GetServiceParams object -// with the default values initialized. +// NewGetServiceParams creates a new GetServiceParams 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 NewGetServiceParams() *GetServiceParams { - var () return &GetServiceParams{ - timeout: cr.DefaultTimeout, } } // NewGetServiceParamsWithTimeout creates a new GetServiceParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetServiceParamsWithTimeout(timeout time.Duration) *GetServiceParams { - var () return &GetServiceParams{ - timeout: timeout, } } // NewGetServiceParamsWithContext creates a new GetServiceParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetServiceParamsWithContext(ctx context.Context) *GetServiceParams { - var () return &GetServiceParams{ - Context: ctx, } } // NewGetServiceParamsWithHTTPClient creates a new GetServiceParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetServiceParamsWithHTTPClient(client *http.Client) *GetServiceParams { - var () return &GetServiceParams{ HTTPClient: client, } } -/*GetServiceParams contains all the parameters to send to the API endpoint -for the get service operation typically these are written to a http.Request +/* GetServiceParams contains all the parameters to send to the API endpoint + for the get service operation. + + Typically these are written to a http.Request. */ type GetServiceParams struct { - /*ServiceIDPath - Taxnexus Record Id of a Service + /* ServiceIDPath. + Taxnexus Record Id of a Service */ ServiceIDPath string @@ -75,6 +74,21 @@ type GetServiceParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get service params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServiceParams) WithDefaults() *GetServiceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get service params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServiceParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get service params func (o *GetServiceParams) WithTimeout(timeout time.Duration) *GetServiceParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/service/get_service_responses.go b/api/devops/devops_client/service/get_service_responses.go index 5f229f5..c81b50a 100644 --- a/api/devops/devops_client/service/get_service_responses.go +++ b/api/devops/devops_client/service/get_service_responses.go @@ -63,9 +63,8 @@ func (o *GetServiceReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetServiceOK() *GetServiceOK { return &GetServiceOK{} } -/*GetServiceOK handles this case with default header values. +/* GetServiceOK describes a response with status code 200, with default header values. Single Service record response */ type GetServiceOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Service } @@ -89,18 +87,25 @@ type GetServiceOK struct { func (o *GetServiceOK) Error() string { return fmt.Sprintf("[GET /services/{serviceIdPath}][%d] getServiceOK %+v", 200, o.Payload) } - func (o *GetServiceOK) GetPayload() *devops_models.Service { return o.Payload } func (o *GetServiceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Service) @@ -117,14 +122,13 @@ func NewGetServiceUnauthorized() *GetServiceUnauthorized { return &GetServiceUnauthorized{} } -/*GetServiceUnauthorized handles this case with default header values. +/* GetServiceUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetServiceUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetServiceUnauthorized struct { func (o *GetServiceUnauthorized) Error() string { return fmt.Sprintf("[GET /services/{serviceIdPath}][%d] getServiceUnauthorized %+v", 401, o.Payload) } - func (o *GetServiceUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServiceUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetServiceForbidden() *GetServiceForbidden { return &GetServiceForbidden{} } -/*GetServiceForbidden handles this case with default header values. +/* GetServiceForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetServiceForbidden struct { func (o *GetServiceForbidden) Error() string { return fmt.Sprintf("[GET /services/{serviceIdPath}][%d] getServiceForbidden %+v", 403, o.Payload) } - func (o *GetServiceForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServiceForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetServiceNotFound() *GetServiceNotFound { return &GetServiceNotFound{} } -/*GetServiceNotFound handles this case with default header values. +/* GetServiceNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetServiceNotFound struct { func (o *GetServiceNotFound) Error() string { return fmt.Sprintf("[GET /services/{serviceIdPath}][%d] getServiceNotFound %+v", 404, o.Payload) } - func (o *GetServiceNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServiceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetServiceUnprocessableEntity() *GetServiceUnprocessableEntity { return &GetServiceUnprocessableEntity{} } -/*GetServiceUnprocessableEntity handles this case with default header values. +/* GetServiceUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetServiceUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetServiceUnprocessableEntity struct { func (o *GetServiceUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /services/{serviceIdPath}][%d] getServiceUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetServiceUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServiceUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetServiceInternalServerError() *GetServiceInternalServerError { return &GetServiceInternalServerError{} } -/*GetServiceInternalServerError handles this case with default header values. +/* GetServiceInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetServiceInternalServerError struct { func (o *GetServiceInternalServerError) Error() string { return fmt.Sprintf("[GET /services/{serviceIdPath}][%d] getServiceInternalServerError %+v", 500, o.Payload) } - func (o *GetServiceInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServiceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/service/get_services_observable_parameters.go b/api/devops/devops_client/service/get_services_observable_parameters.go index f5280de..41ca0cb 100644 --- a/api/devops/devops_client/service/get_services_observable_parameters.go +++ b/api/devops/devops_client/service/get_services_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetServicesObservableParams creates a new GetServicesObservableParams object -// with the default values initialized. +// NewGetServicesObservableParams creates a new GetServicesObservableParams 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 NewGetServicesObservableParams() *GetServicesObservableParams { - return &GetServicesObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetServicesObservableParamsWithTimeout creates a new GetServicesObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetServicesObservableParamsWithTimeout(timeout time.Duration) *GetServicesObservableParams { - return &GetServicesObservableParams{ - timeout: timeout, } } // NewGetServicesObservableParamsWithContext creates a new GetServicesObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetServicesObservableParamsWithContext(ctx context.Context) *GetServicesObservableParams { - return &GetServicesObservableParams{ - Context: ctx, } } // NewGetServicesObservableParamsWithHTTPClient creates a new GetServicesObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetServicesObservableParamsWithHTTPClient(client *http.Client) *GetServicesObservableParams { - return &GetServicesObservableParams{ HTTPClient: client, } } -/*GetServicesObservableParams contains all the parameters to send to the API endpoint -for the get services observable operation typically these are written to a http.Request +/* GetServicesObservableParams contains all the parameters to send to the API endpoint + for the get services observable operation. + + Typically these are written to a http.Request. */ type GetServicesObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetServicesObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get services observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServicesObservableParams) WithDefaults() *GetServicesObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get services observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServicesObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get services observable params func (o *GetServicesObservableParams) WithTimeout(timeout time.Duration) *GetServicesObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/service/get_services_observable_responses.go b/api/devops/devops_client/service/get_services_observable_responses.go index 4ae31bc..031a6d7 100644 --- a/api/devops/devops_client/service/get_services_observable_responses.go +++ b/api/devops/devops_client/service/get_services_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetServicesObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetServicesObservableOK() *GetServicesObservableOK { return &GetServicesObservableOK{} } -/*GetServicesObservableOK handles this case with default header values. +/* GetServicesObservableOK describes a response with status code 200, with default header values. Simple Service record response */ type GetServicesObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.Service } @@ -89,18 +87,25 @@ type GetServicesObservableOK struct { func (o *GetServicesObservableOK) Error() string { return fmt.Sprintf("[GET /services/observable][%d] getServicesObservableOK %+v", 200, o.Payload) } - func (o *GetServicesObservableOK) GetPayload() []*devops_models.Service { return o.Payload } func (o *GetServicesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetServicesObservableUnauthorized() *GetServicesObservableUnauthorized { return &GetServicesObservableUnauthorized{} } -/*GetServicesObservableUnauthorized handles this case with default header values. +/* GetServicesObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetServicesObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetServicesObservableUnauthorized struct { func (o *GetServicesObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /services/observable][%d] getServicesObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetServicesObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetServicesObservableForbidden() *GetServicesObservableForbidden { return &GetServicesObservableForbidden{} } -/*GetServicesObservableForbidden handles this case with default header values. +/* GetServicesObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetServicesObservableForbidden struct { func (o *GetServicesObservableForbidden) Error() string { return fmt.Sprintf("[GET /services/observable][%d] getServicesObservableForbidden %+v", 403, o.Payload) } - func (o *GetServicesObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetServicesObservableNotFound() *GetServicesObservableNotFound { return &GetServicesObservableNotFound{} } -/*GetServicesObservableNotFound handles this case with default header values. +/* GetServicesObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetServicesObservableNotFound struct { func (o *GetServicesObservableNotFound) Error() string { return fmt.Sprintf("[GET /services/observable][%d] getServicesObservableNotFound %+v", 404, o.Payload) } - func (o *GetServicesObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetServicesObservableUnprocessableEntity() *GetServicesObservableUnproce return &GetServicesObservableUnprocessableEntity{} } -/*GetServicesObservableUnprocessableEntity handles this case with default header values. +/* GetServicesObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetServicesObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetServicesObservableUnprocessableEntity struct { func (o *GetServicesObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /services/observable][%d] getServicesObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetServicesObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetServicesObservableInternalServerError() *GetServicesObservableInterna return &GetServicesObservableInternalServerError{} } -/*GetServicesObservableInternalServerError handles this case with default header values. +/* GetServicesObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetServicesObservableInternalServerError struct { func (o *GetServicesObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /services/observable][%d] getServicesObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetServicesObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/service/get_services_parameters.go b/api/devops/devops_client/service/get_services_parameters.go index 06f1a84..590e69d 100644 --- a/api/devops/devops_client/service/get_services_parameters.go +++ b/api/devops/devops_client/service/get_services_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetServicesParams creates a new GetServicesParams object -// with the default values initialized. +// NewGetServicesParams creates a new GetServicesParams 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 NewGetServicesParams() *GetServicesParams { - var () return &GetServicesParams{ - timeout: cr.DefaultTimeout, } } // NewGetServicesParamsWithTimeout creates a new GetServicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetServicesParamsWithTimeout(timeout time.Duration) *GetServicesParams { - var () return &GetServicesParams{ - timeout: timeout, } } // NewGetServicesParamsWithContext creates a new GetServicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetServicesParamsWithContext(ctx context.Context) *GetServicesParams { - var () return &GetServicesParams{ - Context: ctx, } } // NewGetServicesParamsWithHTTPClient creates a new GetServicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetServicesParamsWithHTTPClient(client *http.Client) *GetServicesParams { - var () return &GetServicesParams{ HTTPClient: client, } } -/*GetServicesParams contains all the parameters to send to the API endpoint -for the get services operation typically these are written to a http.Request +/* GetServicesParams contains all the parameters to send to the API endpoint + for the get services operation. + + Typically these are written to a http.Request. */ type GetServicesParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*ServiceID - Service ID + /* ServiceID. + + Service ID */ ServiceID *string @@ -86,6 +91,21 @@ type GetServicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServicesParams) WithDefaults() *GetServicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get services params func (o *GetServicesParams) WithTimeout(timeout time.Duration) *GetServicesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // 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 o.ServiceID != nil { // query param serviceId var qrServiceID string + if o.ServiceID != nil { qrServiceID = *o.ServiceID } qServiceID := qrServiceID if qServiceID != "" { + if err := r.SetQueryParam("serviceId", qServiceID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/devops/devops_client/service/get_services_responses.go b/api/devops/devops_client/service/get_services_responses.go index 0c67e30..48c2159 100644 --- a/api/devops/devops_client/service/get_services_responses.go +++ b/api/devops/devops_client/service/get_services_responses.go @@ -63,9 +63,8 @@ func (o *GetServicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetServicesOK() *GetServicesOK { return &GetServicesOK{} } -/*GetServicesOK handles this case with default header values. +/* GetServicesOK describes a response with status code 200, with default header values. Taxnexus Response with Service objects */ type GetServicesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.ServiceResponse } @@ -89,18 +87,25 @@ type GetServicesOK struct { func (o *GetServicesOK) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesOK %+v", 200, o.Payload) } - func (o *GetServicesOK) GetPayload() *devops_models.ServiceResponse { return o.Payload } func (o *GetServicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.ServiceResponse) @@ -117,14 +122,13 @@ func NewGetServicesUnauthorized() *GetServicesUnauthorized { return &GetServicesUnauthorized{} } -/*GetServicesUnauthorized handles this case with default header values. +/* GetServicesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetServicesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetServicesUnauthorized struct { func (o *GetServicesUnauthorized) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesUnauthorized %+v", 401, o.Payload) } - func (o *GetServicesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetServicesForbidden() *GetServicesForbidden { return &GetServicesForbidden{} } -/*GetServicesForbidden handles this case with default header values. +/* GetServicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetServicesForbidden struct { func (o *GetServicesForbidden) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesForbidden %+v", 403, o.Payload) } - func (o *GetServicesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetServicesNotFound() *GetServicesNotFound { return &GetServicesNotFound{} } -/*GetServicesNotFound handles this case with default header values. +/* GetServicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetServicesNotFound struct { func (o *GetServicesNotFound) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesNotFound %+v", 404, o.Payload) } - func (o *GetServicesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetServicesUnprocessableEntity() *GetServicesUnprocessableEntity { return &GetServicesUnprocessableEntity{} } -/*GetServicesUnprocessableEntity handles this case with default header values. +/* GetServicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetServicesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetServicesUnprocessableEntity struct { func (o *GetServicesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetServicesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetServicesInternalServerError() *GetServicesInternalServerError { return &GetServicesInternalServerError{} } -/*GetServicesInternalServerError handles this case with default header values. +/* GetServicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetServicesInternalServerError struct { func (o *GetServicesInternalServerError) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesInternalServerError %+v", 500, o.Payload) } - func (o *GetServicesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetServicesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/service/post_services_parameters.go b/api/devops/devops_client/service/post_services_parameters.go index 2bb6a36..eee4723 100644 --- a/api/devops/devops_client/service/post_services_parameters.go +++ b/api/devops/devops_client/service/post_services_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostServicesParams creates a new PostServicesParams object -// with the default values initialized. +// NewPostServicesParams creates a new PostServicesParams 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 NewPostServicesParams() *PostServicesParams { - var () return &PostServicesParams{ - timeout: cr.DefaultTimeout, } } // NewPostServicesParamsWithTimeout creates a new PostServicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostServicesParamsWithTimeout(timeout time.Duration) *PostServicesParams { - var () return &PostServicesParams{ - timeout: timeout, } } // NewPostServicesParamsWithContext creates a new PostServicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostServicesParamsWithContext(ctx context.Context) *PostServicesParams { - var () return &PostServicesParams{ - Context: ctx, } } // NewPostServicesParamsWithHTTPClient creates a new PostServicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostServicesParamsWithHTTPClient(client *http.Client) *PostServicesParams { - var () return &PostServicesParams{ HTTPClient: client, } } -/*PostServicesParams contains all the parameters to send to the API endpoint -for the post services operation typically these are written to a http.Request +/* PostServicesParams contains all the parameters to send to the API endpoint + for the post services operation. + + Typically these are written to a http.Request. */ type PostServicesParams struct { - /*ServiceRequest - An array of Service records + /* ServiceRequest. + An array of Service records */ ServiceRequest *devops_models.ServiceRequest @@ -77,6 +76,21 @@ type PostServicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostServicesParams) WithDefaults() *PostServicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostServicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post services params func (o *PostServicesParams) WithTimeout(timeout time.Duration) *PostServicesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.ServiceRequest != nil { if err := r.SetBodyParam(o.ServiceRequest); err != nil { return err diff --git a/api/devops/devops_client/service/post_services_responses.go b/api/devops/devops_client/service/post_services_responses.go index 183e09f..1002401 100644 --- a/api/devops/devops_client/service/post_services_responses.go +++ b/api/devops/devops_client/service/post_services_responses.go @@ -63,9 +63,8 @@ func (o *PostServicesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostServicesOK() *PostServicesOK { return &PostServicesOK{} } -/*PostServicesOK handles this case with default header values. +/* PostServicesOK describes a response with status code 200, with default header values. Taxnexus Response with Service objects */ type PostServicesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.ServiceResponse } @@ -89,18 +87,25 @@ type PostServicesOK struct { func (o *PostServicesOK) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesOK %+v", 200, o.Payload) } - func (o *PostServicesOK) GetPayload() *devops_models.ServiceResponse { return o.Payload } func (o *PostServicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.ServiceResponse) @@ -117,14 +122,13 @@ func NewPostServicesUnauthorized() *PostServicesUnauthorized { return &PostServicesUnauthorized{} } -/*PostServicesUnauthorized handles this case with default header values. +/* PostServicesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostServicesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PostServicesUnauthorized struct { func (o *PostServicesUnauthorized) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesUnauthorized %+v", 401, o.Payload) } - func (o *PostServicesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostServicesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPostServicesForbidden() *PostServicesForbidden { return &PostServicesForbidden{} } -/*PostServicesForbidden handles this case with default header values. +/* PostServicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PostServicesForbidden struct { func (o *PostServicesForbidden) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesForbidden %+v", 403, o.Payload) } - func (o *PostServicesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostServicesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPostServicesNotFound() *PostServicesNotFound { return &PostServicesNotFound{} } -/*PostServicesNotFound handles this case with default header values. +/* PostServicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PostServicesNotFound struct { func (o *PostServicesNotFound) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesNotFound %+v", 404, o.Payload) } - func (o *PostServicesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostServicesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPostServicesUnprocessableEntity() *PostServicesUnprocessableEntity { return &PostServicesUnprocessableEntity{} } -/*PostServicesUnprocessableEntity handles this case with default header values. +/* PostServicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostServicesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PostServicesUnprocessableEntity struct { func (o *PostServicesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostServicesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostServicesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPostServicesInternalServerError() *PostServicesInternalServerError { return &PostServicesInternalServerError{} } -/*PostServicesInternalServerError handles this case with default header values. +/* PostServicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PostServicesInternalServerError struct { func (o *PostServicesInternalServerError) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesInternalServerError %+v", 500, o.Payload) } - func (o *PostServicesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostServicesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/service/put_services_parameters.go b/api/devops/devops_client/service/put_services_parameters.go index d4efe4a..1f66f51 100644 --- a/api/devops/devops_client/service/put_services_parameters.go +++ b/api/devops/devops_client/service/put_services_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPutServicesParams creates a new PutServicesParams object -// with the default values initialized. +// NewPutServicesParams creates a new PutServicesParams 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 NewPutServicesParams() *PutServicesParams { - var () return &PutServicesParams{ - timeout: cr.DefaultTimeout, } } // NewPutServicesParamsWithTimeout creates a new PutServicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutServicesParamsWithTimeout(timeout time.Duration) *PutServicesParams { - var () return &PutServicesParams{ - timeout: timeout, } } // NewPutServicesParamsWithContext creates a new PutServicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutServicesParamsWithContext(ctx context.Context) *PutServicesParams { - var () return &PutServicesParams{ - Context: ctx, } } // NewPutServicesParamsWithHTTPClient creates a new PutServicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutServicesParamsWithHTTPClient(client *http.Client) *PutServicesParams { - var () return &PutServicesParams{ HTTPClient: client, } } -/*PutServicesParams contains all the parameters to send to the API endpoint -for the put services operation typically these are written to a http.Request +/* PutServicesParams contains all the parameters to send to the API endpoint + for the put services operation. + + Typically these are written to a http.Request. */ type PutServicesParams struct { - /*ServiceRequest - An array of Service records + /* ServiceRequest. + An array of Service records */ ServiceRequest *devops_models.ServiceRequest @@ -77,6 +76,21 @@ type PutServicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutServicesParams) WithDefaults() *PutServicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutServicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put services params func (o *PutServicesParams) WithTimeout(timeout time.Duration) *PutServicesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ServiceRequest != nil { if err := r.SetBodyParam(o.ServiceRequest); err != nil { return err diff --git a/api/devops/devops_client/service/put_services_responses.go b/api/devops/devops_client/service/put_services_responses.go index 0af21ab..1e29d3a 100644 --- a/api/devops/devops_client/service/put_services_responses.go +++ b/api/devops/devops_client/service/put_services_responses.go @@ -63,9 +63,8 @@ func (o *PutServicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutServicesOK() *PutServicesOK { return &PutServicesOK{} } -/*PutServicesOK handles this case with default header values. +/* PutServicesOK describes a response with status code 200, with default header values. Taxnexus Response with Service objects */ type PutServicesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.ServiceResponse } @@ -89,18 +87,25 @@ type PutServicesOK struct { func (o *PutServicesOK) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesOK %+v", 200, o.Payload) } - func (o *PutServicesOK) GetPayload() *devops_models.ServiceResponse { return o.Payload } func (o *PutServicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.ServiceResponse) @@ -117,14 +122,13 @@ func NewPutServicesUnauthorized() *PutServicesUnauthorized { return &PutServicesUnauthorized{} } -/*PutServicesUnauthorized handles this case with default header values. +/* PutServicesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PutServicesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PutServicesUnauthorized struct { func (o *PutServicesUnauthorized) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesUnauthorized %+v", 401, o.Payload) } - func (o *PutServicesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PutServicesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPutServicesForbidden() *PutServicesForbidden { return &PutServicesForbidden{} } -/*PutServicesForbidden handles this case with default header values. +/* PutServicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PutServicesForbidden struct { func (o *PutServicesForbidden) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesForbidden %+v", 403, o.Payload) } - func (o *PutServicesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PutServicesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPutServicesNotFound() *PutServicesNotFound { return &PutServicesNotFound{} } -/*PutServicesNotFound handles this case with default header values. +/* PutServicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PutServicesNotFound struct { func (o *PutServicesNotFound) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesNotFound %+v", 404, o.Payload) } - func (o *PutServicesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PutServicesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPutServicesUnprocessableEntity() *PutServicesUnprocessableEntity { return &PutServicesUnprocessableEntity{} } -/*PutServicesUnprocessableEntity handles this case with default header values. +/* PutServicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PutServicesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PutServicesUnprocessableEntity struct { func (o *PutServicesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutServicesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PutServicesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPutServicesInternalServerError() *PutServicesInternalServerError { return &PutServicesInternalServerError{} } -/*PutServicesInternalServerError handles this case with default header values. +/* PutServicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PutServicesInternalServerError struct { func (o *PutServicesInternalServerError) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesInternalServerError %+v", 500, o.Payload) } - func (o *PutServicesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PutServicesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/service/service_client.go b/api/devops/devops_client/service/service_client.go index ee7185e..0a2d361 100644 --- a/api/devops/devops_client/service/service_client.go +++ b/api/devops/devops_client/service/service_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter) (*GetServiceOK, error) + GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceOK, error) - GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetServicesOK, error) + GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServicesOK, error) - GetServicesObservable(params *GetServicesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetServicesObservableOK, error) + GetServicesObservable(params *GetServicesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServicesObservableOK, error) - PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostServicesOK, error) + PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostServicesOK, error) - PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutServicesOK, error) + PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutServicesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Return a single Service object from datastore as a Singleton */ -func (a *Client) GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter) (*GetServiceOK, error) { +func (a *Client) GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetServiceParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getService", Method: "GET", PathPattern: "/services/{serviceIdPath}", @@ -67,7 +69,12 @@ func (a *Client) GetService(params *GetServiceParams, authInfo runtime.ClientAut 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 } @@ -86,13 +93,12 @@ func (a *Client) GetService(params *GetServiceParams, authInfo runtime.ClientAut Return a list of Services records from the datastore */ -func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetServicesOK, error) { +func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetServicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getServices", Method: "GET", PathPattern: "/services", @@ -104,7 +110,12 @@ func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientA 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 } @@ -123,13 +134,12 @@ func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientA Returns a Service retrieval in a observable array */ -func (a *Client) GetServicesObservable(params *GetServicesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetServicesObservableOK, error) { +func (a *Client) GetServicesObservable(params *GetServicesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServicesObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetServicesObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getServicesObservable", Method: "GET", PathPattern: "/services/observable", @@ -141,7 +151,12 @@ func (a *Client) GetServicesObservable(params *GetServicesObservableParams, auth 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 } @@ -160,13 +175,12 @@ func (a *Client) GetServicesObservable(params *GetServicesObservableParams, auth Create Services in Taxnexus */ -func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostServicesOK, error) { +func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostServicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostServicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postServices", Method: "POST", PathPattern: "/services", @@ -178,7 +192,12 @@ func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.Clien 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 } @@ -197,13 +216,12 @@ func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.Clien Update Services in Taxnexus */ -func (a *Client) PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutServicesOK, error) { +func (a *Client) PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutServicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutServicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putServices", Method: "PUT", PathPattern: "/services", @@ -215,7 +233,12 @@ func (a *Client) PutServices(params *PutServicesParams, authInfo runtime.ClientA 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 } diff --git a/api/devops/devops_client/template/get_template_parameters.go b/api/devops/devops_client/template/get_template_parameters.go index 4a49cec..2cfc34a 100644 --- a/api/devops/devops_client/template/get_template_parameters.go +++ b/api/devops/devops_client/template/get_template_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTemplateParams creates a new GetTemplateParams object -// with the default values initialized. +// NewGetTemplateParams creates a new GetTemplateParams 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 NewGetTemplateParams() *GetTemplateParams { - var () return &GetTemplateParams{ - timeout: cr.DefaultTimeout, } } // NewGetTemplateParamsWithTimeout creates a new GetTemplateParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTemplateParamsWithTimeout(timeout time.Duration) *GetTemplateParams { - var () return &GetTemplateParams{ - timeout: timeout, } } // NewGetTemplateParamsWithContext creates a new GetTemplateParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTemplateParamsWithContext(ctx context.Context) *GetTemplateParams { - var () return &GetTemplateParams{ - Context: ctx, } } // NewGetTemplateParamsWithHTTPClient creates a new GetTemplateParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTemplateParamsWithHTTPClient(client *http.Client) *GetTemplateParams { - var () return &GetTemplateParams{ HTTPClient: client, } } -/*GetTemplateParams contains all the parameters to send to the API endpoint -for the get template operation typically these are written to a http.Request +/* GetTemplateParams contains all the parameters to send to the API endpoint + for the get template operation. + + Typically these are written to a http.Request. */ type GetTemplateParams struct { - /*TemplateIDPath - Taxnexus Record Id of a Template + /* TemplateIDPath. + Taxnexus Record Id of a Template */ TemplateIDPath string @@ -75,6 +74,21 @@ type GetTemplateParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get template params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplateParams) WithDefaults() *GetTemplateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get template params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplateParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get template params func (o *GetTemplateParams) WithTimeout(timeout time.Duration) *GetTemplateParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/template/get_template_responses.go b/api/devops/devops_client/template/get_template_responses.go index c7891b6..f65a938 100644 --- a/api/devops/devops_client/template/get_template_responses.go +++ b/api/devops/devops_client/template/get_template_responses.go @@ -63,9 +63,8 @@ func (o *GetTemplateReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTemplateOK() *GetTemplateOK { return &GetTemplateOK{} } -/*GetTemplateOK handles this case with default header values. +/* GetTemplateOK describes a response with status code 200, with default header values. Single Template record response */ type GetTemplateOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Template } @@ -89,18 +87,25 @@ type GetTemplateOK struct { func (o *GetTemplateOK) Error() string { return fmt.Sprintf("[GET /templates/{templateIdPath}][%d] getTemplateOK %+v", 200, o.Payload) } - func (o *GetTemplateOK) GetPayload() *devops_models.Template { return o.Payload } func (o *GetTemplateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Template) @@ -117,14 +122,13 @@ func NewGetTemplateUnauthorized() *GetTemplateUnauthorized { return &GetTemplateUnauthorized{} } -/*GetTemplateUnauthorized handles this case with default header values. +/* GetTemplateUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetTemplateUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetTemplateUnauthorized struct { func (o *GetTemplateUnauthorized) Error() string { return fmt.Sprintf("[GET /templates/{templateIdPath}][%d] getTemplateUnauthorized %+v", 401, o.Payload) } - func (o *GetTemplateUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetTemplateForbidden() *GetTemplateForbidden { return &GetTemplateForbidden{} } -/*GetTemplateForbidden handles this case with default header values. +/* GetTemplateForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetTemplateForbidden struct { func (o *GetTemplateForbidden) Error() string { return fmt.Sprintf("[GET /templates/{templateIdPath}][%d] getTemplateForbidden %+v", 403, o.Payload) } - func (o *GetTemplateForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetTemplateNotFound() *GetTemplateNotFound { return &GetTemplateNotFound{} } -/*GetTemplateNotFound handles this case with default header values. +/* GetTemplateNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetTemplateNotFound struct { func (o *GetTemplateNotFound) Error() string { return fmt.Sprintf("[GET /templates/{templateIdPath}][%d] getTemplateNotFound %+v", 404, o.Payload) } - func (o *GetTemplateNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetTemplateUnprocessableEntity() *GetTemplateUnprocessableEntity { return &GetTemplateUnprocessableEntity{} } -/*GetTemplateUnprocessableEntity handles this case with default header values. +/* GetTemplateUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetTemplateUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetTemplateUnprocessableEntity struct { func (o *GetTemplateUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /templates/{templateIdPath}][%d] getTemplateUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTemplateUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetTemplateInternalServerError() *GetTemplateInternalServerError { return &GetTemplateInternalServerError{} } -/*GetTemplateInternalServerError handles this case with default header values. +/* GetTemplateInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetTemplateInternalServerError struct { func (o *GetTemplateInternalServerError) Error() string { return fmt.Sprintf("[GET /templates/{templateIdPath}][%d] getTemplateInternalServerError %+v", 500, o.Payload) } - func (o *GetTemplateInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/template/get_templates_observable_parameters.go b/api/devops/devops_client/template/get_templates_observable_parameters.go index 92375b6..52f0965 100644 --- a/api/devops/devops_client/template/get_templates_observable_parameters.go +++ b/api/devops/devops_client/template/get_templates_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTemplatesObservableParams creates a new GetTemplatesObservableParams object -// with the default values initialized. +// NewGetTemplatesObservableParams creates a new GetTemplatesObservableParams 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 NewGetTemplatesObservableParams() *GetTemplatesObservableParams { - return &GetTemplatesObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetTemplatesObservableParamsWithTimeout creates a new GetTemplatesObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTemplatesObservableParamsWithTimeout(timeout time.Duration) *GetTemplatesObservableParams { - return &GetTemplatesObservableParams{ - timeout: timeout, } } // NewGetTemplatesObservableParamsWithContext creates a new GetTemplatesObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTemplatesObservableParamsWithContext(ctx context.Context) *GetTemplatesObservableParams { - return &GetTemplatesObservableParams{ - Context: ctx, } } // NewGetTemplatesObservableParamsWithHTTPClient creates a new GetTemplatesObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTemplatesObservableParamsWithHTTPClient(client *http.Client) *GetTemplatesObservableParams { - return &GetTemplatesObservableParams{ HTTPClient: client, } } -/*GetTemplatesObservableParams contains all the parameters to send to the API endpoint -for the get templates observable operation typically these are written to a http.Request +/* GetTemplatesObservableParams contains all the parameters to send to the API endpoint + for the get templates observable operation. + + Typically these are written to a http.Request. */ type GetTemplatesObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTemplatesObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get templates observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplatesObservableParams) WithDefaults() *GetTemplatesObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get templates observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplatesObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get templates observable params func (o *GetTemplatesObservableParams) WithTimeout(timeout time.Duration) *GetTemplatesObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/template/get_templates_observable_responses.go b/api/devops/devops_client/template/get_templates_observable_responses.go index cff0a6c..2e67dd2 100644 --- a/api/devops/devops_client/template/get_templates_observable_responses.go +++ b/api/devops/devops_client/template/get_templates_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetTemplatesObservableReader) ReadResponse(response runtime.ClientRespo return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTemplatesObservableOK() *GetTemplatesObservableOK { return &GetTemplatesObservableOK{} } -/*GetTemplatesObservableOK handles this case with default header values. +/* GetTemplatesObservableOK describes a response with status code 200, with default header values. Simple Template record response */ type GetTemplatesObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.Template } @@ -89,18 +87,25 @@ type GetTemplatesObservableOK struct { func (o *GetTemplatesObservableOK) Error() string { return fmt.Sprintf("[GET /templates/observable][%d] getTemplatesObservableOK %+v", 200, o.Payload) } - func (o *GetTemplatesObservableOK) GetPayload() []*devops_models.Template { return o.Payload } func (o *GetTemplatesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetTemplatesObservableUnauthorized() *GetTemplatesObservableUnauthorized return &GetTemplatesObservableUnauthorized{} } -/*GetTemplatesObservableUnauthorized handles this case with default header values. +/* GetTemplatesObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetTemplatesObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetTemplatesObservableUnauthorized struct { func (o *GetTemplatesObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /templates/observable][%d] getTemplatesObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetTemplatesObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetTemplatesObservableForbidden() *GetTemplatesObservableForbidden { return &GetTemplatesObservableForbidden{} } -/*GetTemplatesObservableForbidden handles this case with default header values. +/* GetTemplatesObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetTemplatesObservableForbidden struct { func (o *GetTemplatesObservableForbidden) Error() string { return fmt.Sprintf("[GET /templates/observable][%d] getTemplatesObservableForbidden %+v", 403, o.Payload) } - func (o *GetTemplatesObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetTemplatesObservableNotFound() *GetTemplatesObservableNotFound { return &GetTemplatesObservableNotFound{} } -/*GetTemplatesObservableNotFound handles this case with default header values. +/* GetTemplatesObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetTemplatesObservableNotFound struct { func (o *GetTemplatesObservableNotFound) Error() string { return fmt.Sprintf("[GET /templates/observable][%d] getTemplatesObservableNotFound %+v", 404, o.Payload) } - func (o *GetTemplatesObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetTemplatesObservableUnprocessableEntity() *GetTemplatesObservableUnpro return &GetTemplatesObservableUnprocessableEntity{} } -/*GetTemplatesObservableUnprocessableEntity handles this case with default header values. +/* GetTemplatesObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetTemplatesObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetTemplatesObservableUnprocessableEntity struct { func (o *GetTemplatesObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /templates/observable][%d] getTemplatesObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTemplatesObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetTemplatesObservableInternalServerError() *GetTemplatesObservableInter return &GetTemplatesObservableInternalServerError{} } -/*GetTemplatesObservableInternalServerError handles this case with default header values. +/* GetTemplatesObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetTemplatesObservableInternalServerError struct { func (o *GetTemplatesObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /templates/observable][%d] getTemplatesObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetTemplatesObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/template/get_templates_parameters.go b/api/devops/devops_client/template/get_templates_parameters.go index 53f381d..eb68eb9 100644 --- a/api/devops/devops_client/template/get_templates_parameters.go +++ b/api/devops/devops_client/template/get_templates_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTemplatesParams creates a new GetTemplatesParams object -// with the default values initialized. +// NewGetTemplatesParams creates a new GetTemplatesParams 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 NewGetTemplatesParams() *GetTemplatesParams { - var () return &GetTemplatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetTemplatesParamsWithTimeout creates a new GetTemplatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTemplatesParamsWithTimeout(timeout time.Duration) *GetTemplatesParams { - var () return &GetTemplatesParams{ - timeout: timeout, } } // NewGetTemplatesParamsWithContext creates a new GetTemplatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTemplatesParamsWithContext(ctx context.Context) *GetTemplatesParams { - var () return &GetTemplatesParams{ - Context: ctx, } } // NewGetTemplatesParamsWithHTTPClient creates a new GetTemplatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTemplatesParamsWithHTTPClient(client *http.Client) *GetTemplatesParams { - var () return &GetTemplatesParams{ HTTPClient: client, } } -/*GetTemplatesParams contains all the parameters to send to the API endpoint -for the get templates operation typically these are written to a http.Request +/* GetTemplatesParams contains all the parameters to send to the API endpoint + for the get templates operation. + + Typically these are written to a http.Request. */ type GetTemplatesParams struct { - /*Active - Retrieve active records only? + /* Active. + Retrieve active records only? */ Active *bool - /*IsMaster - Is Master Template? + /* IsMaster. + + Is Master Template? */ IsMaster *bool - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*ObjectType - Object Type Name + /* ObjectType. + + Object Type Name */ ObjectType *string - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TemplateID - Template ID + /* TemplateID. + + Template ID */ TemplateID *string @@ -101,6 +109,21 @@ type GetTemplatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplatesParams) WithDefaults() *GetTemplatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get templates params func (o *GetTemplatesParams) WithTimeout(timeout time.Duration) *GetTemplatesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetTemplatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.IsMaster != nil { // query param isMaster var qrIsMaster bool + if o.IsMaster != nil { qrIsMaster = *o.IsMaster } qIsMaster := swag.FormatBool(qrIsMaster) if qIsMaster != "" { + if err := r.SetQueryParam("isMaster", qIsMaster); 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.ObjectType != nil { // query param objectType var qrObjectType string + if o.ObjectType != nil { qrObjectType = *o.ObjectType } qObjectType := qrObjectType if qObjectType != "" { + if err := r.SetQueryParam("objectType", qObjectType); 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 o.TemplateID != nil { // query param templateId var qrTemplateID string + if o.TemplateID != nil { qrTemplateID = *o.TemplateID } qTemplateID := qrTemplateID if qTemplateID != "" { + if err := r.SetQueryParam("templateId", qTemplateID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/devops/devops_client/template/get_templates_responses.go b/api/devops/devops_client/template/get_templates_responses.go index 194a45f..7f0f97e 100644 --- a/api/devops/devops_client/template/get_templates_responses.go +++ b/api/devops/devops_client/template/get_templates_responses.go @@ -63,9 +63,8 @@ func (o *GetTemplatesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTemplatesOK() *GetTemplatesOK { return &GetTemplatesOK{} } -/*GetTemplatesOK handles this case with default header values. +/* GetTemplatesOK describes a response with status code 200, with default header values. Taxnexus Response with Template objects */ type GetTemplatesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.TemplateResponse } @@ -89,18 +87,25 @@ type GetTemplatesOK struct { func (o *GetTemplatesOK) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesOK %+v", 200, o.Payload) } - func (o *GetTemplatesOK) GetPayload() *devops_models.TemplateResponse { return o.Payload } func (o *GetTemplatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.TemplateResponse) @@ -117,14 +122,13 @@ func NewGetTemplatesUnauthorized() *GetTemplatesUnauthorized { return &GetTemplatesUnauthorized{} } -/*GetTemplatesUnauthorized handles this case with default header values. +/* GetTemplatesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetTemplatesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetTemplatesUnauthorized struct { func (o *GetTemplatesUnauthorized) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesUnauthorized %+v", 401, o.Payload) } - func (o *GetTemplatesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetTemplatesForbidden() *GetTemplatesForbidden { return &GetTemplatesForbidden{} } -/*GetTemplatesForbidden handles this case with default header values. +/* GetTemplatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetTemplatesForbidden struct { func (o *GetTemplatesForbidden) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesForbidden %+v", 403, o.Payload) } - func (o *GetTemplatesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetTemplatesNotFound() *GetTemplatesNotFound { return &GetTemplatesNotFound{} } -/*GetTemplatesNotFound handles this case with default header values. +/* GetTemplatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetTemplatesNotFound struct { func (o *GetTemplatesNotFound) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesNotFound %+v", 404, o.Payload) } - func (o *GetTemplatesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetTemplatesUnprocessableEntity() *GetTemplatesUnprocessableEntity { return &GetTemplatesUnprocessableEntity{} } -/*GetTemplatesUnprocessableEntity handles this case with default header values. +/* GetTemplatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetTemplatesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetTemplatesUnprocessableEntity struct { func (o *GetTemplatesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTemplatesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetTemplatesInternalServerError() *GetTemplatesInternalServerError { return &GetTemplatesInternalServerError{} } -/*GetTemplatesInternalServerError handles this case with default header values. +/* GetTemplatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetTemplatesInternalServerError struct { func (o *GetTemplatesInternalServerError) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesInternalServerError %+v", 500, o.Payload) } - func (o *GetTemplatesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTemplatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/template/post_templates_parameters.go b/api/devops/devops_client/template/post_templates_parameters.go index 253138e..ef008a6 100644 --- a/api/devops/devops_client/template/post_templates_parameters.go +++ b/api/devops/devops_client/template/post_templates_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostTemplatesParams creates a new PostTemplatesParams object -// with the default values initialized. +// NewPostTemplatesParams creates a new PostTemplatesParams 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 NewPostTemplatesParams() *PostTemplatesParams { - var () return &PostTemplatesParams{ - timeout: cr.DefaultTimeout, } } // NewPostTemplatesParamsWithTimeout creates a new PostTemplatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTemplatesParamsWithTimeout(timeout time.Duration) *PostTemplatesParams { - var () return &PostTemplatesParams{ - timeout: timeout, } } // NewPostTemplatesParamsWithContext creates a new PostTemplatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTemplatesParamsWithContext(ctx context.Context) *PostTemplatesParams { - var () return &PostTemplatesParams{ - Context: ctx, } } // NewPostTemplatesParamsWithHTTPClient creates a new PostTemplatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTemplatesParamsWithHTTPClient(client *http.Client) *PostTemplatesParams { - var () return &PostTemplatesParams{ HTTPClient: client, } } -/*PostTemplatesParams contains all the parameters to send to the API endpoint -for the post templates operation typically these are written to a http.Request +/* PostTemplatesParams contains all the parameters to send to the API endpoint + for the post templates operation. + + Typically these are written to a http.Request. */ type PostTemplatesParams struct { - /*TemplateRequest - An array of Template records + /* TemplateRequest. + An array of Template records */ TemplateRequest *devops_models.TemplateRequest @@ -77,6 +76,21 @@ type PostTemplatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTemplatesParams) WithDefaults() *PostTemplatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTemplatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post templates params func (o *PostTemplatesParams) WithTimeout(timeout time.Duration) *PostTemplatesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTemplatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.TemplateRequest != nil { if err := r.SetBodyParam(o.TemplateRequest); err != nil { return err diff --git a/api/devops/devops_client/template/post_templates_responses.go b/api/devops/devops_client/template/post_templates_responses.go index c5997e9..68ec136 100644 --- a/api/devops/devops_client/template/post_templates_responses.go +++ b/api/devops/devops_client/template/post_templates_responses.go @@ -63,9 +63,8 @@ func (o *PostTemplatesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTemplatesOK() *PostTemplatesOK { return &PostTemplatesOK{} } -/*PostTemplatesOK handles this case with default header values. +/* PostTemplatesOK describes a response with status code 200, with default header values. Taxnexus Response with Template objects */ type PostTemplatesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.TemplateResponse } @@ -89,18 +87,25 @@ type PostTemplatesOK struct { func (o *PostTemplatesOK) Error() string { return fmt.Sprintf("[POST /templates][%d] postTemplatesOK %+v", 200, o.Payload) } - func (o *PostTemplatesOK) GetPayload() *devops_models.TemplateResponse { return o.Payload } func (o *PostTemplatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.TemplateResponse) @@ -117,14 +122,13 @@ func NewPostTemplatesUnauthorized() *PostTemplatesUnauthorized { return &PostTemplatesUnauthorized{} } -/*PostTemplatesUnauthorized handles this case with default header values. +/* PostTemplatesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostTemplatesUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PostTemplatesUnauthorized struct { func (o *PostTemplatesUnauthorized) Error() string { return fmt.Sprintf("[POST /templates][%d] postTemplatesUnauthorized %+v", 401, o.Payload) } - func (o *PostTemplatesUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTemplatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPostTemplatesForbidden() *PostTemplatesForbidden { return &PostTemplatesForbidden{} } -/*PostTemplatesForbidden handles this case with default header values. +/* PostTemplatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PostTemplatesForbidden struct { func (o *PostTemplatesForbidden) Error() string { return fmt.Sprintf("[POST /templates][%d] postTemplatesForbidden %+v", 403, o.Payload) } - func (o *PostTemplatesForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTemplatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPostTemplatesNotFound() *PostTemplatesNotFound { return &PostTemplatesNotFound{} } -/*PostTemplatesNotFound handles this case with default header values. +/* PostTemplatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PostTemplatesNotFound struct { func (o *PostTemplatesNotFound) Error() string { return fmt.Sprintf("[POST /templates][%d] postTemplatesNotFound %+v", 404, o.Payload) } - func (o *PostTemplatesNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTemplatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPostTemplatesUnprocessableEntity() *PostTemplatesUnprocessableEntity { return &PostTemplatesUnprocessableEntity{} } -/*PostTemplatesUnprocessableEntity handles this case with default header values. +/* PostTemplatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostTemplatesUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PostTemplatesUnprocessableEntity struct { func (o *PostTemplatesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /templates][%d] postTemplatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTemplatesUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTemplatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPostTemplatesInternalServerError() *PostTemplatesInternalServerError { return &PostTemplatesInternalServerError{} } -/*PostTemplatesInternalServerError handles this case with default header values. +/* PostTemplatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PostTemplatesInternalServerError struct { func (o *PostTemplatesInternalServerError) Error() string { return fmt.Sprintf("[POST /templates][%d] postTemplatesInternalServerError %+v", 500, o.Payload) } - func (o *PostTemplatesInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTemplatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/template/template_client.go b/api/devops/devops_client/template/template_client.go index 45b896c..5d26e52 100644 --- a/api/devops/devops_client/template/template_client.go +++ b/api/devops/devops_client/template/template_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - GetTemplate(params *GetTemplateParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplateOK, error) + GetTemplate(params *GetTemplateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplateOK, error) - GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplatesOK, error) + GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplatesOK, error) - GetTemplatesObservable(params *GetTemplatesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplatesObservableOK, error) + GetTemplatesObservable(params *GetTemplatesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplatesObservableOK, error) - PostTemplates(params *PostTemplatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTemplatesOK, error) + PostTemplates(params *PostTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTemplatesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Return a single Template object from datastore as a Singleton */ -func (a *Client) GetTemplate(params *GetTemplateParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplateOK, error) { +func (a *Client) GetTemplate(params *GetTemplateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplateOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTemplateParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTemplate", Method: "GET", PathPattern: "/templates/{templateIdPath}", @@ -65,7 +67,12 @@ func (a *Client) GetTemplate(params *GetTemplateParams, authInfo runtime.ClientA 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 } @@ -84,13 +91,12 @@ func (a *Client) GetTemplate(params *GetTemplateParams, authInfo runtime.ClientA Return a list of Templates from the datastore */ -func (a *Client) GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplatesOK, error) { +func (a *Client) GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTemplatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTemplates", Method: "GET", PathPattern: "/templates", @@ -102,7 +108,12 @@ func (a *Client) GetTemplates(params *GetTemplatesParams, authInfo runtime.Clien 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 } @@ -121,13 +132,12 @@ func (a *Client) GetTemplates(params *GetTemplatesParams, authInfo runtime.Clien Returns a Template retrieval in a observable array */ -func (a *Client) GetTemplatesObservable(params *GetTemplatesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplatesObservableOK, error) { +func (a *Client) GetTemplatesObservable(params *GetTemplatesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplatesObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTemplatesObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTemplatesObservable", Method: "GET", PathPattern: "/templates/observable", @@ -139,7 +149,12 @@ func (a *Client) GetTemplatesObservable(params *GetTemplatesObservableParams, au 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 } @@ -158,13 +173,12 @@ func (a *Client) GetTemplatesObservable(params *GetTemplatesObservableParams, au Create new Templates */ -func (a *Client) PostTemplates(params *PostTemplatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTemplatesOK, error) { +func (a *Client) PostTemplates(params *PostTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTemplatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTemplatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTemplates", Method: "POST", PathPattern: "/templates", @@ -176,7 +190,12 @@ func (a *Client) PostTemplates(params *PostTemplatesParams, authInfo runtime.Cli 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 } diff --git a/api/devops/devops_client/tenant/get_tenant_parameters.go b/api/devops/devops_client/tenant/get_tenant_parameters.go index fd523dd..404ffe2 100644 --- a/api/devops/devops_client/tenant/get_tenant_parameters.go +++ b/api/devops/devops_client/tenant/get_tenant_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTenantParams creates a new GetTenantParams object -// with the default values initialized. +// NewGetTenantParams creates a new GetTenantParams 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 NewGetTenantParams() *GetTenantParams { - var () return &GetTenantParams{ - timeout: cr.DefaultTimeout, } } // NewGetTenantParamsWithTimeout creates a new GetTenantParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTenantParamsWithTimeout(timeout time.Duration) *GetTenantParams { - var () return &GetTenantParams{ - timeout: timeout, } } // NewGetTenantParamsWithContext creates a new GetTenantParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTenantParamsWithContext(ctx context.Context) *GetTenantParams { - var () return &GetTenantParams{ - Context: ctx, } } // NewGetTenantParamsWithHTTPClient creates a new GetTenantParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTenantParamsWithHTTPClient(client *http.Client) *GetTenantParams { - var () return &GetTenantParams{ HTTPClient: client, } } -/*GetTenantParams contains all the parameters to send to the API endpoint -for the get tenant operation typically these are written to a http.Request +/* GetTenantParams contains all the parameters to send to the API endpoint + for the get tenant operation. + + Typically these are written to a http.Request. */ type GetTenantParams struct { - /*TenantIDPath - Taxnexus Record Id of a Tenant + /* TenantIDPath. + Taxnexus Record Id of a Tenant */ TenantIDPath string @@ -75,6 +74,21 @@ type GetTenantParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tenant params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantParams) WithDefaults() *GetTenantParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tenant params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tenant params func (o *GetTenantParams) WithTimeout(timeout time.Duration) *GetTenantParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/tenant/get_tenant_responses.go b/api/devops/devops_client/tenant/get_tenant_responses.go index d4093c0..4a6087c 100644 --- a/api/devops/devops_client/tenant/get_tenant_responses.go +++ b/api/devops/devops_client/tenant/get_tenant_responses.go @@ -63,9 +63,8 @@ func (o *GetTenantReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTenantOK() *GetTenantOK { return &GetTenantOK{} } -/*GetTenantOK handles this case with default header values. +/* GetTenantOK describes a response with status code 200, with default header values. Single Tenant record response */ type GetTenantOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Tenant } @@ -89,18 +87,25 @@ type GetTenantOK struct { func (o *GetTenantOK) Error() string { return fmt.Sprintf("[GET /tenants/{tenantIdPath}][%d] getTenantOK %+v", 200, o.Payload) } - func (o *GetTenantOK) GetPayload() *devops_models.Tenant { return o.Payload } func (o *GetTenantOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Tenant) @@ -117,14 +122,13 @@ func NewGetTenantUnauthorized() *GetTenantUnauthorized { return &GetTenantUnauthorized{} } -/*GetTenantUnauthorized handles this case with default header values. +/* GetTenantUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetTenantUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetTenantUnauthorized struct { func (o *GetTenantUnauthorized) Error() string { return fmt.Sprintf("[GET /tenants/{tenantIdPath}][%d] getTenantUnauthorized %+v", 401, o.Payload) } - func (o *GetTenantUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetTenantForbidden() *GetTenantForbidden { return &GetTenantForbidden{} } -/*GetTenantForbidden handles this case with default header values. +/* GetTenantForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetTenantForbidden struct { func (o *GetTenantForbidden) Error() string { return fmt.Sprintf("[GET /tenants/{tenantIdPath}][%d] getTenantForbidden %+v", 403, o.Payload) } - func (o *GetTenantForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetTenantNotFound() *GetTenantNotFound { return &GetTenantNotFound{} } -/*GetTenantNotFound handles this case with default header values. +/* GetTenantNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetTenantNotFound struct { func (o *GetTenantNotFound) Error() string { return fmt.Sprintf("[GET /tenants/{tenantIdPath}][%d] getTenantNotFound %+v", 404, o.Payload) } - func (o *GetTenantNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetTenantUnprocessableEntity() *GetTenantUnprocessableEntity { return &GetTenantUnprocessableEntity{} } -/*GetTenantUnprocessableEntity handles this case with default header values. +/* GetTenantUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetTenantUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetTenantUnprocessableEntity struct { func (o *GetTenantUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /tenants/{tenantIdPath}][%d] getTenantUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTenantUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetTenantInternalServerError() *GetTenantInternalServerError { return &GetTenantInternalServerError{} } -/*GetTenantInternalServerError handles this case with default header values. +/* GetTenantInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetTenantInternalServerError struct { func (o *GetTenantInternalServerError) Error() string { return fmt.Sprintf("[GET /tenants/{tenantIdPath}][%d] getTenantInternalServerError %+v", 500, o.Payload) } - func (o *GetTenantInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/tenant/get_tenants_observable_parameters.go b/api/devops/devops_client/tenant/get_tenants_observable_parameters.go index 3b1ca09..49e8720 100644 --- a/api/devops/devops_client/tenant/get_tenants_observable_parameters.go +++ b/api/devops/devops_client/tenant/get_tenants_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTenantsObservableParams creates a new GetTenantsObservableParams object -// with the default values initialized. +// NewGetTenantsObservableParams creates a new GetTenantsObservableParams 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 NewGetTenantsObservableParams() *GetTenantsObservableParams { - return &GetTenantsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetTenantsObservableParamsWithTimeout creates a new GetTenantsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTenantsObservableParamsWithTimeout(timeout time.Duration) *GetTenantsObservableParams { - return &GetTenantsObservableParams{ - timeout: timeout, } } // NewGetTenantsObservableParamsWithContext creates a new GetTenantsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTenantsObservableParamsWithContext(ctx context.Context) *GetTenantsObservableParams { - return &GetTenantsObservableParams{ - Context: ctx, } } // NewGetTenantsObservableParamsWithHTTPClient creates a new GetTenantsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTenantsObservableParamsWithHTTPClient(client *http.Client) *GetTenantsObservableParams { - return &GetTenantsObservableParams{ HTTPClient: client, } } -/*GetTenantsObservableParams contains all the parameters to send to the API endpoint -for the get tenants observable operation typically these are written to a http.Request +/* GetTenantsObservableParams contains all the parameters to send to the API endpoint + for the get tenants observable operation. + + Typically these are written to a http.Request. */ type GetTenantsObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTenantsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tenants observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantsObservableParams) WithDefaults() *GetTenantsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tenants observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tenants observable params func (o *GetTenantsObservableParams) WithTimeout(timeout time.Duration) *GetTenantsObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/tenant/get_tenants_observable_responses.go b/api/devops/devops_client/tenant/get_tenants_observable_responses.go index 02a123b..f2fbcef 100644 --- a/api/devops/devops_client/tenant/get_tenants_observable_responses.go +++ b/api/devops/devops_client/tenant/get_tenants_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetTenantsObservableReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTenantsObservableOK() *GetTenantsObservableOK { return &GetTenantsObservableOK{} } -/*GetTenantsObservableOK handles this case with default header values. +/* GetTenantsObservableOK describes a response with status code 200, with default header values. Single Tenant record response */ type GetTenantsObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.Tenant } @@ -89,18 +87,25 @@ type GetTenantsObservableOK struct { func (o *GetTenantsObservableOK) Error() string { return fmt.Sprintf("[GET /tenants/observable][%d] getTenantsObservableOK %+v", 200, o.Payload) } - func (o *GetTenantsObservableOK) GetPayload() []*devops_models.Tenant { return o.Payload } func (o *GetTenantsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetTenantsObservableUnauthorized() *GetTenantsObservableUnauthorized { return &GetTenantsObservableUnauthorized{} } -/*GetTenantsObservableUnauthorized handles this case with default header values. +/* GetTenantsObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetTenantsObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetTenantsObservableUnauthorized struct { func (o *GetTenantsObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /tenants/observable][%d] getTenantsObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetTenantsObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetTenantsObservableForbidden() *GetTenantsObservableForbidden { return &GetTenantsObservableForbidden{} } -/*GetTenantsObservableForbidden handles this case with default header values. +/* GetTenantsObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetTenantsObservableForbidden struct { func (o *GetTenantsObservableForbidden) Error() string { return fmt.Sprintf("[GET /tenants/observable][%d] getTenantsObservableForbidden %+v", 403, o.Payload) } - func (o *GetTenantsObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetTenantsObservableNotFound() *GetTenantsObservableNotFound { return &GetTenantsObservableNotFound{} } -/*GetTenantsObservableNotFound handles this case with default header values. +/* GetTenantsObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetTenantsObservableNotFound struct { func (o *GetTenantsObservableNotFound) Error() string { return fmt.Sprintf("[GET /tenants/observable][%d] getTenantsObservableNotFound %+v", 404, o.Payload) } - func (o *GetTenantsObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetTenantsObservableUnprocessableEntity() *GetTenantsObservableUnprocess return &GetTenantsObservableUnprocessableEntity{} } -/*GetTenantsObservableUnprocessableEntity handles this case with default header values. +/* GetTenantsObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetTenantsObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetTenantsObservableUnprocessableEntity struct { func (o *GetTenantsObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /tenants/observable][%d] getTenantsObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTenantsObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetTenantsObservableInternalServerError() *GetTenantsObservableInternalS return &GetTenantsObservableInternalServerError{} } -/*GetTenantsObservableInternalServerError handles this case with default header values. +/* GetTenantsObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetTenantsObservableInternalServerError struct { func (o *GetTenantsObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /tenants/observable][%d] getTenantsObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetTenantsObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/tenant/get_tenants_parameters.go b/api/devops/devops_client/tenant/get_tenants_parameters.go index 5ae7bab..0d071a6 100644 --- a/api/devops/devops_client/tenant/get_tenants_parameters.go +++ b/api/devops/devops_client/tenant/get_tenants_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTenantsParams creates a new GetTenantsParams object -// with the default values initialized. +// NewGetTenantsParams creates a new GetTenantsParams 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 NewGetTenantsParams() *GetTenantsParams { - var () return &GetTenantsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTenantsParamsWithTimeout creates a new GetTenantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTenantsParamsWithTimeout(timeout time.Duration) *GetTenantsParams { - var () return &GetTenantsParams{ - timeout: timeout, } } // NewGetTenantsParamsWithContext creates a new GetTenantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTenantsParamsWithContext(ctx context.Context) *GetTenantsParams { - var () return &GetTenantsParams{ - Context: ctx, } } // NewGetTenantsParamsWithHTTPClient creates a new GetTenantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTenantsParamsWithHTTPClient(client *http.Client) *GetTenantsParams { - var () return &GetTenantsParams{ HTTPClient: client, } } -/*GetTenantsParams contains all the parameters to send to the API endpoint -for the get tenants operation typically these are written to a http.Request +/* GetTenantsParams contains all the parameters to send to the API endpoint + for the get tenants operation. + + Typically these are written to a http.Request. */ type GetTenantsParams struct { - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + Taxnexus Record Id of a Company */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TaxnexusAccount - Taxnexus Account of a Tenant + /* TaxnexusAccount. + + Taxnexus Account of a Tenant */ TaxnexusAccount *string - /*TenantID - Taxnexus Record Id of a Tenant + /* TenantID. + + Taxnexus Record Id of a Tenant */ TenantID *string @@ -96,6 +103,21 @@ type GetTenantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantsParams) WithDefaults() *GetTenantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tenants params func (o *GetTenantsParams) WithTimeout(timeout time.Duration) *GetTenantsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.TaxnexusAccount != nil { // query param taxnexusAccount var qrTaxnexusAccount string + if o.TaxnexusAccount != nil { qrTaxnexusAccount = *o.TaxnexusAccount } qTaxnexusAccount := qrTaxnexusAccount if qTaxnexusAccount != "" { + if err := r.SetQueryParam("taxnexusAccount", qTaxnexusAccount); err != nil { return err } } - } if o.TenantID != nil { // query param tenantId var qrTenantID string + if o.TenantID != nil { qrTenantID = *o.TenantID } qTenantID := qrTenantID if qTenantID != "" { + if err := r.SetQueryParam("tenantId", qTenantID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/devops/devops_client/tenant/get_tenants_responses.go b/api/devops/devops_client/tenant/get_tenants_responses.go index 31b1acf..49e6a1d 100644 --- a/api/devops/devops_client/tenant/get_tenants_responses.go +++ b/api/devops/devops_client/tenant/get_tenants_responses.go @@ -63,9 +63,8 @@ func (o *GetTenantsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetTenantsOK() *GetTenantsOK { return &GetTenantsOK{} } -/*GetTenantsOK handles this case with default header values. +/* GetTenantsOK describes a response with status code 200, with default header values. Taxnexus Response with Tenant objects */ @@ -87,15 +86,18 @@ type GetTenantsOK struct { func (o *GetTenantsOK) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsOK %+v", 200, o.Payload) } - func (o *GetTenantsOK) GetPayload() *devops_models.TenantResponse { return o.Payload } func (o *GetTenantsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.TenantResponse) @@ -112,14 +114,13 @@ func NewGetTenantsUnauthorized() *GetTenantsUnauthorized { return &GetTenantsUnauthorized{} } -/*GetTenantsUnauthorized handles this case with default header values. +/* GetTenantsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetTenantsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -127,18 +128,25 @@ type GetTenantsUnauthorized struct { func (o *GetTenantsUnauthorized) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsUnauthorized %+v", 401, o.Payload) } - func (o *GetTenantsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -155,7 +163,7 @@ func NewGetTenantsForbidden() *GetTenantsForbidden { return &GetTenantsForbidden{} } -/*GetTenantsForbidden handles this case with default header values. +/* GetTenantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetTenantsForbidden struct { func (o *GetTenantsForbidden) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsForbidden %+v", 403, o.Payload) } - func (o *GetTenantsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -193,7 +204,7 @@ func NewGetTenantsNotFound() *GetTenantsNotFound { return &GetTenantsNotFound{} } -/*GetTenantsNotFound handles this case with default header values. +/* GetTenantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetTenantsNotFound struct { func (o *GetTenantsNotFound) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsNotFound %+v", 404, o.Payload) } - func (o *GetTenantsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -231,14 +245,13 @@ func NewGetTenantsUnprocessableEntity() *GetTenantsUnprocessableEntity { return &GetTenantsUnprocessableEntity{} } -/*GetTenantsUnprocessableEntity handles this case with default header values. +/* GetTenantsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetTenantsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -246,18 +259,25 @@ type GetTenantsUnprocessableEntity struct { func (o *GetTenantsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTenantsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -274,7 +294,7 @@ func NewGetTenantsInternalServerError() *GetTenantsInternalServerError { return &GetTenantsInternalServerError{} } -/*GetTenantsInternalServerError handles this case with default header values. +/* GetTenantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -287,15 +307,18 @@ type GetTenantsInternalServerError struct { func (o *GetTenantsInternalServerError) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsInternalServerError %+v", 500, o.Payload) } - func (o *GetTenantsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetTenantsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/tenant/post_tenants_parameters.go b/api/devops/devops_client/tenant/post_tenants_parameters.go index 76eae4a..c03ed64 100644 --- a/api/devops/devops_client/tenant/post_tenants_parameters.go +++ b/api/devops/devops_client/tenant/post_tenants_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostTenantsParams creates a new PostTenantsParams object -// with the default values initialized. +// NewPostTenantsParams creates a new PostTenantsParams 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 NewPostTenantsParams() *PostTenantsParams { - var () return &PostTenantsParams{ - timeout: cr.DefaultTimeout, } } // NewPostTenantsParamsWithTimeout creates a new PostTenantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTenantsParamsWithTimeout(timeout time.Duration) *PostTenantsParams { - var () return &PostTenantsParams{ - timeout: timeout, } } // NewPostTenantsParamsWithContext creates a new PostTenantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTenantsParamsWithContext(ctx context.Context) *PostTenantsParams { - var () return &PostTenantsParams{ - Context: ctx, } } // NewPostTenantsParamsWithHTTPClient creates a new PostTenantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTenantsParamsWithHTTPClient(client *http.Client) *PostTenantsParams { - var () return &PostTenantsParams{ HTTPClient: client, } } -/*PostTenantsParams contains all the parameters to send to the API endpoint -for the post tenants operation typically these are written to a http.Request +/* PostTenantsParams contains all the parameters to send to the API endpoint + for the post tenants operation. + + Typically these are written to a http.Request. */ type PostTenantsParams struct { - /*TenantRequest - An array of Tenant records + /* TenantRequest. + An array of Tenant records */ TenantRequest *devops_models.TenantRequest @@ -77,6 +76,21 @@ type PostTenantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTenantsParams) WithDefaults() *PostTenantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTenantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post tenants params func (o *PostTenantsParams) WithTimeout(timeout time.Duration) *PostTenantsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.TenantRequest != nil { if err := r.SetBodyParam(o.TenantRequest); err != nil { return err diff --git a/api/devops/devops_client/tenant/post_tenants_responses.go b/api/devops/devops_client/tenant/post_tenants_responses.go index 188674b..2482662 100644 --- a/api/devops/devops_client/tenant/post_tenants_responses.go +++ b/api/devops/devops_client/tenant/post_tenants_responses.go @@ -63,9 +63,8 @@ func (o *PostTenantsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostTenantsOK() *PostTenantsOK { return &PostTenantsOK{} } -/*PostTenantsOK handles this case with default header values. +/* PostTenantsOK describes a response with status code 200, with default header values. Taxnexus Response with Tenant objects */ @@ -87,15 +86,18 @@ type PostTenantsOK struct { func (o *PostTenantsOK) Error() string { return fmt.Sprintf("[POST /tenants][%d] postTenantsOK %+v", 200, o.Payload) } - func (o *PostTenantsOK) GetPayload() *devops_models.TenantResponse { return o.Payload } func (o *PostTenantsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.TenantResponse) @@ -112,14 +114,13 @@ func NewPostTenantsUnauthorized() *PostTenantsUnauthorized { return &PostTenantsUnauthorized{} } -/*PostTenantsUnauthorized handles this case with default header values. +/* PostTenantsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostTenantsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -127,18 +128,25 @@ type PostTenantsUnauthorized struct { func (o *PostTenantsUnauthorized) Error() string { return fmt.Sprintf("[POST /tenants][%d] postTenantsUnauthorized %+v", 401, o.Payload) } - func (o *PostTenantsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTenantsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -155,7 +163,7 @@ func NewPostTenantsForbidden() *PostTenantsForbidden { return &PostTenantsForbidden{} } -/*PostTenantsForbidden handles this case with default header values. +/* PostTenantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTenantsForbidden struct { func (o *PostTenantsForbidden) Error() string { return fmt.Sprintf("[POST /tenants][%d] postTenantsForbidden %+v", 403, o.Payload) } - func (o *PostTenantsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTenantsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -193,7 +204,7 @@ func NewPostTenantsNotFound() *PostTenantsNotFound { return &PostTenantsNotFound{} } -/*PostTenantsNotFound handles this case with default header values. +/* PostTenantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTenantsNotFound struct { func (o *PostTenantsNotFound) Error() string { return fmt.Sprintf("[POST /tenants][%d] postTenantsNotFound %+v", 404, o.Payload) } - func (o *PostTenantsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTenantsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -231,14 +245,13 @@ func NewPostTenantsUnprocessableEntity() *PostTenantsUnprocessableEntity { return &PostTenantsUnprocessableEntity{} } -/*PostTenantsUnprocessableEntity handles this case with default header values. +/* PostTenantsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostTenantsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -246,18 +259,25 @@ type PostTenantsUnprocessableEntity struct { func (o *PostTenantsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /tenants][%d] postTenantsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTenantsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTenantsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -274,7 +294,7 @@ func NewPostTenantsInternalServerError() *PostTenantsInternalServerError { return &PostTenantsInternalServerError{} } -/*PostTenantsInternalServerError handles this case with default header values. +/* PostTenantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -287,15 +307,18 @@ type PostTenantsInternalServerError struct { func (o *PostTenantsInternalServerError) Error() string { return fmt.Sprintf("[POST /tenants][%d] postTenantsInternalServerError %+v", 500, o.Payload) } - func (o *PostTenantsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostTenantsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/tenant/put_tenants_parameters.go b/api/devops/devops_client/tenant/put_tenants_parameters.go index 97afbc9..ceb036a 100644 --- a/api/devops/devops_client/tenant/put_tenants_parameters.go +++ b/api/devops/devops_client/tenant/put_tenants_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPutTenantsParams creates a new PutTenantsParams object -// with the default values initialized. +// NewPutTenantsParams creates a new PutTenantsParams 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 NewPutTenantsParams() *PutTenantsParams { - var () return &PutTenantsParams{ - timeout: cr.DefaultTimeout, } } // NewPutTenantsParamsWithTimeout creates a new PutTenantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutTenantsParamsWithTimeout(timeout time.Duration) *PutTenantsParams { - var () return &PutTenantsParams{ - timeout: timeout, } } // NewPutTenantsParamsWithContext creates a new PutTenantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutTenantsParamsWithContext(ctx context.Context) *PutTenantsParams { - var () return &PutTenantsParams{ - Context: ctx, } } // NewPutTenantsParamsWithHTTPClient creates a new PutTenantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutTenantsParamsWithHTTPClient(client *http.Client) *PutTenantsParams { - var () return &PutTenantsParams{ HTTPClient: client, } } -/*PutTenantsParams contains all the parameters to send to the API endpoint -for the put tenants operation typically these are written to a http.Request +/* PutTenantsParams contains all the parameters to send to the API endpoint + for the put tenants operation. + + Typically these are written to a http.Request. */ type PutTenantsParams struct { - /*TenantRequest - An array of Tenant records + /* TenantRequest. + An array of Tenant records */ TenantRequest *devops_models.TenantRequest @@ -77,6 +76,21 @@ type PutTenantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTenantsParams) WithDefaults() *PutTenantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTenantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put tenants params func (o *PutTenantsParams) WithTimeout(timeout time.Duration) *PutTenantsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.TenantRequest != nil { if err := r.SetBodyParam(o.TenantRequest); err != nil { return err diff --git a/api/devops/devops_client/tenant/put_tenants_responses.go b/api/devops/devops_client/tenant/put_tenants_responses.go index ad7df07..1dc847e 100644 --- a/api/devops/devops_client/tenant/put_tenants_responses.go +++ b/api/devops/devops_client/tenant/put_tenants_responses.go @@ -63,9 +63,8 @@ func (o *PutTenantsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutTenantsOK() *PutTenantsOK { return &PutTenantsOK{} } -/*PutTenantsOK handles this case with default header values. +/* PutTenantsOK describes a response with status code 200, with default header values. Taxnexus Response with Tenant objects */ @@ -87,15 +86,18 @@ type PutTenantsOK struct { func (o *PutTenantsOK) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsOK %+v", 200, o.Payload) } - func (o *PutTenantsOK) GetPayload() *devops_models.TenantResponse { return o.Payload } func (o *PutTenantsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.TenantResponse) @@ -112,14 +114,13 @@ func NewPutTenantsUnauthorized() *PutTenantsUnauthorized { return &PutTenantsUnauthorized{} } -/*PutTenantsUnauthorized handles this case with default header values. +/* PutTenantsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PutTenantsUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -127,18 +128,25 @@ type PutTenantsUnauthorized struct { func (o *PutTenantsUnauthorized) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsUnauthorized %+v", 401, o.Payload) } - func (o *PutTenantsUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PutTenantsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -155,7 +163,7 @@ func NewPutTenantsForbidden() *PutTenantsForbidden { return &PutTenantsForbidden{} } -/*PutTenantsForbidden handles this case with default header values. +/* PutTenantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutTenantsForbidden struct { func (o *PutTenantsForbidden) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsForbidden %+v", 403, o.Payload) } - func (o *PutTenantsForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PutTenantsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -193,7 +204,7 @@ func NewPutTenantsNotFound() *PutTenantsNotFound { return &PutTenantsNotFound{} } -/*PutTenantsNotFound handles this case with default header values. +/* PutTenantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutTenantsNotFound struct { func (o *PutTenantsNotFound) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsNotFound %+v", 404, o.Payload) } - func (o *PutTenantsNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PutTenantsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -231,14 +245,13 @@ func NewPutTenantsUnprocessableEntity() *PutTenantsUnprocessableEntity { return &PutTenantsUnprocessableEntity{} } -/*PutTenantsUnprocessableEntity handles this case with default header values. +/* PutTenantsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PutTenantsUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -246,18 +259,25 @@ type PutTenantsUnprocessableEntity struct { func (o *PutTenantsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutTenantsUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PutTenantsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -274,7 +294,7 @@ func NewPutTenantsInternalServerError() *PutTenantsInternalServerError { return &PutTenantsInternalServerError{} } -/*PutTenantsInternalServerError handles this case with default header values. +/* PutTenantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -287,15 +307,18 @@ type PutTenantsInternalServerError struct { func (o *PutTenantsInternalServerError) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsInternalServerError %+v", 500, o.Payload) } - func (o *PutTenantsInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PutTenantsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/tenant/tenant_client.go b/api/devops/devops_client/tenant/tenant_client.go index 5da41cd..e249dd4 100644 --- a/api/devops/devops_client/tenant/tenant_client.go +++ b/api/devops/devops_client/tenant/tenant_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetTenant(params *GetTenantParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantOK, error) + GetTenant(params *GetTenantParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantOK, error) - GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantsOK, error) + GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantsOK, error) - GetTenantsObservable(params *GetTenantsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantsObservableOK, error) + GetTenantsObservable(params *GetTenantsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantsObservableOK, error) - PostTenants(params *PostTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTenantsOK, error) + PostTenants(params *PostTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTenantsOK, error) - PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTenantsOK, error) + PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTenantsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Return a single Tenant object from datastore as a Singleton */ -func (a *Client) GetTenant(params *GetTenantParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantOK, error) { +func (a *Client) GetTenant(params *GetTenantParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTenantParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTenant", Method: "GET", PathPattern: "/tenants/{tenantIdPath}", @@ -67,7 +69,12 @@ func (a *Client) GetTenant(params *GetTenantParams, authInfo runtime.ClientAuthI 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 } @@ -86,13 +93,12 @@ func (a *Client) GetTenant(params *GetTenantParams, authInfo runtime.ClientAuthI Return a list of Tenant records from the datastore */ -func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantsOK, error) { +func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTenantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTenants", Method: "GET", PathPattern: "/tenants", @@ -104,7 +110,12 @@ func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAut 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 } @@ -123,13 +134,12 @@ func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAut Returns a Tenant retrieval in a observable array */ -func (a *Client) GetTenantsObservable(params *GetTenantsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantsObservableOK, error) { +func (a *Client) GetTenantsObservable(params *GetTenantsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTenantsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTenantsObservable", Method: "GET", PathPattern: "/tenants/observable", @@ -141,7 +151,12 @@ func (a *Client) GetTenantsObservable(params *GetTenantsObservableParams, authIn 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 } @@ -160,13 +175,12 @@ func (a *Client) GetTenantsObservable(params *GetTenantsObservableParams, authIn Create Tenants in Taxnexus */ -func (a *Client) PostTenants(params *PostTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTenantsOK, error) { +func (a *Client) PostTenants(params *PostTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTenantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTenantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTenants", Method: "POST", PathPattern: "/tenants", @@ -178,7 +192,12 @@ func (a *Client) PostTenants(params *PostTenantsParams, authInfo runtime.ClientA 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 } @@ -197,13 +216,12 @@ func (a *Client) PostTenants(params *PostTenantsParams, authInfo runtime.ClientA Update Tenant in Taxnexus */ -func (a *Client) PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTenantsOK, error) { +func (a *Client) PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTenantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutTenantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putTenants", Method: "PUT", PathPattern: "/tenants", @@ -215,7 +233,12 @@ func (a *Client) PutTenants(params *PutTenantsParams, authInfo runtime.ClientAut 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 } diff --git a/api/devops/devops_client/user/get_user_parameters.go b/api/devops/devops_client/user/get_user_parameters.go index f88495b..3e46fdf 100644 --- a/api/devops/devops_client/user/get_user_parameters.go +++ b/api/devops/devops_client/user/get_user_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetUserParams creates a new GetUserParams object -// with the default values initialized. +// NewGetUserParams creates a new GetUserParams 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 NewGetUserParams() *GetUserParams { - var () return &GetUserParams{ - timeout: cr.DefaultTimeout, } } // NewGetUserParamsWithTimeout creates a new GetUserParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUserParamsWithTimeout(timeout time.Duration) *GetUserParams { - var () return &GetUserParams{ - timeout: timeout, } } // NewGetUserParamsWithContext creates a new GetUserParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUserParamsWithContext(ctx context.Context) *GetUserParams { - var () return &GetUserParams{ - Context: ctx, } } // NewGetUserParamsWithHTTPClient creates a new GetUserParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUserParamsWithHTTPClient(client *http.Client) *GetUserParams { - var () return &GetUserParams{ HTTPClient: client, } } -/*GetUserParams contains all the parameters to send to the API endpoint -for the get user operation typically these are written to a http.Request +/* GetUserParams contains all the parameters to send to the API endpoint + for the get user operation. + + Typically these are written to a http.Request. */ type GetUserParams struct { - /*UserIDPath - Taxnexus Record Id of a User + /* UserIDPath. + Taxnexus Record Id of a User */ UserIDPath string @@ -75,6 +74,21 @@ type GetUserParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserParams) WithDefaults() *GetUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get user params func (o *GetUserParams) WithTimeout(timeout time.Duration) *GetUserParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/user/get_user_responses.go b/api/devops/devops_client/user/get_user_responses.go index c691f82..a6d2598 100644 --- a/api/devops/devops_client/user/get_user_responses.go +++ b/api/devops/devops_client/user/get_user_responses.go @@ -63,9 +63,8 @@ func (o *GetUserReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetUserOK() *GetUserOK { return &GetUserOK{} } -/*GetUserOK handles this case with default header values. +/* GetUserOK describes a response with status code 200, with default header values. Single User record response */ type GetUserOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.User } @@ -89,18 +87,25 @@ type GetUserOK struct { func (o *GetUserOK) Error() string { return fmt.Sprintf("[GET /users/{userIdPath}][%d] getUserOK %+v", 200, o.Payload) } - func (o *GetUserOK) GetPayload() *devops_models.User { return o.Payload } func (o *GetUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.User) @@ -117,14 +122,13 @@ func NewGetUserUnauthorized() *GetUserUnauthorized { return &GetUserUnauthorized{} } -/*GetUserUnauthorized handles this case with default header values. +/* GetUserUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetUserUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetUserUnauthorized struct { func (o *GetUserUnauthorized) Error() string { return fmt.Sprintf("[GET /users/{userIdPath}][%d] getUserUnauthorized %+v", 401, o.Payload) } - func (o *GetUserUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetUserForbidden() *GetUserForbidden { return &GetUserForbidden{} } -/*GetUserForbidden handles this case with default header values. +/* GetUserForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetUserForbidden struct { func (o *GetUserForbidden) Error() string { return fmt.Sprintf("[GET /users/{userIdPath}][%d] getUserForbidden %+v", 403, o.Payload) } - func (o *GetUserForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetUserNotFound() *GetUserNotFound { return &GetUserNotFound{} } -/*GetUserNotFound handles this case with default header values. +/* GetUserNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetUserNotFound struct { func (o *GetUserNotFound) Error() string { return fmt.Sprintf("[GET /users/{userIdPath}][%d] getUserNotFound %+v", 404, o.Payload) } - func (o *GetUserNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUserNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetUserUnprocessableEntity() *GetUserUnprocessableEntity { return &GetUserUnprocessableEntity{} } -/*GetUserUnprocessableEntity handles this case with default header values. +/* GetUserUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetUserUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetUserUnprocessableEntity struct { func (o *GetUserUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /users/{userIdPath}][%d] getUserUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetUserUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUserUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetUserInternalServerError() *GetUserInternalServerError { return &GetUserInternalServerError{} } -/*GetUserInternalServerError handles this case with default header values. +/* GetUserInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetUserInternalServerError struct { func (o *GetUserInternalServerError) Error() string { return fmt.Sprintf("[GET /users/{userIdPath}][%d] getUserInternalServerError %+v", 500, o.Payload) } - func (o *GetUserInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUserInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/user/get_users_observable_parameters.go b/api/devops/devops_client/user/get_users_observable_parameters.go index 9920d4e..495e965 100644 --- a/api/devops/devops_client/user/get_users_observable_parameters.go +++ b/api/devops/devops_client/user/get_users_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetUsersObservableParams creates a new GetUsersObservableParams object -// with the default values initialized. +// NewGetUsersObservableParams creates a new GetUsersObservableParams 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 NewGetUsersObservableParams() *GetUsersObservableParams { - return &GetUsersObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetUsersObservableParamsWithTimeout creates a new GetUsersObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUsersObservableParamsWithTimeout(timeout time.Duration) *GetUsersObservableParams { - return &GetUsersObservableParams{ - timeout: timeout, } } // NewGetUsersObservableParamsWithContext creates a new GetUsersObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUsersObservableParamsWithContext(ctx context.Context) *GetUsersObservableParams { - return &GetUsersObservableParams{ - Context: ctx, } } // NewGetUsersObservableParamsWithHTTPClient creates a new GetUsersObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUsersObservableParamsWithHTTPClient(client *http.Client) *GetUsersObservableParams { - return &GetUsersObservableParams{ HTTPClient: client, } } -/*GetUsersObservableParams contains all the parameters to send to the API endpoint -for the get users observable operation typically these are written to a http.Request +/* GetUsersObservableParams contains all the parameters to send to the API endpoint + for the get users observable operation. + + Typically these are written to a http.Request. */ type GetUsersObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetUsersObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get users observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersObservableParams) WithDefaults() *GetUsersObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get users observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get users observable params func (o *GetUsersObservableParams) WithTimeout(timeout time.Duration) *GetUsersObservableParams { o.SetTimeout(timeout) diff --git a/api/devops/devops_client/user/get_users_observable_responses.go b/api/devops/devops_client/user/get_users_observable_responses.go index 9ef8f8c..eee0239 100644 --- a/api/devops/devops_client/user/get_users_observable_responses.go +++ b/api/devops/devops_client/user/get_users_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetUsersObservableReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetUsersObservableOK() *GetUsersObservableOK { return &GetUsersObservableOK{} } -/*GetUsersObservableOK handles this case with default header values. +/* GetUsersObservableOK describes a response with status code 200, with default header values. Simple User record response */ type GetUsersObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*devops_models.User } @@ -89,18 +87,25 @@ type GetUsersObservableOK struct { func (o *GetUsersObservableOK) Error() string { return fmt.Sprintf("[GET /users/observable][%d] getUsersObservableOK %+v", 200, o.Payload) } - func (o *GetUsersObservableOK) GetPayload() []*devops_models.User { return o.Payload } func (o *GetUsersObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,14 +120,13 @@ func NewGetUsersObservableUnauthorized() *GetUsersObservableUnauthorized { return &GetUsersObservableUnauthorized{} } -/*GetUsersObservableUnauthorized handles this case with default header values. +/* GetUsersObservableUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetUsersObservableUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -130,18 +134,25 @@ type GetUsersObservableUnauthorized struct { func (o *GetUsersObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /users/observable][%d] getUsersObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetUsersObservableUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -158,7 +169,7 @@ func NewGetUsersObservableForbidden() *GetUsersObservableForbidden { return &GetUsersObservableForbidden{} } -/*GetUsersObservableForbidden handles this case with default header values. +/* GetUsersObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -171,15 +182,18 @@ type GetUsersObservableForbidden struct { func (o *GetUsersObservableForbidden) Error() string { return fmt.Sprintf("[GET /users/observable][%d] getUsersObservableForbidden %+v", 403, o.Payload) } - func (o *GetUsersObservableForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -196,7 +210,7 @@ func NewGetUsersObservableNotFound() *GetUsersObservableNotFound { return &GetUsersObservableNotFound{} } -/*GetUsersObservableNotFound handles this case with default header values. +/* GetUsersObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -209,15 +223,18 @@ type GetUsersObservableNotFound struct { func (o *GetUsersObservableNotFound) Error() string { return fmt.Sprintf("[GET /users/observable][%d] getUsersObservableNotFound %+v", 404, o.Payload) } - func (o *GetUsersObservableNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -234,14 +251,13 @@ func NewGetUsersObservableUnprocessableEntity() *GetUsersObservableUnprocessable return &GetUsersObservableUnprocessableEntity{} } -/*GetUsersObservableUnprocessableEntity handles this case with default header values. +/* GetUsersObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetUsersObservableUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -249,18 +265,25 @@ type GetUsersObservableUnprocessableEntity struct { func (o *GetUsersObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /users/observable][%d] getUsersObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetUsersObservableUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -277,7 +300,7 @@ func NewGetUsersObservableInternalServerError() *GetUsersObservableInternalServe return &GetUsersObservableInternalServerError{} } -/*GetUsersObservableInternalServerError handles this case with default header values. +/* GetUsersObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -290,15 +313,18 @@ type GetUsersObservableInternalServerError struct { func (o *GetUsersObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /users/observable][%d] getUsersObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetUsersObservableInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/user/get_users_parameters.go b/api/devops/devops_client/user/get_users_parameters.go index 92c2454..dfc90f9 100644 --- a/api/devops/devops_client/user/get_users_parameters.go +++ b/api/devops/devops_client/user/get_users_parameters.go @@ -21,88 +21,98 @@ import ( "github.com/go-openapi/swag" ) -// NewGetUsersParams creates a new GetUsersParams object -// with the default values initialized. +// NewGetUsersParams creates a new GetUsersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetUsersParams() *GetUsersParams { - var () return &GetUsersParams{ - timeout: cr.DefaultTimeout, } } // NewGetUsersParamsWithTimeout creates a new GetUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams { - var () return &GetUsersParams{ - timeout: timeout, } } // NewGetUsersParamsWithContext creates a new GetUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams { - var () return &GetUsersParams{ - Context: ctx, } } // NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams { - var () return &GetUsersParams{ HTTPClient: client, } } -/*GetUsersParams contains all the parameters to send to the API endpoint -for the get users operation typically these are written to a http.Request +/* GetUsersParams contains all the parameters to send to the API endpoint + for the get users operation. + + Typically these are written to a http.Request. */ type GetUsersParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*Active - Retrieve active records only? + /* Active. + + Retrieve active records only? */ Active *bool - /*ContactID - Taxnexus Record Id of a Contact + /* ContactID. + + Taxnexus Record Id of a Contact */ ContactID *string - /*Email - Email Address (not unique) + /* Email. + + Email Address (not unique) */ Email *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*UserID - Taxnexus User ID (unique) + /* UserID. + + Taxnexus User ID (unique) */ UserID *string - /*Username - Username (unique) + /* Username. + + Username (unique) */ Username *string @@ -111,6 +121,21 @@ type GetUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) WithDefaults() *GetUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get users params func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams { o.SetTimeout(timeout) @@ -244,128 +269,136 @@ func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ContactID != nil { // query param contactId var qrContactID string + if o.ContactID != nil { qrContactID = *o.ContactID } qContactID := qrContactID if qContactID != "" { + if err := r.SetQueryParam("contactId", qContactID); err != nil { return err } } - } if o.Email != nil { // query param email var qrEmail string + if o.Email != nil { qrEmail = *o.Email } qEmail := qrEmail if qEmail != "" { + if err := r.SetQueryParam("email", qEmail); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.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 o.UserID != nil { // query param userId var qrUserID string + if o.UserID != nil { qrUserID = *o.UserID } qUserID := qrUserID if qUserID != "" { + if err := r.SetQueryParam("userId", qUserID); err != nil { return err } } - } if o.Username != nil { // query param username var qrUsername string + if o.Username != nil { qrUsername = *o.Username } qUsername := qrUsername if qUsername != "" { + if err := r.SetQueryParam("username", qUsername); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/devops/devops_client/user/get_users_responses.go b/api/devops/devops_client/user/get_users_responses.go index bcdfdbc..b462267 100644 --- a/api/devops/devops_client/user/get_users_responses.go +++ b/api/devops/devops_client/user/get_users_responses.go @@ -63,9 +63,8 @@ func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetUsersOK() *GetUsersOK { return &GetUsersOK{} } -/*GetUsersOK handles this case with default header values. +/* GetUsersOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ type GetUsersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.UserResponse } @@ -89,18 +87,25 @@ type GetUsersOK struct { func (o *GetUsersOK) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload) } - func (o *GetUsersOK) GetPayload() *devops_models.UserResponse { return o.Payload } func (o *GetUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.UserResponse) @@ -117,14 +122,13 @@ func NewGetUsersUnauthorized() *GetUsersUnauthorized { return &GetUsersUnauthorized{} } -/*GetUsersUnauthorized handles this case with default header values. +/* GetUsersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type GetUsersUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type GetUsersUnauthorized struct { func (o *GetUsersUnauthorized) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload) } - func (o *GetUsersUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewGetUsersForbidden() *GetUsersForbidden { return &GetUsersForbidden{} } -/*GetUsersForbidden handles this case with default header values. +/* GetUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type GetUsersForbidden struct { func (o *GetUsersForbidden) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload) } - func (o *GetUsersForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewGetUsersNotFound() *GetUsersNotFound { return &GetUsersNotFound{} } -/*GetUsersNotFound handles this case with default header values. +/* GetUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type GetUsersNotFound struct { func (o *GetUsersNotFound) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload) } - func (o *GetUsersNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewGetUsersUnprocessableEntity() *GetUsersUnprocessableEntity { return &GetUsersUnprocessableEntity{} } -/*GetUsersUnprocessableEntity handles this case with default header values. +/* GetUsersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type GetUsersUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type GetUsersUnprocessableEntity struct { func (o *GetUsersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetUsersUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewGetUsersInternalServerError() *GetUsersInternalServerError { return &GetUsersInternalServerError{} } -/*GetUsersInternalServerError handles this case with default header values. +/* GetUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type GetUsersInternalServerError struct { func (o *GetUsersInternalServerError) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload) } - func (o *GetUsersInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *GetUsersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/user/post_users_parameters.go b/api/devops/devops_client/user/post_users_parameters.go index 1d3167c..2abbcb7 100644 --- a/api/devops/devops_client/user/post_users_parameters.go +++ b/api/devops/devops_client/user/post_users_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPostUsersParams creates a new PostUsersParams object -// with the default values initialized. +// NewPostUsersParams creates a new PostUsersParams 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 NewPostUsersParams() *PostUsersParams { - var () return &PostUsersParams{ - timeout: cr.DefaultTimeout, } } // NewPostUsersParamsWithTimeout creates a new PostUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostUsersParamsWithTimeout(timeout time.Duration) *PostUsersParams { - var () return &PostUsersParams{ - timeout: timeout, } } // NewPostUsersParamsWithContext creates a new PostUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostUsersParamsWithContext(ctx context.Context) *PostUsersParams { - var () return &PostUsersParams{ - Context: ctx, } } // NewPostUsersParamsWithHTTPClient creates a new PostUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostUsersParamsWithHTTPClient(client *http.Client) *PostUsersParams { - var () return &PostUsersParams{ HTTPClient: client, } } -/*PostUsersParams contains all the parameters to send to the API endpoint -for the post users operation typically these are written to a http.Request +/* PostUsersParams contains all the parameters to send to the API endpoint + for the post users operation. + + Typically these are written to a http.Request. */ type PostUsersParams struct { - /*UserRequest - An array of User records + /* UserRequest. + An array of User records */ UserRequest *devops_models.UserRequest @@ -77,6 +76,21 @@ type PostUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersParams) WithDefaults() *PostUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post users params func (o *PostUsersParams) WithTimeout(timeout time.Duration) *PostUsersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.UserRequest != nil { if err := r.SetBodyParam(o.UserRequest); err != nil { return err diff --git a/api/devops/devops_client/user/post_users_responses.go b/api/devops/devops_client/user/post_users_responses.go index 0122fab..00d5dc5 100644 --- a/api/devops/devops_client/user/post_users_responses.go +++ b/api/devops/devops_client/user/post_users_responses.go @@ -63,9 +63,8 @@ func (o *PostUsersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostUsersOK() *PostUsersOK { return &PostUsersOK{} } -/*PostUsersOK handles this case with default header values. +/* PostUsersOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ type PostUsersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.UserResponse } @@ -89,18 +87,25 @@ type PostUsersOK struct { func (o *PostUsersOK) Error() string { return fmt.Sprintf("[POST /users][%d] postUsersOK %+v", 200, o.Payload) } - func (o *PostUsersOK) GetPayload() *devops_models.UserResponse { return o.Payload } func (o *PostUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.UserResponse) @@ -117,14 +122,13 @@ func NewPostUsersUnauthorized() *PostUsersUnauthorized { return &PostUsersUnauthorized{} } -/*PostUsersUnauthorized handles this case with default header values. +/* PostUsersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PostUsersUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PostUsersUnauthorized struct { func (o *PostUsersUnauthorized) Error() string { return fmt.Sprintf("[POST /users][%d] postUsersUnauthorized %+v", 401, o.Payload) } - func (o *PostUsersUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PostUsersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPostUsersForbidden() *PostUsersForbidden { return &PostUsersForbidden{} } -/*PostUsersForbidden handles this case with default header values. +/* PostUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PostUsersForbidden struct { func (o *PostUsersForbidden) Error() string { return fmt.Sprintf("[POST /users][%d] postUsersForbidden %+v", 403, o.Payload) } - func (o *PostUsersForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PostUsersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPostUsersNotFound() *PostUsersNotFound { return &PostUsersNotFound{} } -/*PostUsersNotFound handles this case with default header values. +/* PostUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PostUsersNotFound struct { func (o *PostUsersNotFound) Error() string { return fmt.Sprintf("[POST /users][%d] postUsersNotFound %+v", 404, o.Payload) } - func (o *PostUsersNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PostUsersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPostUsersUnprocessableEntity() *PostUsersUnprocessableEntity { return &PostUsersUnprocessableEntity{} } -/*PostUsersUnprocessableEntity handles this case with default header values. +/* PostUsersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PostUsersUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PostUsersUnprocessableEntity struct { func (o *PostUsersUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /users][%d] postUsersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostUsersUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PostUsersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPostUsersInternalServerError() *PostUsersInternalServerError { return &PostUsersInternalServerError{} } -/*PostUsersInternalServerError handles this case with default header values. +/* PostUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PostUsersInternalServerError struct { func (o *PostUsersInternalServerError) Error() string { return fmt.Sprintf("[POST /users][%d] postUsersInternalServerError %+v", 500, o.Payload) } - func (o *PostUsersInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PostUsersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/user/put_users_parameters.go b/api/devops/devops_client/user/put_users_parameters.go index 4a8dfdc..6d37437 100644 --- a/api/devops/devops_client/user/put_users_parameters.go +++ b/api/devops/devops_client/user/put_users_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/devops/devops_models" ) -// NewPutUsersParams creates a new PutUsersParams object -// with the default values initialized. +// NewPutUsersParams creates a new PutUsersParams 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 NewPutUsersParams() *PutUsersParams { - var () return &PutUsersParams{ - timeout: cr.DefaultTimeout, } } // NewPutUsersParamsWithTimeout creates a new PutUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutUsersParamsWithTimeout(timeout time.Duration) *PutUsersParams { - var () return &PutUsersParams{ - timeout: timeout, } } // NewPutUsersParamsWithContext creates a new PutUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutUsersParamsWithContext(ctx context.Context) *PutUsersParams { - var () return &PutUsersParams{ - Context: ctx, } } // NewPutUsersParamsWithHTTPClient creates a new PutUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutUsersParamsWithHTTPClient(client *http.Client) *PutUsersParams { - var () return &PutUsersParams{ HTTPClient: client, } } -/*PutUsersParams contains all the parameters to send to the API endpoint -for the put users operation typically these are written to a http.Request +/* PutUsersParams contains all the parameters to send to the API endpoint + for the put users operation. + + Typically these are written to a http.Request. */ type PutUsersParams struct { - /*UserRequest - An array of User records + /* UserRequest. + An array of User records */ UserRequest *devops_models.UserRequest @@ -77,6 +76,21 @@ type PutUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutUsersParams) WithDefaults() *PutUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put users params func (o *PutUsersParams) WithTimeout(timeout time.Duration) *PutUsersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.UserRequest != nil { if err := r.SetBodyParam(o.UserRequest); err != nil { return err diff --git a/api/devops/devops_client/user/put_users_responses.go b/api/devops/devops_client/user/put_users_responses.go index 554e8e3..9874cdb 100644 --- a/api/devops/devops_client/user/put_users_responses.go +++ b/api/devops/devops_client/user/put_users_responses.go @@ -63,9 +63,8 @@ func (o *PutUsersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutUsersOK() *PutUsersOK { return &PutUsersOK{} } -/*PutUsersOK handles this case with default header values. +/* PutUsersOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ type PutUsersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.UserResponse } @@ -89,18 +87,25 @@ type PutUsersOK struct { func (o *PutUsersOK) Error() string { return fmt.Sprintf("[PUT /users][%d] putUsersOK %+v", 200, o.Payload) } - func (o *PutUsersOK) GetPayload() *devops_models.UserResponse { return o.Payload } func (o *PutUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.UserResponse) @@ -117,14 +122,13 @@ func NewPutUsersUnauthorized() *PutUsersUnauthorized { return &PutUsersUnauthorized{} } -/*PutUsersUnauthorized handles this case with default header values. +/* PutUsersUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ type PutUsersUnauthorized struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -132,18 +136,25 @@ type PutUsersUnauthorized struct { func (o *PutUsersUnauthorized) Error() string { return fmt.Sprintf("[PUT /users][%d] putUsersUnauthorized %+v", 401, o.Payload) } - func (o *PutUsersUnauthorized) GetPayload() *devops_models.Error { return o.Payload } func (o *PutUsersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -160,7 +171,7 @@ func NewPutUsersForbidden() *PutUsersForbidden { return &PutUsersForbidden{} } -/*PutUsersForbidden handles this case with default header values. +/* PutUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -173,15 +184,18 @@ type PutUsersForbidden struct { func (o *PutUsersForbidden) Error() string { return fmt.Sprintf("[PUT /users][%d] putUsersForbidden %+v", 403, o.Payload) } - func (o *PutUsersForbidden) GetPayload() *devops_models.Error { return o.Payload } func (o *PutUsersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -198,7 +212,7 @@ func NewPutUsersNotFound() *PutUsersNotFound { return &PutUsersNotFound{} } -/*PutUsersNotFound handles this case with default header values. +/* PutUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -211,15 +225,18 @@ type PutUsersNotFound struct { func (o *PutUsersNotFound) Error() string { return fmt.Sprintf("[PUT /users][%d] putUsersNotFound %+v", 404, o.Payload) } - func (o *PutUsersNotFound) GetPayload() *devops_models.Error { return o.Payload } func (o *PutUsersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) @@ -236,14 +253,13 @@ func NewPutUsersUnprocessableEntity() *PutUsersUnprocessableEntity { return &PutUsersUnprocessableEntity{} } -/*PutUsersUnprocessableEntity handles this case with default header values. +/* PutUsersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ type PutUsersUnprocessableEntity struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *devops_models.Error } @@ -251,18 +267,25 @@ type PutUsersUnprocessableEntity struct { func (o *PutUsersUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /users][%d] putUsersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutUsersUnprocessableEntity) GetPayload() *devops_models.Error { return o.Payload } func (o *PutUsersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(devops_models.Error) @@ -279,7 +302,7 @@ func NewPutUsersInternalServerError() *PutUsersInternalServerError { return &PutUsersInternalServerError{} } -/*PutUsersInternalServerError handles this case with default header values. +/* PutUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -292,15 +315,18 @@ type PutUsersInternalServerError struct { func (o *PutUsersInternalServerError) Error() string { return fmt.Sprintf("[PUT /users][%d] putUsersInternalServerError %+v", 500, o.Payload) } - func (o *PutUsersInternalServerError) GetPayload() *devops_models.Error { return o.Payload } func (o *PutUsersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(devops_models.Error) diff --git a/api/devops/devops_client/user/user_client.go b/api/devops/devops_client/user/user_client.go index b6def27..7bebeb0 100644 --- a/api/devops/devops_client/user/user_client.go +++ b/api/devops/devops_client/user/user_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter) (*GetUserOK, error) + GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) - GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersOK, error) + GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) - GetUsersObservable(params *GetUsersObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersObservableOK, error) + GetUsersObservable(params *GetUsersObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersObservableOK, error) - PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthInfoWriter) (*PostUsersOK, error) + PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersOK, error) - PutUsers(params *PutUsersParams, authInfo runtime.ClientAuthInfoWriter) (*PutUsersOK, error) + PutUsers(params *PutUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutUsersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Return a single User object from datastore as a Singleton */ -func (a *Client) GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter) (*GetUserOK, error) { +func (a *Client) GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUserParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUser", Method: "GET", PathPattern: "/users/{userIdPath}", @@ -67,7 +69,12 @@ func (a *Client) GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoW 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 } @@ -86,13 +93,12 @@ func (a *Client) GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoW Return a list of User records from the datastore */ -func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersOK, error) { +func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUsers", Method: "GET", PathPattern: "/users", @@ -104,7 +110,12 @@ func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInf 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 } @@ -123,13 +134,12 @@ func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInf Returns a User retrieval in a observable array */ -func (a *Client) GetUsersObservable(params *GetUsersObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersObservableOK, error) { +func (a *Client) GetUsersObservable(params *GetUsersObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUsersObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUsersObservable", Method: "GET", PathPattern: "/users/observable", @@ -141,7 +151,12 @@ func (a *Client) GetUsersObservable(params *GetUsersObservableParams, authInfo r 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 } @@ -160,13 +175,12 @@ func (a *Client) GetUsersObservable(params *GetUsersObservableParams, authInfo r Create new Users */ -func (a *Client) PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthInfoWriter) (*PostUsersOK, error) { +func (a *Client) PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostUsersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postUsers", Method: "POST", PathPattern: "/users", @@ -178,7 +192,12 @@ func (a *Client) PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthI 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 } @@ -197,13 +216,12 @@ func (a *Client) PostUsers(params *PostUsersParams, authInfo runtime.ClientAuthI Update existing users */ -func (a *Client) PutUsers(params *PutUsersParams, authInfo runtime.ClientAuthInfoWriter) (*PutUsersOK, error) { +func (a *Client) PutUsers(params *PutUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutUsersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putUsers", Method: "PUT", PathPattern: "/users", @@ -215,7 +233,12 @@ func (a *Client) PutUsers(params *PutUsersParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/devops/devops_models/address.go b/api/devops/devops_models/address.go index 1d3da3c..ad2d6a7 100644 --- a/api/devops/devops_models/address.go +++ b/api/devops/devops_models/address.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *Address) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this address based on context it is used +func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Address) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/cluster.go b/api/devops/devops_models/cluster.go index 798ae3c..376eda6 100644 --- a/api/devops/devops_models/cluster.go +++ b/api/devops/devops_models/cluster.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -76,6 +78,11 @@ func (m *Cluster) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cluster based on context it is used +func (m *Cluster) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Cluster) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/cluster_request.go b/api/devops/devops_models/cluster_request.go index fe3b377..d5bfe13 100644 --- a/api/devops/devops_models/cluster_request.go +++ b/api/devops/devops_models/cluster_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *ClusterRequest) Validate(formats strfmt.Registry) error { } func (m *ClusterRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *ClusterRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cluster request based on the context it is used +func (m *ClusterRequest) 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 *ClusterRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ClusterRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/cluster_response.go b/api/devops/devops_models/cluster_response.go index 21442af..eff005a 100644 --- a/api/devops/devops_models/cluster_response.go +++ b/api/devops/devops_models/cluster_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ClusterResponse) Validate(formats strfmt.Registry) error { } func (m *ClusterResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ClusterResponse) validateData(formats strfmt.Registry) error { } func (m *ClusterResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ClusterResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cluster response based on the context it is used +func (m *ClusterResponse) 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 *ClusterResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ClusterResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/database.go b/api/devops/devops_models/database.go index 9ee97da..918ffbc 100644 --- a/api/devops/devops_models/database.go +++ b/api/devops/devops_models/database.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -64,6 +66,11 @@ func (m *Database) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this database based on context it is used +func (m *Database) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Database) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/database_request.go b/api/devops/devops_models/database_request.go index 7819ae5..1347925 100644 --- a/api/devops/devops_models/database_request.go +++ b/api/devops/devops_models/database_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *DatabaseRequest) Validate(formats strfmt.Registry) error { } func (m *DatabaseRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *DatabaseRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this database request based on the context it is used +func (m *DatabaseRequest) 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 *DatabaseRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *DatabaseRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/database_response.go b/api/devops/devops_models/database_response.go index cab04df..6a53011 100644 --- a/api/devops/devops_models/database_response.go +++ b/api/devops/devops_models/database_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DatabaseResponse) Validate(formats strfmt.Registry) error { } func (m *DatabaseResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DatabaseResponse) validateData(formats strfmt.Registry) error { } func (m *DatabaseResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DatabaseResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this database response based on the context it is used +func (m *DatabaseResponse) 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 *DatabaseResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DatabaseResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DatabaseResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/delete_response.go b/api/devops/devops_models/delete_response.go index 246442c..ec063fc 100644 --- a/api/devops/devops_models/delete_response.go +++ b/api/devops/devops_models/delete_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error { } func (m *DeleteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error { } func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this delete response based on the context it is used +func (m *DeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DeleteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DeleteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/error.go b/api/devops/devops_models/error.go index 4e81d0d..0157440 100644 --- a/api/devops/devops_models/error.go +++ b/api/devops/devops_models/error.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/ingest.go b/api/devops/devops_models/ingest.go index d2b58aa..5d2a84e 100644 --- a/api/devops/devops_models/ingest.go +++ b/api/devops/devops_models/ingest.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -221,8 +222,8 @@ const ( // IngestIngestTypeSuretax captures enum value "suretax" IngestIngestTypeSuretax string = "suretax" - // IngestIngestTypeTaxnexusAPI captures enum value "taxnexus-api" - IngestIngestTypeTaxnexusAPI string = "taxnexus-api" + // IngestIngestTypeTaxnexusDashAPI captures enum value "taxnexus-api" + IngestIngestTypeTaxnexusDashAPI string = "taxnexus-api" ) // prop value enum @@ -234,7 +235,6 @@ func (m *Ingest) validateIngestTypeEnum(path, location string, value string) err } func (m *Ingest) validateIngestType(formats strfmt.Registry) error { - if swag.IsZero(m.IngestType) { // not required return nil } @@ -264,8 +264,8 @@ const ( // IngestObjectTypeAccount captures enum value "account" IngestObjectTypeAccount string = "account" - // IngestObjectTypeCashReceipt captures enum value "cash-receipt" - IngestObjectTypeCashReceipt string = "cash-receipt" + // IngestObjectTypeCashDashReceipt captures enum value "cash-receipt" + IngestObjectTypeCashDashReceipt string = "cash-receipt" // IngestObjectTypeContact captures enum value "contact" IngestObjectTypeContact string = "contact" @@ -341,7 +341,6 @@ func (m *Ingest) validateSourceEnum(path, location string, value string) error { } func (m *Ingest) validateSource(formats strfmt.Registry) error { - if swag.IsZero(m.Source) { // not required return nil } @@ -411,7 +410,6 @@ func (m *Ingest) validateStatusEnum(path, location string, value string) error { } func (m *Ingest) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -424,6 +422,11 @@ func (m *Ingest) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validates this ingest based on context it is used +func (m *Ingest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Ingest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/ingest_request.go b/api/devops/devops_models/ingest_request.go index 2d64f98..ba63bda 100644 --- a/api/devops/devops_models/ingest_request.go +++ b/api/devops/devops_models/ingest_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *IngestRequest) Validate(formats strfmt.Registry) error { } func (m *IngestRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *IngestRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this ingest request based on the context it is used +func (m *IngestRequest) 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 *IngestRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *IngestRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/ingest_response.go b/api/devops/devops_models/ingest_response.go index 59d92b9..be0b843 100644 --- a/api/devops/devops_models/ingest_response.go +++ b/api/devops/devops_models/ingest_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *IngestResponse) Validate(formats strfmt.Registry) error { } func (m *IngestResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *IngestResponse) validateData(formats strfmt.Registry) error { } func (m *IngestResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *IngestResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this ingest response based on the context it is used +func (m *IngestResponse) 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 *IngestResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IngestResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IngestResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/job.go b/api/devops/devops_models/job.go index 22f7cfc..c3539c3 100644 --- a/api/devops/devops_models/job.go +++ b/api/devops/devops_models/job.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -293,7 +294,6 @@ func (m *Job) validateIntervalEnum(path, location string, value string) error { } func (m *Job) validateInterval(formats strfmt.Registry) error { - if swag.IsZero(m.Interval) { // not required return nil } @@ -351,7 +351,6 @@ func (m *Job) validateSourceEnum(path, location string, value string) error { } func (m *Job) validateSource(formats strfmt.Registry) error { - if swag.IsZero(m.Source) { // not required return nil } @@ -403,7 +402,6 @@ func (m *Job) validateStatusEnum(path, location string, value string) error { } func (m *Job) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -452,7 +450,6 @@ func (m *Job) validateTargetEnum(path, location string, value string) error { } func (m *Job) validateTarget(formats strfmt.Registry) error { - if swag.IsZero(m.Target) { // not required return nil } @@ -465,6 +462,11 @@ func (m *Job) validateTarget(formats strfmt.Registry) error { return nil } +// ContextValidate validates this job based on context it is used +func (m *Job) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Job) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/job_request.go b/api/devops/devops_models/job_request.go index 4bd26b1..4a7a40f 100644 --- a/api/devops/devops_models/job_request.go +++ b/api/devops/devops_models/job_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *JobRequest) Validate(formats strfmt.Registry) error { } func (m *JobRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *JobRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this job request based on the context it is used +func (m *JobRequest) 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 *JobRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *JobRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/job_response.go b/api/devops/devops_models/job_response.go index b398632..2711d87 100644 --- a/api/devops/devops_models/job_response.go +++ b/api/devops/devops_models/job_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *JobResponse) Validate(formats strfmt.Registry) error { } func (m *JobResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *JobResponse) validateData(formats strfmt.Registry) error { } func (m *JobResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *JobResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this job response based on the context it is used +func (m *JobResponse) 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 *JobResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *JobResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *JobResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/message.go b/api/devops/devops_models/message.go index a6a4239..58a7bdb 100644 --- a/api/devops/devops_models/message.go +++ b/api/devops/devops_models/message.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/pagination.go b/api/devops/devops_models/pagination.go index 3ace192..bafc09a 100644 --- a/api/devops/devops_models/pagination.go +++ b/api/devops/devops_models/pagination.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/request_meta.go b/api/devops/devops_models/request_meta.go index 1e3c19b..6d430ef 100644 --- a/api/devops/devops_models/request_meta.go +++ b/api/devops/devops_models/request_meta.go @@ -10,6 +10,8 @@ package devops_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/response_meta.go b/api/devops/devops_models/response_meta.go index 26cbfed..4c79786 100644 --- a/api/devops/devops_models/response_meta.go +++ b/api/devops/devops_models/response_meta.go @@ -10,6 +10,8 @@ package devops_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/role.go b/api/devops/devops_models/role.go index b6fbabe..d7b6970 100644 --- a/api/devops/devops_models/role.go +++ b/api/devops/devops_models/role.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -52,6 +54,11 @@ func (m *Role) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this role based on context it is used +func (m *Role) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Role) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/role_request.go b/api/devops/devops_models/role_request.go index 8dda6fb..ca50a0d 100644 --- a/api/devops/devops_models/role_request.go +++ b/api/devops/devops_models/role_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *RoleRequest) Validate(formats strfmt.Registry) error { } func (m *RoleRequest) validateDate(formats strfmt.Registry) error { - if swag.IsZero(m.Date) { // not required return nil } @@ -65,6 +65,38 @@ func (m *RoleRequest) validateDate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this role request based on the context it is used +func (m *RoleRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RoleRequest) contextValidateDate(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Date); i++ { + + if m.Date[i] != nil { + if err := m.Date[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Date" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *RoleRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/role_response.go b/api/devops/devops_models/role_response.go index 985fe85..912886f 100644 --- a/api/devops/devops_models/role_response.go +++ b/api/devops/devops_models/role_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *RoleResponse) Validate(formats strfmt.Registry) error { } func (m *RoleResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *RoleResponse) validateData(formats strfmt.Registry) error { } func (m *RoleResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *RoleResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this role response based on the context it is used +func (m *RoleResponse) 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 *RoleResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RoleResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *RoleResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/service.go b/api/devops/devops_models/service.go index 70dc7e9..abb7bce 100644 --- a/api/devops/devops_models/service.go +++ b/api/devops/devops_models/service.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -94,6 +96,11 @@ func (m *Service) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service based on context it is used +func (m *Service) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Service) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/service_request.go b/api/devops/devops_models/service_request.go index d575380..e59288b 100644 --- a/api/devops/devops_models/service_request.go +++ b/api/devops/devops_models/service_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *ServiceRequest) Validate(formats strfmt.Registry) error { } func (m *ServiceRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *ServiceRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this service request based on the context it is used +func (m *ServiceRequest) 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 *ServiceRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/service_response.go b/api/devops/devops_models/service_response.go index 83df5c7..f0371f6 100644 --- a/api/devops/devops_models/service_response.go +++ b/api/devops/devops_models/service_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ServiceResponse) Validate(formats strfmt.Registry) error { } func (m *ServiceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ServiceResponse) validateData(formats strfmt.Registry) error { } func (m *ServiceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ServiceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this service response based on the context it is used +func (m *ServiceResponse) 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 *ServiceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ServiceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/template.go b/api/devops/devops_models/template.go index 83ee68d..c93a2d3 100644 --- a/api/devops/devops_models/template.go +++ b/api/devops/devops_models/template.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -74,6 +76,11 @@ func (m *Template) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this template based on context it is used +func (m *Template) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Template) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/template_request.go b/api/devops/devops_models/template_request.go index 389d33b..3c1684d 100644 --- a/api/devops/devops_models/template_request.go +++ b/api/devops/devops_models/template_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *TemplateRequest) Validate(formats strfmt.Registry) error { } func (m *TemplateRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *TemplateRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this template request based on the context it is used +func (m *TemplateRequest) 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 *TemplateRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TemplateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/template_response.go b/api/devops/devops_models/template_response.go index eaf5acb..dbc9d90 100644 --- a/api/devops/devops_models/template_response.go +++ b/api/devops/devops_models/template_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TemplateResponse) Validate(formats strfmt.Registry) error { } func (m *TemplateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TemplateResponse) validateData(formats strfmt.Registry) error { } func (m *TemplateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TemplateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this template response based on the context it is used +func (m *TemplateResponse) 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 *TemplateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TemplateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TemplateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/tenant.go b/api/devops/devops_models/tenant.go index d9e1010..ed2140f 100644 --- a/api/devops/devops_models/tenant.go +++ b/api/devops/devops_models/tenant.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -88,7 +89,6 @@ func (m *Tenant) Validate(formats strfmt.Registry) error { } func (m *Tenant) validateDatabases(formats strfmt.Registry) error { - if swag.IsZero(m.Databases) { // not required return nil } @@ -113,7 +113,6 @@ func (m *Tenant) validateDatabases(formats strfmt.Registry) error { } func (m *Tenant) validateRoles(formats strfmt.Registry) error { - if swag.IsZero(m.Roles) { // not required return nil } @@ -138,7 +137,6 @@ func (m *Tenant) validateRoles(formats strfmt.Registry) error { } func (m *Tenant) validateTenantUsers(formats strfmt.Registry) error { - if swag.IsZero(m.TenantUsers) { // not required return nil } @@ -162,6 +160,82 @@ func (m *Tenant) validateTenantUsers(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant based on the context it is used +func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDatabases(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRoles(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTenantUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Tenant) contextValidateDatabases(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Databases); i++ { + + if m.Databases[i] != nil { + if err := m.Databases[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Databases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidateRoles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Roles); i++ { + + if m.Roles[i] != nil { + if err := m.Roles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Roles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TenantUsers); i++ { + + if m.TenantUsers[i] != nil { + if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Tenant) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/tenant_request.go b/api/devops/devops_models/tenant_request.go index 012d906..a152d37 100644 --- a/api/devops/devops_models/tenant_request.go +++ b/api/devops/devops_models/tenant_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *TenantRequest) Validate(formats strfmt.Registry) error { } func (m *TenantRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *TenantRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant request based on the context it is used +func (m *TenantRequest) 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 *TenantRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TenantRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/tenant_response.go b/api/devops/devops_models/tenant_response.go index b481416..5e6bb78 100644 --- a/api/devops/devops_models/tenant_response.go +++ b/api/devops/devops_models/tenant_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TenantResponse) Validate(formats strfmt.Registry) error { } func (m *TenantResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TenantResponse) validateData(formats strfmt.Registry) error { } func (m *TenantResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TenantResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant response based on the context it is used +func (m *TenantResponse) 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 *TenantResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TenantResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TenantResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/tenant_user.go b/api/devops/devops_models/tenant_user.go index fa1a3e5..ed231bb 100644 --- a/api/devops/devops_models/tenant_user.go +++ b/api/devops/devops_models/tenant_user.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -73,6 +75,11 @@ func (m *TenantUser) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant user based on context it is used +func (m *TenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantUser) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/user.go b/api/devops/devops_models/user.go index 5f3b098..ba42b80 100644 --- a/api/devops/devops_models/user.go +++ b/api/devops/devops_models/user.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -220,7 +221,6 @@ func (m *User) Validate(formats strfmt.Registry) error { } func (m *User) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -238,7 +238,6 @@ func (m *User) validateAddress(formats strfmt.Registry) error { } func (m *User) validateTenantUsers(formats strfmt.Registry) error { - if swag.IsZero(m.TenantUsers) { // not required return nil } @@ -263,7 +262,6 @@ func (m *User) validateTenantUsers(formats strfmt.Registry) error { } func (m *User) validateUserRoles(formats strfmt.Registry) error { - if swag.IsZero(m.UserRoles) { // not required return nil } @@ -287,6 +285,78 @@ func (m *User) validateUserRoles(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user based on the context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTenantUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserRoles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Address") + } + return err + } + } + + return nil +} + +func (m *User) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TenantUsers); i++ { + + if m.TenantUsers[i] != nil { + if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *User) contextValidateUserRoles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.UserRoles); i++ { + + if m.UserRoles[i] != nil { + if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *User) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/user_request.go b/api/devops/devops_models/user_request.go index dfbe7b0..0b1b386 100644 --- a/api/devops/devops_models/user_request.go +++ b/api/devops/devops_models/user_request.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *UserRequest) Validate(formats strfmt.Registry) error { } func (m *UserRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *UserRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user request based on the context it is used +func (m *UserRequest) 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 *UserRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *UserRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/user_response.go b/api/devops/devops_models/user_response.go index 47356bf..80deaed 100644 --- a/api/devops/devops_models/user_response.go +++ b/api/devops/devops_models/user_response.go @@ -10,6 +10,7 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *UserResponse) Validate(formats strfmt.Registry) error { } func (m *UserResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *UserResponse) validateData(formats strfmt.Registry) error { } func (m *UserResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *UserResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user response based on the context it is used +func (m *UserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *UserResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/devops/devops_models/user_role.go b/api/devops/devops_models/user_role.go index be794a8..b39e58c 100644 --- a/api/devops/devops_models/user_role.go +++ b/api/devops/devops_models/user_role.go @@ -10,6 +10,8 @@ package devops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -64,6 +66,11 @@ func (m *UserRole) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user role based on context it is used +func (m *UserRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserRole) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_client/coordinate/coordinate_client.go b/api/geo/geo_client/coordinate/coordinate_client.go index af4acff..041b706 100644 --- a/api/geo/geo_client/coordinate/coordinate_client.go +++ b/api/geo/geo_client/coordinate/coordinate_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - DeleteCoordinate(params *DeleteCoordinateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCoordinateOK, error) + DeleteCoordinate(params *DeleteCoordinateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCoordinateOK, error) - GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateBasicOK, error) + GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinateBasicOK, error) - GetCoordinateObservable(params *GetCoordinateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateObservableOK, error) + GetCoordinateObservable(params *GetCoordinateObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinateObservableOK, error) - GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinatesOK, error) + GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinatesOK, error) - PostCoordinates(params *PostCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCoordinatesOK, error) + PostCoordinates(params *PostCoordinatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoordinatesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Delete a Taxneuxs Coordinate record from the Coordinate database */ -func (a *Client) DeleteCoordinate(params *DeleteCoordinateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCoordinateOK, error) { +func (a *Client) DeleteCoordinate(params *DeleteCoordinateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCoordinateOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteCoordinateParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteCoordinate", Method: "DELETE", PathPattern: "/coordinates", @@ -67,7 +69,12 @@ func (a *Client) DeleteCoordinate(params *DeleteCoordinateParams, authInfo runti 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 } @@ -86,13 +93,12 @@ func (a *Client) DeleteCoordinate(params *DeleteCoordinateParams, authInfo runti Response is one minimized Coordinate record including Tax Type IDs */ -func (a *Client) GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateBasicOK, error) { +func (a *Client) GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinateBasicOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCoordinateBasicParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCoordinateBasic", Method: "GET", PathPattern: "/coordinates/basic", @@ -104,7 +110,12 @@ func (a *Client) GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo r 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 } @@ -123,13 +134,12 @@ func (a *Client) GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo r Response is one minimized Coordinate record including Tax Type IDs as an observable array */ -func (a *Client) GetCoordinateObservable(params *GetCoordinateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateObservableOK, error) { +func (a *Client) GetCoordinateObservable(params *GetCoordinateObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinateObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCoordinateObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCoordinateObservable", Method: "GET", PathPattern: "/coordinates/observable", @@ -141,7 +151,12 @@ func (a *Client) GetCoordinateObservable(params *GetCoordinateObservableParams, 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 } @@ -160,13 +175,12 @@ func (a *Client) GetCoordinateObservable(params *GetCoordinateObservableParams, Return a fully-populated Coordinate record including Tax Type array */ -func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinatesOK, error) { +func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCoordinatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCoordinates", Method: "GET", PathPattern: "/coordinates", @@ -178,7 +192,12 @@ func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.C 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 } @@ -197,13 +216,12 @@ func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.C Processes a batch of Coordinate GET requests and returns an array of Coordinate records including Tax Type IDs */ -func (a *Client) PostCoordinates(params *PostCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCoordinatesOK, error) { +func (a *Client) PostCoordinates(params *PostCoordinatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoordinatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCoordinatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCoordinates", Method: "POST", PathPattern: "/coordinates", @@ -215,7 +233,12 @@ func (a *Client) PostCoordinates(params *PostCoordinatesParams, authInfo runtime 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 } diff --git a/api/geo/geo_client/coordinate/delete_coordinate_parameters.go b/api/geo/geo_client/coordinate/delete_coordinate_parameters.go index 7465daf..f9dd535 100644 --- a/api/geo/geo_client/coordinate/delete_coordinate_parameters.go +++ b/api/geo/geo_client/coordinate/delete_coordinate_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteCoordinateParams creates a new DeleteCoordinateParams object -// with the default values initialized. +// NewDeleteCoordinateParams creates a new DeleteCoordinateParams 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 NewDeleteCoordinateParams() *DeleteCoordinateParams { - var () return &DeleteCoordinateParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteCoordinateParamsWithTimeout creates a new DeleteCoordinateParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteCoordinateParamsWithTimeout(timeout time.Duration) *DeleteCoordinateParams { - var () return &DeleteCoordinateParams{ - timeout: timeout, } } // NewDeleteCoordinateParamsWithContext creates a new DeleteCoordinateParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteCoordinateParamsWithContext(ctx context.Context) *DeleteCoordinateParams { - var () return &DeleteCoordinateParams{ - Context: ctx, } } // NewDeleteCoordinateParamsWithHTTPClient creates a new DeleteCoordinateParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteCoordinateParamsWithHTTPClient(client *http.Client) *DeleteCoordinateParams { - var () return &DeleteCoordinateParams{ HTTPClient: client, } } -/*DeleteCoordinateParams contains all the parameters to send to the API endpoint -for the delete coordinate operation typically these are written to a http.Request +/* DeleteCoordinateParams contains all the parameters to send to the API endpoint + for the delete coordinate operation. + + Typically these are written to a http.Request. */ type DeleteCoordinateParams struct { - /*CoordinateID - Taxnexus Record Id of a Coordinate + /* CoordinateID. + Taxnexus Record Id of a Coordinate */ CoordinateID *string @@ -75,6 +74,21 @@ type DeleteCoordinateParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete coordinate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteCoordinateParams) WithDefaults() *DeleteCoordinateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete coordinate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteCoordinateParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete coordinate params func (o *DeleteCoordinateParams) WithTimeout(timeout time.Duration) *DeleteCoordinateParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteCoordinateParams) WriteToRequest(r runtime.ClientRequest, reg str // query param coordinateId var qrCoordinateID string + if o.CoordinateID != nil { qrCoordinateID = *o.CoordinateID } qCoordinateID := qrCoordinateID if qCoordinateID != "" { + if err := r.SetQueryParam("coordinateId", qCoordinateID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/coordinate/delete_coordinate_responses.go b/api/geo/geo_client/coordinate/delete_coordinate_responses.go index ec480a6..76d93f2 100644 --- a/api/geo/geo_client/coordinate/delete_coordinate_responses.go +++ b/api/geo/geo_client/coordinate/delete_coordinate_responses.go @@ -63,9 +63,8 @@ func (o *DeleteCoordinateReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewDeleteCoordinateOK() *DeleteCoordinateOK { return &DeleteCoordinateOK{} } -/*DeleteCoordinateOK handles this case with default header values. +/* DeleteCoordinateOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ type DeleteCoordinateOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.DeleteResponse } @@ -89,18 +87,25 @@ type DeleteCoordinateOK struct { func (o *DeleteCoordinateOK) Error() string { return fmt.Sprintf("[DELETE /coordinates][%d] deleteCoordinateOK %+v", 200, o.Payload) } - func (o *DeleteCoordinateOK) GetPayload() *geo_models.DeleteResponse { return o.Payload } func (o *DeleteCoordinateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.DeleteResponse) @@ -117,7 +122,7 @@ func NewDeleteCoordinateUnauthorized() *DeleteCoordinateUnauthorized { return &DeleteCoordinateUnauthorized{} } -/*DeleteCoordinateUnauthorized handles this case with default header values. +/* DeleteCoordinateUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type DeleteCoordinateUnauthorized struct { func (o *DeleteCoordinateUnauthorized) Error() string { return fmt.Sprintf("[DELETE /coordinates][%d] deleteCoordinateUnauthorized %+v", 401, o.Payload) } - func (o *DeleteCoordinateUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *DeleteCoordinateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewDeleteCoordinateForbidden() *DeleteCoordinateForbidden { return &DeleteCoordinateForbidden{} } -/*DeleteCoordinateForbidden handles this case with default header values. +/* DeleteCoordinateForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type DeleteCoordinateForbidden struct { func (o *DeleteCoordinateForbidden) Error() string { return fmt.Sprintf("[DELETE /coordinates][%d] deleteCoordinateForbidden %+v", 403, o.Payload) } - func (o *DeleteCoordinateForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *DeleteCoordinateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewDeleteCoordinateNotFound() *DeleteCoordinateNotFound { return &DeleteCoordinateNotFound{} } -/*DeleteCoordinateNotFound handles this case with default header values. +/* DeleteCoordinateNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type DeleteCoordinateNotFound struct { func (o *DeleteCoordinateNotFound) Error() string { return fmt.Sprintf("[DELETE /coordinates][%d] deleteCoordinateNotFound %+v", 404, o.Payload) } - func (o *DeleteCoordinateNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *DeleteCoordinateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewDeleteCoordinateUnprocessableEntity() *DeleteCoordinateUnprocessableEnti return &DeleteCoordinateUnprocessableEntity{} } -/*DeleteCoordinateUnprocessableEntity handles this case with default header values. +/* DeleteCoordinateUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type DeleteCoordinateUnprocessableEntity struct { func (o *DeleteCoordinateUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /coordinates][%d] deleteCoordinateUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteCoordinateUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *DeleteCoordinateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewDeleteCoordinateInternalServerError() *DeleteCoordinateInternalServerErr return &DeleteCoordinateInternalServerError{} } -/*DeleteCoordinateInternalServerError handles this case with default header values. +/* DeleteCoordinateInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type DeleteCoordinateInternalServerError struct { func (o *DeleteCoordinateInternalServerError) Error() string { return fmt.Sprintf("[DELETE /coordinates][%d] deleteCoordinateInternalServerError %+v", 500, o.Payload) } - func (o *DeleteCoordinateInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *DeleteCoordinateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/coordinate/get_coordinate_basic_parameters.go b/api/geo/geo_client/coordinate/get_coordinate_basic_parameters.go index 1c99cbf..f7aa81e 100644 --- a/api/geo/geo_client/coordinate/get_coordinate_basic_parameters.go +++ b/api/geo/geo_client/coordinate/get_coordinate_basic_parameters.go @@ -20,73 +20,76 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCoordinateBasicParams creates a new GetCoordinateBasicParams object -// with the default values initialized. +// NewGetCoordinateBasicParams creates a new GetCoordinateBasicParams 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 NewGetCoordinateBasicParams() *GetCoordinateBasicParams { - var () return &GetCoordinateBasicParams{ - timeout: cr.DefaultTimeout, } } // NewGetCoordinateBasicParamsWithTimeout creates a new GetCoordinateBasicParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCoordinateBasicParamsWithTimeout(timeout time.Duration) *GetCoordinateBasicParams { - var () return &GetCoordinateBasicParams{ - timeout: timeout, } } // NewGetCoordinateBasicParamsWithContext creates a new GetCoordinateBasicParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCoordinateBasicParamsWithContext(ctx context.Context) *GetCoordinateBasicParams { - var () return &GetCoordinateBasicParams{ - Context: ctx, } } // NewGetCoordinateBasicParamsWithHTTPClient creates a new GetCoordinateBasicParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCoordinateBasicParamsWithHTTPClient(client *http.Client) *GetCoordinateBasicParams { - var () return &GetCoordinateBasicParams{ HTTPClient: client, } } -/*GetCoordinateBasicParams contains all the parameters to send to the API endpoint -for the get coordinate basic operation typically these are written to a http.Request +/* GetCoordinateBasicParams contains all the parameters to send to the API endpoint + for the get coordinate basic operation. + + Typically these are written to a http.Request. */ type GetCoordinateBasicParams struct { - /*Address - Postal Address URL encoded; partial addresses allowed + /* Address. + Postal Address URL encoded; partial addresses allowed */ Address *string - /*CoordinateID - Taxnexus Record Id of a Coordinate + /* CoordinateID. + + Taxnexus Record Id of a Coordinate */ CoordinateID *string - /*Date - Transaction date (defaults to current) + /* Date. + + Transaction date (defaults to current) */ Date *string - /*PlaceName - Alternate City, ST format to backup addressQuery + /* PlaceName. + + Alternate City, ST format to backup addressQuery */ PlaceName *string - /*Ref - Source system reference + /* Ref. + + Source system reference */ Ref *string @@ -95,6 +98,21 @@ type GetCoordinateBasicParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get coordinate basic params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinateBasicParams) WithDefaults() *GetCoordinateBasicParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get coordinate basic params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinateBasicParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get coordinate basic params func (o *GetCoordinateBasicParams) WithTimeout(timeout time.Duration) *GetCoordinateBasicParams { o.SetTimeout(timeout) @@ -195,80 +213,85 @@ func (o *GetCoordinateBasicParams) WriteToRequest(r runtime.ClientRequest, reg s // query param address var qrAddress string + if o.Address != nil { qrAddress = *o.Address } qAddress := qrAddress if qAddress != "" { + if err := r.SetQueryParam("address", qAddress); err != nil { return err } } - } if o.CoordinateID != nil { // query param coordinateId var qrCoordinateID string + if o.CoordinateID != nil { qrCoordinateID = *o.CoordinateID } qCoordinateID := qrCoordinateID if qCoordinateID != "" { + if err := r.SetQueryParam("coordinateId", qCoordinateID); err != nil { return err } } - } if o.Date != nil { // query param date var qrDate string + if o.Date != nil { qrDate = *o.Date } qDate := qrDate if qDate != "" { + if err := r.SetQueryParam("date", qDate); err != nil { return err } } - } if o.PlaceName != nil { // query param placeName var qrPlaceName string + if o.PlaceName != nil { qrPlaceName = *o.PlaceName } qPlaceName := qrPlaceName if qPlaceName != "" { + if err := r.SetQueryParam("placeName", qPlaceName); err != nil { return err } } - } if o.Ref != nil { // query param ref var qrRef string + if o.Ref != nil { qrRef = *o.Ref } qRef := qrRef if qRef != "" { + if err := r.SetQueryParam("ref", qRef); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/coordinate/get_coordinate_basic_responses.go b/api/geo/geo_client/coordinate/get_coordinate_basic_responses.go index 2f138bf..da0b937 100644 --- a/api/geo/geo_client/coordinate/get_coordinate_basic_responses.go +++ b/api/geo/geo_client/coordinate/get_coordinate_basic_responses.go @@ -63,9 +63,8 @@ func (o *GetCoordinateBasicReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCoordinateBasicOK() *GetCoordinateBasicOK { return &GetCoordinateBasicOK{} } -/*GetCoordinateBasicOK handles this case with default header values. +/* GetCoordinateBasicOK describes a response with status code 200, with default header values. Taxnexus Response with an array of basic Coordinate objects */ type GetCoordinateBasicOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.CoordinateBasicResponse } @@ -89,18 +87,25 @@ type GetCoordinateBasicOK struct { func (o *GetCoordinateBasicOK) Error() string { return fmt.Sprintf("[GET /coordinates/basic][%d] getCoordinateBasicOK %+v", 200, o.Payload) } - func (o *GetCoordinateBasicOK) GetPayload() *geo_models.CoordinateBasicResponse { return o.Payload } func (o *GetCoordinateBasicOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.CoordinateBasicResponse) @@ -117,7 +122,7 @@ func NewGetCoordinateBasicUnauthorized() *GetCoordinateBasicUnauthorized { return &GetCoordinateBasicUnauthorized{} } -/*GetCoordinateBasicUnauthorized handles this case with default header values. +/* GetCoordinateBasicUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetCoordinateBasicUnauthorized struct { func (o *GetCoordinateBasicUnauthorized) Error() string { return fmt.Sprintf("[GET /coordinates/basic][%d] getCoordinateBasicUnauthorized %+v", 401, o.Payload) } - func (o *GetCoordinateBasicUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateBasicUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetCoordinateBasicForbidden() *GetCoordinateBasicForbidden { return &GetCoordinateBasicForbidden{} } -/*GetCoordinateBasicForbidden handles this case with default header values. +/* GetCoordinateBasicForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetCoordinateBasicForbidden struct { func (o *GetCoordinateBasicForbidden) Error() string { return fmt.Sprintf("[GET /coordinates/basic][%d] getCoordinateBasicForbidden %+v", 403, o.Payload) } - func (o *GetCoordinateBasicForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateBasicForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetCoordinateBasicNotFound() *GetCoordinateBasicNotFound { return &GetCoordinateBasicNotFound{} } -/*GetCoordinateBasicNotFound handles this case with default header values. +/* GetCoordinateBasicNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetCoordinateBasicNotFound struct { func (o *GetCoordinateBasicNotFound) Error() string { return fmt.Sprintf("[GET /coordinates/basic][%d] getCoordinateBasicNotFound %+v", 404, o.Payload) } - func (o *GetCoordinateBasicNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateBasicNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetCoordinateBasicUnprocessableEntity() *GetCoordinateBasicUnprocessable return &GetCoordinateBasicUnprocessableEntity{} } -/*GetCoordinateBasicUnprocessableEntity handles this case with default header values. +/* GetCoordinateBasicUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetCoordinateBasicUnprocessableEntity struct { func (o *GetCoordinateBasicUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /coordinates/basic][%d] getCoordinateBasicUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCoordinateBasicUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateBasicUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetCoordinateBasicInternalServerError() *GetCoordinateBasicInternalServe return &GetCoordinateBasicInternalServerError{} } -/*GetCoordinateBasicInternalServerError handles this case with default header values. +/* GetCoordinateBasicInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetCoordinateBasicInternalServerError struct { func (o *GetCoordinateBasicInternalServerError) Error() string { return fmt.Sprintf("[GET /coordinates/basic][%d] getCoordinateBasicInternalServerError %+v", 500, o.Payload) } - func (o *GetCoordinateBasicInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateBasicInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/coordinate/get_coordinate_observable_parameters.go b/api/geo/geo_client/coordinate/get_coordinate_observable_parameters.go index 59b12b8..7b5b961 100644 --- a/api/geo/geo_client/coordinate/get_coordinate_observable_parameters.go +++ b/api/geo/geo_client/coordinate/get_coordinate_observable_parameters.go @@ -20,73 +20,76 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCoordinateObservableParams creates a new GetCoordinateObservableParams object -// with the default values initialized. +// NewGetCoordinateObservableParams creates a new GetCoordinateObservableParams 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 NewGetCoordinateObservableParams() *GetCoordinateObservableParams { - var () return &GetCoordinateObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetCoordinateObservableParamsWithTimeout creates a new GetCoordinateObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCoordinateObservableParamsWithTimeout(timeout time.Duration) *GetCoordinateObservableParams { - var () return &GetCoordinateObservableParams{ - timeout: timeout, } } // NewGetCoordinateObservableParamsWithContext creates a new GetCoordinateObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCoordinateObservableParamsWithContext(ctx context.Context) *GetCoordinateObservableParams { - var () return &GetCoordinateObservableParams{ - Context: ctx, } } // NewGetCoordinateObservableParamsWithHTTPClient creates a new GetCoordinateObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCoordinateObservableParamsWithHTTPClient(client *http.Client) *GetCoordinateObservableParams { - var () return &GetCoordinateObservableParams{ HTTPClient: client, } } -/*GetCoordinateObservableParams contains all the parameters to send to the API endpoint -for the get coordinate observable operation typically these are written to a http.Request +/* GetCoordinateObservableParams contains all the parameters to send to the API endpoint + for the get coordinate observable operation. + + Typically these are written to a http.Request. */ type GetCoordinateObservableParams struct { - /*Address - Postal Address URL encoded; partial addresses allowed + /* Address. + Postal Address URL encoded; partial addresses allowed */ Address *string - /*CoordinateID - Taxnexus Record Id of a Coordinate + /* CoordinateID. + + Taxnexus Record Id of a Coordinate */ CoordinateID *string - /*Date - Transaction date (defaults to current) + /* Date. + + Transaction date (defaults to current) */ Date *string - /*PlaceName - Alternate City, ST format to backup addressQuery + /* PlaceName. + + Alternate City, ST format to backup addressQuery */ PlaceName *string - /*Ref - Source system reference + /* Ref. + + Source system reference */ Ref *string @@ -95,6 +98,21 @@ type GetCoordinateObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get coordinate observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinateObservableParams) WithDefaults() *GetCoordinateObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get coordinate observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinateObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get coordinate observable params func (o *GetCoordinateObservableParams) WithTimeout(timeout time.Duration) *GetCoordinateObservableParams { o.SetTimeout(timeout) @@ -195,80 +213,85 @@ func (o *GetCoordinateObservableParams) WriteToRequest(r runtime.ClientRequest, // query param address var qrAddress string + if o.Address != nil { qrAddress = *o.Address } qAddress := qrAddress if qAddress != "" { + if err := r.SetQueryParam("address", qAddress); err != nil { return err } } - } if o.CoordinateID != nil { // query param coordinateId var qrCoordinateID string + if o.CoordinateID != nil { qrCoordinateID = *o.CoordinateID } qCoordinateID := qrCoordinateID if qCoordinateID != "" { + if err := r.SetQueryParam("coordinateId", qCoordinateID); err != nil { return err } } - } if o.Date != nil { // query param date var qrDate string + if o.Date != nil { qrDate = *o.Date } qDate := qrDate if qDate != "" { + if err := r.SetQueryParam("date", qDate); err != nil { return err } } - } if o.PlaceName != nil { // query param placeName var qrPlaceName string + if o.PlaceName != nil { qrPlaceName = *o.PlaceName } qPlaceName := qrPlaceName if qPlaceName != "" { + if err := r.SetQueryParam("placeName", qPlaceName); err != nil { return err } } - } if o.Ref != nil { // query param ref var qrRef string + if o.Ref != nil { qrRef = *o.Ref } qRef := qrRef if qRef != "" { + if err := r.SetQueryParam("ref", qRef); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/coordinate/get_coordinate_observable_responses.go b/api/geo/geo_client/coordinate/get_coordinate_observable_responses.go index 39d1e69..8ce32de 100644 --- a/api/geo/geo_client/coordinate/get_coordinate_observable_responses.go +++ b/api/geo/geo_client/coordinate/get_coordinate_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetCoordinateObservableReader) ReadResponse(response runtime.ClientResp return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCoordinateObservableOK() *GetCoordinateObservableOK { return &GetCoordinateObservableOK{} } -/*GetCoordinateObservableOK handles this case with default header values. +/* GetCoordinateObservableOK describes a response with status code 200, with default header values. Taxnexus Response with an array of basic Coordinate objects */ type GetCoordinateObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.Coordinate } @@ -89,18 +87,25 @@ type GetCoordinateObservableOK struct { func (o *GetCoordinateObservableOK) Error() string { return fmt.Sprintf("[GET /coordinates/observable][%d] getCoordinateObservableOK %+v", 200, o.Payload) } - func (o *GetCoordinateObservableOK) GetPayload() []*geo_models.Coordinate { return o.Payload } func (o *GetCoordinateObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetCoordinateObservableUnauthorized() *GetCoordinateObservableUnauthoriz return &GetCoordinateObservableUnauthorized{} } -/*GetCoordinateObservableUnauthorized handles this case with default header values. +/* GetCoordinateObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetCoordinateObservableUnauthorized struct { func (o *GetCoordinateObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /coordinates/observable][%d] getCoordinateObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetCoordinateObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetCoordinateObservableForbidden() *GetCoordinateObservableForbidden { return &GetCoordinateObservableForbidden{} } -/*GetCoordinateObservableForbidden handles this case with default header values. +/* GetCoordinateObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetCoordinateObservableForbidden struct { func (o *GetCoordinateObservableForbidden) Error() string { return fmt.Sprintf("[GET /coordinates/observable][%d] getCoordinateObservableForbidden %+v", 403, o.Payload) } - func (o *GetCoordinateObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetCoordinateObservableNotFound() *GetCoordinateObservableNotFound { return &GetCoordinateObservableNotFound{} } -/*GetCoordinateObservableNotFound handles this case with default header values. +/* GetCoordinateObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetCoordinateObservableNotFound struct { func (o *GetCoordinateObservableNotFound) Error() string { return fmt.Sprintf("[GET /coordinates/observable][%d] getCoordinateObservableNotFound %+v", 404, o.Payload) } - func (o *GetCoordinateObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetCoordinateObservableUnprocessableEntity() *GetCoordinateObservableUnp return &GetCoordinateObservableUnprocessableEntity{} } -/*GetCoordinateObservableUnprocessableEntity handles this case with default header values. +/* GetCoordinateObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetCoordinateObservableUnprocessableEntity struct { func (o *GetCoordinateObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /coordinates/observable][%d] getCoordinateObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCoordinateObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetCoordinateObservableInternalServerError() *GetCoordinateObservableInt return &GetCoordinateObservableInternalServerError{} } -/*GetCoordinateObservableInternalServerError handles this case with default header values. +/* GetCoordinateObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetCoordinateObservableInternalServerError struct { func (o *GetCoordinateObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /coordinates/observable][%d] getCoordinateObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetCoordinateObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinateObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/coordinate/get_coordinates_parameters.go b/api/geo/geo_client/coordinate/get_coordinates_parameters.go index 877e07e..59edbbb 100644 --- a/api/geo/geo_client/coordinate/get_coordinates_parameters.go +++ b/api/geo/geo_client/coordinate/get_coordinates_parameters.go @@ -20,73 +20,76 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCoordinatesParams creates a new GetCoordinatesParams object -// with the default values initialized. +// NewGetCoordinatesParams creates a new GetCoordinatesParams 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 NewGetCoordinatesParams() *GetCoordinatesParams { - var () return &GetCoordinatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCoordinatesParamsWithTimeout creates a new GetCoordinatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCoordinatesParamsWithTimeout(timeout time.Duration) *GetCoordinatesParams { - var () return &GetCoordinatesParams{ - timeout: timeout, } } // NewGetCoordinatesParamsWithContext creates a new GetCoordinatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCoordinatesParamsWithContext(ctx context.Context) *GetCoordinatesParams { - var () return &GetCoordinatesParams{ - Context: ctx, } } // NewGetCoordinatesParamsWithHTTPClient creates a new GetCoordinatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCoordinatesParamsWithHTTPClient(client *http.Client) *GetCoordinatesParams { - var () return &GetCoordinatesParams{ HTTPClient: client, } } -/*GetCoordinatesParams contains all the parameters to send to the API endpoint -for the get coordinates operation typically these are written to a http.Request +/* GetCoordinatesParams contains all the parameters to send to the API endpoint + for the get coordinates operation. + + Typically these are written to a http.Request. */ type GetCoordinatesParams struct { - /*Address - Postal Address URL encoded; partial addresses allowed + /* Address. + Postal Address URL encoded; partial addresses allowed */ Address *string - /*CoordinateID - Taxnexus Record Id of a Coordinate + /* CoordinateID. + + Taxnexus Record Id of a Coordinate */ CoordinateID *string - /*Date - Transaction date (defaults to current) + /* Date. + + Transaction date (defaults to current) */ Date *string - /*PlaceName - Alternate City, ST format to backup addressQuery + /* PlaceName. + + Alternate City, ST format to backup addressQuery */ PlaceName *string - /*Ref - Source system reference + /* Ref. + + Source system reference */ Ref *string @@ -95,6 +98,21 @@ type GetCoordinatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get coordinates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesParams) WithDefaults() *GetCoordinatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get coordinates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get coordinates params func (o *GetCoordinatesParams) WithTimeout(timeout time.Duration) *GetCoordinatesParams { o.SetTimeout(timeout) @@ -195,80 +213,85 @@ func (o *GetCoordinatesParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param address var qrAddress string + if o.Address != nil { qrAddress = *o.Address } qAddress := qrAddress if qAddress != "" { + if err := r.SetQueryParam("address", qAddress); err != nil { return err } } - } if o.CoordinateID != nil { // query param coordinateId var qrCoordinateID string + if o.CoordinateID != nil { qrCoordinateID = *o.CoordinateID } qCoordinateID := qrCoordinateID if qCoordinateID != "" { + if err := r.SetQueryParam("coordinateId", qCoordinateID); err != nil { return err } } - } if o.Date != nil { // query param date var qrDate string + if o.Date != nil { qrDate = *o.Date } qDate := qrDate if qDate != "" { + if err := r.SetQueryParam("date", qDate); err != nil { return err } } - } if o.PlaceName != nil { // query param placeName var qrPlaceName string + if o.PlaceName != nil { qrPlaceName = *o.PlaceName } qPlaceName := qrPlaceName if qPlaceName != "" { + if err := r.SetQueryParam("placeName", qPlaceName); err != nil { return err } } - } if o.Ref != nil { // query param ref var qrRef string + if o.Ref != nil { qrRef = *o.Ref } qRef := qrRef if qRef != "" { + if err := r.SetQueryParam("ref", qRef); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/coordinate/get_coordinates_responses.go b/api/geo/geo_client/coordinate/get_coordinates_responses.go index db36cf4..c624867 100644 --- a/api/geo/geo_client/coordinate/get_coordinates_responses.go +++ b/api/geo/geo_client/coordinate/get_coordinates_responses.go @@ -63,9 +63,8 @@ func (o *GetCoordinatesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCoordinatesOK() *GetCoordinatesOK { return &GetCoordinatesOK{} } -/*GetCoordinatesOK handles this case with default header values. +/* GetCoordinatesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Coordinate objects */ type GetCoordinatesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.CoordinateResponse } @@ -89,18 +87,25 @@ type GetCoordinatesOK struct { func (o *GetCoordinatesOK) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesOK %+v", 200, o.Payload) } - func (o *GetCoordinatesOK) GetPayload() *geo_models.CoordinateResponse { return o.Payload } func (o *GetCoordinatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.CoordinateResponse) @@ -117,7 +122,7 @@ func NewGetCoordinatesUnauthorized() *GetCoordinatesUnauthorized { return &GetCoordinatesUnauthorized{} } -/*GetCoordinatesUnauthorized handles this case with default header values. +/* GetCoordinatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetCoordinatesUnauthorized struct { func (o *GetCoordinatesUnauthorized) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesUnauthorized %+v", 401, o.Payload) } - func (o *GetCoordinatesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetCoordinatesForbidden() *GetCoordinatesForbidden { return &GetCoordinatesForbidden{} } -/*GetCoordinatesForbidden handles this case with default header values. +/* GetCoordinatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetCoordinatesForbidden struct { func (o *GetCoordinatesForbidden) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesForbidden %+v", 403, o.Payload) } - func (o *GetCoordinatesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetCoordinatesNotFound() *GetCoordinatesNotFound { return &GetCoordinatesNotFound{} } -/*GetCoordinatesNotFound handles this case with default header values. +/* GetCoordinatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetCoordinatesNotFound struct { func (o *GetCoordinatesNotFound) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesNotFound %+v", 404, o.Payload) } - func (o *GetCoordinatesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetCoordinatesUnprocessableEntity() *GetCoordinatesUnprocessableEntity { return &GetCoordinatesUnprocessableEntity{} } -/*GetCoordinatesUnprocessableEntity handles this case with default header values. +/* GetCoordinatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetCoordinatesUnprocessableEntity struct { func (o *GetCoordinatesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCoordinatesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetCoordinatesInternalServerError() *GetCoordinatesInternalServerError { return &GetCoordinatesInternalServerError{} } -/*GetCoordinatesInternalServerError handles this case with default header values. +/* GetCoordinatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetCoordinatesInternalServerError struct { func (o *GetCoordinatesInternalServerError) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesInternalServerError %+v", 500, o.Payload) } - func (o *GetCoordinatesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCoordinatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/coordinate/post_coordinates_parameters.go b/api/geo/geo_client/coordinate/post_coordinates_parameters.go index 393cccc..3ed37b8 100644 --- a/api/geo/geo_client/coordinate/post_coordinates_parameters.go +++ b/api/geo/geo_client/coordinate/post_coordinates_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostCoordinatesParams creates a new PostCoordinatesParams object -// with the default values initialized. +// NewPostCoordinatesParams creates a new PostCoordinatesParams 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 NewPostCoordinatesParams() *PostCoordinatesParams { - var () return &PostCoordinatesParams{ - timeout: cr.DefaultTimeout, } } // NewPostCoordinatesParamsWithTimeout creates a new PostCoordinatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCoordinatesParamsWithTimeout(timeout time.Duration) *PostCoordinatesParams { - var () return &PostCoordinatesParams{ - timeout: timeout, } } // NewPostCoordinatesParamsWithContext creates a new PostCoordinatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCoordinatesParamsWithContext(ctx context.Context) *PostCoordinatesParams { - var () return &PostCoordinatesParams{ - Context: ctx, } } // NewPostCoordinatesParamsWithHTTPClient creates a new PostCoordinatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCoordinatesParamsWithHTTPClient(client *http.Client) *PostCoordinatesParams { - var () return &PostCoordinatesParams{ HTTPClient: client, } } -/*PostCoordinatesParams contains all the parameters to send to the API endpoint -for the post coordinates operation typically these are written to a http.Request +/* PostCoordinatesParams contains all the parameters to send to the API endpoint + for the post coordinates operation. + + Typically these are written to a http.Request. */ type PostCoordinatesParams struct { - /*CoordinateRequest - An array of new Coordinate records + /* CoordinateRequest. + An array of new Coordinate records */ CoordinateRequest *geo_models.CoordinateRequest @@ -77,6 +76,21 @@ type PostCoordinatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post coordinates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCoordinatesParams) WithDefaults() *PostCoordinatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post coordinates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCoordinatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post coordinates params func (o *PostCoordinatesParams) WithTimeout(timeout time.Duration) *PostCoordinatesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostCoordinatesParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.CoordinateRequest != nil { if err := r.SetBodyParam(o.CoordinateRequest); err != nil { return err diff --git a/api/geo/geo_client/coordinate/post_coordinates_responses.go b/api/geo/geo_client/coordinate/post_coordinates_responses.go index bf74bd5..a55d059 100644 --- a/api/geo/geo_client/coordinate/post_coordinates_responses.go +++ b/api/geo/geo_client/coordinate/post_coordinates_responses.go @@ -63,9 +63,8 @@ func (o *PostCoordinatesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostCoordinatesOK() *PostCoordinatesOK { return &PostCoordinatesOK{} } -/*PostCoordinatesOK handles this case with default header values. +/* PostCoordinatesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Coordinate objects */ type PostCoordinatesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.CoordinateResponse } @@ -89,18 +87,25 @@ type PostCoordinatesOK struct { func (o *PostCoordinatesOK) Error() string { return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesOK %+v", 200, o.Payload) } - func (o *PostCoordinatesOK) GetPayload() *geo_models.CoordinateResponse { return o.Payload } func (o *PostCoordinatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.CoordinateResponse) @@ -117,7 +122,7 @@ func NewPostCoordinatesUnauthorized() *PostCoordinatesUnauthorized { return &PostCoordinatesUnauthorized{} } -/*PostCoordinatesUnauthorized handles this case with default header values. +/* PostCoordinatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostCoordinatesUnauthorized struct { func (o *PostCoordinatesUnauthorized) Error() string { return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesUnauthorized %+v", 401, o.Payload) } - func (o *PostCoordinatesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCoordinatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewPostCoordinatesForbidden() *PostCoordinatesForbidden { return &PostCoordinatesForbidden{} } -/*PostCoordinatesForbidden handles this case with default header values. +/* PostCoordinatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostCoordinatesForbidden struct { func (o *PostCoordinatesForbidden) Error() string { return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesForbidden %+v", 403, o.Payload) } - func (o *PostCoordinatesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCoordinatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewPostCoordinatesNotFound() *PostCoordinatesNotFound { return &PostCoordinatesNotFound{} } -/*PostCoordinatesNotFound handles this case with default header values. +/* PostCoordinatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostCoordinatesNotFound struct { func (o *PostCoordinatesNotFound) Error() string { return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesNotFound %+v", 404, o.Payload) } - func (o *PostCoordinatesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCoordinatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewPostCoordinatesUnprocessableEntity() *PostCoordinatesUnprocessableEntity return &PostCoordinatesUnprocessableEntity{} } -/*PostCoordinatesUnprocessableEntity handles this case with default header values. +/* PostCoordinatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostCoordinatesUnprocessableEntity struct { func (o *PostCoordinatesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostCoordinatesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCoordinatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewPostCoordinatesInternalServerError() *PostCoordinatesInternalServerError return &PostCoordinatesInternalServerError{} } -/*PostCoordinatesInternalServerError handles this case with default header values. +/* PostCoordinatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostCoordinatesInternalServerError struct { func (o *PostCoordinatesInternalServerError) Error() string { return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesInternalServerError %+v", 500, o.Payload) } - func (o *PostCoordinatesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCoordinatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/cors/cors_client.go b/api/geo/geo_client/cors/cors_client.go index a152102..9f29ddf 100644 --- a/api/geo/geo_client/cors/cors_client.go +++ b/api/geo/geo_client/cors/cors_client.go @@ -29,43 +29,46 @@ type Client struct { 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 { - GetCoordinatesObservableOptions(params *GetCoordinatesObservableOptionsParams) (*GetCoordinatesObservableOptionsOK, error) + GetCoordinatesObservableOptions(params *GetCoordinatesObservableOptionsParams, opts ...ClientOption) (*GetCoordinatesObservableOptionsOK, error) - GetCoordinatesOptions(params *GetCoordinatesOptionsParams) (*GetCoordinatesOptionsOK, error) + GetCoordinatesOptions(params *GetCoordinatesOptionsParams, opts ...ClientOption) (*GetCoordinatesOptionsOK, error) - GetCountiesObservableOptions(params *GetCountiesObservableOptionsParams) (*GetCountiesObservableOptionsOK, error) + GetCountiesObservableOptions(params *GetCountiesObservableOptionsParams, opts ...ClientOption) (*GetCountiesObservableOptionsOK, error) - GetCountiesOptions(params *GetCountiesOptionsParams) (*GetCountiesOptionsOK, error) + GetCountiesOptions(params *GetCountiesOptionsParams, opts ...ClientOption) (*GetCountiesOptionsOK, error) - GetCountriesObservableOptions(params *GetCountriesObservableOptionsParams) (*GetCountriesObservableOptionsOK, error) + GetCountriesObservableOptions(params *GetCountriesObservableOptionsParams, opts ...ClientOption) (*GetCountriesObservableOptionsOK, error) - GetCountriesOptions(params *GetCountriesOptionsParams) (*GetCountriesOptionsOK, error) + GetCountriesOptions(params *GetCountriesOptionsParams, opts ...ClientOption) (*GetCountriesOptionsOK, error) - GetDomainsObservableOptions(params *GetDomainsObservableOptionsParams) (*GetDomainsObservableOptionsOK, error) + GetDomainsObservableOptions(params *GetDomainsObservableOptionsParams, opts ...ClientOption) (*GetDomainsObservableOptionsOK, error) - GetDomainsOptions(params *GetDomainsOptionsParams) (*GetDomainsOptionsOK, error) + GetDomainsOptions(params *GetDomainsOptionsParams, opts ...ClientOption) (*GetDomainsOptionsOK, error) - GetPlacesObservableOptions(params *GetPlacesObservableOptionsParams) (*GetPlacesObservableOptionsOK, error) + GetPlacesObservableOptions(params *GetPlacesObservableOptionsParams, opts ...ClientOption) (*GetPlacesObservableOptionsOK, error) - GetPlacesOptions(params *GetPlacesOptionsParams) (*GetPlacesOptionsOK, error) + GetPlacesOptions(params *GetPlacesOptionsParams, opts ...ClientOption) (*GetPlacesOptionsOK, error) - GetStatesObservableOptions(params *GetStatesObservableOptionsParams) (*GetStatesObservableOptionsOK, error) + GetStatesObservableOptions(params *GetStatesObservableOptionsParams, opts ...ClientOption) (*GetStatesObservableOptionsOK, error) - GetStatesOptions(params *GetStatesOptionsParams) (*GetStatesOptionsOK, error) + GetStatesOptions(params *GetStatesOptionsParams, opts ...ClientOption) (*GetStatesOptionsOK, error) - GetTaxRateObservableOptions(params *GetTaxRateObservableOptionsParams) (*GetTaxRateObservableOptionsOK, error) + GetTaxRateObservableOptions(params *GetTaxRateObservableOptionsParams, opts ...ClientOption) (*GetTaxRateObservableOptionsOK, error) - GetTaxRatesOptions(params *GetTaxRatesOptionsParams) (*GetTaxRatesOptionsOK, error) + GetTaxRatesOptions(params *GetTaxRatesOptionsParams, opts ...ClientOption) (*GetTaxRatesOptionsOK, error) - GetTaxTypeObservableOptions(params *GetTaxTypeObservableOptionsParams) (*GetTaxTypeObservableOptionsOK, error) + GetTaxTypeObservableOptions(params *GetTaxTypeObservableOptionsParams, opts ...ClientOption) (*GetTaxTypeObservableOptionsOK, error) - GetTaxTypesOptions(params *GetTaxTypesOptionsParams) (*GetTaxTypesOptionsOK, error) + GetTaxTypesOptions(params *GetTaxTypesOptionsParams, opts ...ClientOption) (*GetTaxTypesOptionsOK, error) - GetTaxnexusCodesObservableOptions(params *GetTaxnexusCodesObservableOptionsParams) (*GetTaxnexusCodesObservableOptionsOK, error) + GetTaxnexusCodesObservableOptions(params *GetTaxnexusCodesObservableOptionsParams, opts ...ClientOption) (*GetTaxnexusCodesObservableOptionsOK, error) - GetTaxnexusCodesOptions(params *GetTaxnexusCodesOptionsParams) (*GetTaxnexusCodesOptionsOK, error) + GetTaxnexusCodesOptions(params *GetTaxnexusCodesOptionsParams, opts ...ClientOption) (*GetTaxnexusCodesOptionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -73,13 +76,12 @@ type ClientService interface { /* GetCoordinatesObservableOptions CORS support */ -func (a *Client) GetCoordinatesObservableOptions(params *GetCoordinatesObservableOptionsParams) (*GetCoordinatesObservableOptionsOK, error) { +func (a *Client) GetCoordinatesObservableOptions(params *GetCoordinatesObservableOptionsParams, opts ...ClientOption) (*GetCoordinatesObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCoordinatesObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCoordinatesObservableOptions", Method: "OPTIONS", PathPattern: "/coordinates/observable", @@ -90,7 +92,12 @@ func (a *Client) GetCoordinatesObservableOptions(params *GetCoordinatesObservabl Reader: &GetCoordinatesObservableOptionsReader{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 } @@ -107,13 +114,12 @@ func (a *Client) GetCoordinatesObservableOptions(params *GetCoordinatesObservabl /* GetCoordinatesOptions CORS support */ -func (a *Client) GetCoordinatesOptions(params *GetCoordinatesOptionsParams) (*GetCoordinatesOptionsOK, error) { +func (a *Client) GetCoordinatesOptions(params *GetCoordinatesOptionsParams, opts ...ClientOption) (*GetCoordinatesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCoordinatesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCoordinatesOptions", Method: "OPTIONS", PathPattern: "/coordinates", @@ -124,7 +130,12 @@ func (a *Client) GetCoordinatesOptions(params *GetCoordinatesOptionsParams) (*Ge Reader: &GetCoordinatesOptionsReader{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 } @@ -141,13 +152,12 @@ func (a *Client) GetCoordinatesOptions(params *GetCoordinatesOptionsParams) (*Ge /* GetCountiesObservableOptions CORS support */ -func (a *Client) GetCountiesObservableOptions(params *GetCountiesObservableOptionsParams) (*GetCountiesObservableOptionsOK, error) { +func (a *Client) GetCountiesObservableOptions(params *GetCountiesObservableOptionsParams, opts ...ClientOption) (*GetCountiesObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountiesObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountiesObservableOptions", Method: "OPTIONS", PathPattern: "/counties/observable", @@ -158,7 +168,12 @@ func (a *Client) GetCountiesObservableOptions(params *GetCountiesObservableOptio Reader: &GetCountiesObservableOptionsReader{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 } @@ -175,13 +190,12 @@ func (a *Client) GetCountiesObservableOptions(params *GetCountiesObservableOptio /* GetCountiesOptions CORS support */ -func (a *Client) GetCountiesOptions(params *GetCountiesOptionsParams) (*GetCountiesOptionsOK, error) { +func (a *Client) GetCountiesOptions(params *GetCountiesOptionsParams, opts ...ClientOption) (*GetCountiesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountiesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountiesOptions", Method: "OPTIONS", PathPattern: "/counties", @@ -192,7 +206,12 @@ func (a *Client) GetCountiesOptions(params *GetCountiesOptionsParams) (*GetCount Reader: &GetCountiesOptionsReader{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 } @@ -209,13 +228,12 @@ func (a *Client) GetCountiesOptions(params *GetCountiesOptionsParams) (*GetCount /* GetCountriesObservableOptions CORS support */ -func (a *Client) GetCountriesObservableOptions(params *GetCountriesObservableOptionsParams) (*GetCountriesObservableOptionsOK, error) { +func (a *Client) GetCountriesObservableOptions(params *GetCountriesObservableOptionsParams, opts ...ClientOption) (*GetCountriesObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountriesObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountriesObservableOptions", Method: "OPTIONS", PathPattern: "/countries/observable", @@ -226,7 +244,12 @@ func (a *Client) GetCountriesObservableOptions(params *GetCountriesObservableOpt Reader: &GetCountriesObservableOptionsReader{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 } @@ -243,13 +266,12 @@ func (a *Client) GetCountriesObservableOptions(params *GetCountriesObservableOpt /* GetCountriesOptions CORS support */ -func (a *Client) GetCountriesOptions(params *GetCountriesOptionsParams) (*GetCountriesOptionsOK, error) { +func (a *Client) GetCountriesOptions(params *GetCountriesOptionsParams, opts ...ClientOption) (*GetCountriesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountriesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountriesOptions", Method: "OPTIONS", PathPattern: "/countries", @@ -260,7 +282,12 @@ func (a *Client) GetCountriesOptions(params *GetCountriesOptionsParams) (*GetCou Reader: &GetCountriesOptionsReader{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 } @@ -277,13 +304,12 @@ func (a *Client) GetCountriesOptions(params *GetCountriesOptionsParams) (*GetCou /* GetDomainsObservableOptions CORS support */ -func (a *Client) GetDomainsObservableOptions(params *GetDomainsObservableOptionsParams) (*GetDomainsObservableOptionsOK, error) { +func (a *Client) GetDomainsObservableOptions(params *GetDomainsObservableOptionsParams, opts ...ClientOption) (*GetDomainsObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDomainsObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDomainsObservableOptions", Method: "OPTIONS", PathPattern: "/domains/observable", @@ -294,7 +320,12 @@ func (a *Client) GetDomainsObservableOptions(params *GetDomainsObservableOptions Reader: &GetDomainsObservableOptionsReader{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 } @@ -311,13 +342,12 @@ func (a *Client) GetDomainsObservableOptions(params *GetDomainsObservableOptions /* GetDomainsOptions CORS support */ -func (a *Client) GetDomainsOptions(params *GetDomainsOptionsParams) (*GetDomainsOptionsOK, error) { +func (a *Client) GetDomainsOptions(params *GetDomainsOptionsParams, opts ...ClientOption) (*GetDomainsOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDomainsOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDomainsOptions", Method: "OPTIONS", PathPattern: "/domains", @@ -328,7 +358,12 @@ func (a *Client) GetDomainsOptions(params *GetDomainsOptionsParams) (*GetDomains Reader: &GetDomainsOptionsReader{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 } @@ -345,13 +380,12 @@ func (a *Client) GetDomainsOptions(params *GetDomainsOptionsParams) (*GetDomains /* GetPlacesObservableOptions CORS support */ -func (a *Client) GetPlacesObservableOptions(params *GetPlacesObservableOptionsParams) (*GetPlacesObservableOptionsOK, error) { +func (a *Client) GetPlacesObservableOptions(params *GetPlacesObservableOptionsParams, opts ...ClientOption) (*GetPlacesObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlacesObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlacesObservableOptions", Method: "OPTIONS", PathPattern: "/places/observable", @@ -362,7 +396,12 @@ func (a *Client) GetPlacesObservableOptions(params *GetPlacesObservableOptionsPa Reader: &GetPlacesObservableOptionsReader{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 } @@ -379,13 +418,12 @@ func (a *Client) GetPlacesObservableOptions(params *GetPlacesObservableOptionsPa /* GetPlacesOptions CORS support */ -func (a *Client) GetPlacesOptions(params *GetPlacesOptionsParams) (*GetPlacesOptionsOK, error) { +func (a *Client) GetPlacesOptions(params *GetPlacesOptionsParams, opts ...ClientOption) (*GetPlacesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlacesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlacesOptions", Method: "OPTIONS", PathPattern: "/places", @@ -396,7 +434,12 @@ func (a *Client) GetPlacesOptions(params *GetPlacesOptionsParams) (*GetPlacesOpt Reader: &GetPlacesOptionsReader{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 } @@ -413,13 +456,12 @@ func (a *Client) GetPlacesOptions(params *GetPlacesOptionsParams) (*GetPlacesOpt /* GetStatesObservableOptions CORS support */ -func (a *Client) GetStatesObservableOptions(params *GetStatesObservableOptionsParams) (*GetStatesObservableOptionsOK, error) { +func (a *Client) GetStatesObservableOptions(params *GetStatesObservableOptionsParams, opts ...ClientOption) (*GetStatesObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStatesObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getStatesObservableOptions", Method: "OPTIONS", PathPattern: "/states/observable", @@ -430,7 +472,12 @@ func (a *Client) GetStatesObservableOptions(params *GetStatesObservableOptionsPa Reader: &GetStatesObservableOptionsReader{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 } @@ -447,13 +494,12 @@ func (a *Client) GetStatesObservableOptions(params *GetStatesObservableOptionsPa /* GetStatesOptions CORS support */ -func (a *Client) GetStatesOptions(params *GetStatesOptionsParams) (*GetStatesOptionsOK, error) { +func (a *Client) GetStatesOptions(params *GetStatesOptionsParams, opts ...ClientOption) (*GetStatesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStatesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getStatesOptions", Method: "OPTIONS", PathPattern: "/states", @@ -464,7 +510,12 @@ func (a *Client) GetStatesOptions(params *GetStatesOptionsParams) (*GetStatesOpt Reader: &GetStatesOptionsReader{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 } @@ -481,13 +532,12 @@ func (a *Client) GetStatesOptions(params *GetStatesOptionsParams) (*GetStatesOpt /* GetTaxRateObservableOptions CORS support */ -func (a *Client) GetTaxRateObservableOptions(params *GetTaxRateObservableOptionsParams) (*GetTaxRateObservableOptionsOK, error) { +func (a *Client) GetTaxRateObservableOptions(params *GetTaxRateObservableOptionsParams, opts ...ClientOption) (*GetTaxRateObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxRateObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxRateObservableOptions", Method: "OPTIONS", PathPattern: "/taxrates/observable", @@ -498,7 +548,12 @@ func (a *Client) GetTaxRateObservableOptions(params *GetTaxRateObservableOptions Reader: &GetTaxRateObservableOptionsReader{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 } @@ -515,13 +570,12 @@ func (a *Client) GetTaxRateObservableOptions(params *GetTaxRateObservableOptions /* GetTaxRatesOptions CORS support */ -func (a *Client) GetTaxRatesOptions(params *GetTaxRatesOptionsParams) (*GetTaxRatesOptionsOK, error) { +func (a *Client) GetTaxRatesOptions(params *GetTaxRatesOptionsParams, opts ...ClientOption) (*GetTaxRatesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxRatesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxRatesOptions", Method: "OPTIONS", PathPattern: "/taxrates", @@ -532,7 +586,12 @@ func (a *Client) GetTaxRatesOptions(params *GetTaxRatesOptionsParams) (*GetTaxRa Reader: &GetTaxRatesOptionsReader{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 } @@ -549,13 +608,12 @@ func (a *Client) GetTaxRatesOptions(params *GetTaxRatesOptionsParams) (*GetTaxRa /* GetTaxTypeObservableOptions CORS support */ -func (a *Client) GetTaxTypeObservableOptions(params *GetTaxTypeObservableOptionsParams) (*GetTaxTypeObservableOptionsOK, error) { +func (a *Client) GetTaxTypeObservableOptions(params *GetTaxTypeObservableOptionsParams, opts ...ClientOption) (*GetTaxTypeObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxTypeObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxTypeObservableOptions", Method: "OPTIONS", PathPattern: "/taxtypes/observable", @@ -566,7 +624,12 @@ func (a *Client) GetTaxTypeObservableOptions(params *GetTaxTypeObservableOptions Reader: &GetTaxTypeObservableOptionsReader{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 } @@ -583,13 +646,12 @@ func (a *Client) GetTaxTypeObservableOptions(params *GetTaxTypeObservableOptions /* GetTaxTypesOptions CORS support */ -func (a *Client) GetTaxTypesOptions(params *GetTaxTypesOptionsParams) (*GetTaxTypesOptionsOK, error) { +func (a *Client) GetTaxTypesOptions(params *GetTaxTypesOptionsParams, opts ...ClientOption) (*GetTaxTypesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxTypesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxTypesOptions", Method: "OPTIONS", PathPattern: "/taxtypes", @@ -600,7 +662,12 @@ func (a *Client) GetTaxTypesOptions(params *GetTaxTypesOptionsParams) (*GetTaxTy Reader: &GetTaxTypesOptionsReader{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 } @@ -617,13 +684,12 @@ func (a *Client) GetTaxTypesOptions(params *GetTaxTypesOptionsParams) (*GetTaxTy /* GetTaxnexusCodesObservableOptions CORS support */ -func (a *Client) GetTaxnexusCodesObservableOptions(params *GetTaxnexusCodesObservableOptionsParams) (*GetTaxnexusCodesObservableOptionsOK, error) { +func (a *Client) GetTaxnexusCodesObservableOptions(params *GetTaxnexusCodesObservableOptionsParams, opts ...ClientOption) (*GetTaxnexusCodesObservableOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxnexusCodesObservableOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxnexusCodesObservableOptions", Method: "OPTIONS", PathPattern: "/taxnexuscodes/observable", @@ -634,7 +700,12 @@ func (a *Client) GetTaxnexusCodesObservableOptions(params *GetTaxnexusCodesObser Reader: &GetTaxnexusCodesObservableOptionsReader{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 } @@ -651,13 +722,12 @@ func (a *Client) GetTaxnexusCodesObservableOptions(params *GetTaxnexusCodesObser /* GetTaxnexusCodesOptions CORS support */ -func (a *Client) GetTaxnexusCodesOptions(params *GetTaxnexusCodesOptionsParams) (*GetTaxnexusCodesOptionsOK, error) { +func (a *Client) GetTaxnexusCodesOptions(params *GetTaxnexusCodesOptionsParams, opts ...ClientOption) (*GetTaxnexusCodesOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxnexusCodesOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxnexusCodesOptions", Method: "OPTIONS", PathPattern: "/taxnexuscodes", @@ -668,7 +738,12 @@ func (a *Client) GetTaxnexusCodesOptions(params *GetTaxnexusCodesOptionsParams) Reader: &GetTaxnexusCodesOptionsReader{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 } diff --git a/api/geo/geo_client/cors/get_coordinates_observable_options_parameters.go b/api/geo/geo_client/cors/get_coordinates_observable_options_parameters.go index b7a691a..77c962c 100644 --- a/api/geo/geo_client/cors/get_coordinates_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_coordinates_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCoordinatesObservableOptionsParams creates a new GetCoordinatesObservableOptionsParams object -// with the default values initialized. +// NewGetCoordinatesObservableOptionsParams creates a new GetCoordinatesObservableOptionsParams 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 NewGetCoordinatesObservableOptionsParams() *GetCoordinatesObservableOptionsParams { - return &GetCoordinatesObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCoordinatesObservableOptionsParamsWithTimeout creates a new GetCoordinatesObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCoordinatesObservableOptionsParamsWithTimeout(timeout time.Duration) *GetCoordinatesObservableOptionsParams { - return &GetCoordinatesObservableOptionsParams{ - timeout: timeout, } } // NewGetCoordinatesObservableOptionsParamsWithContext creates a new GetCoordinatesObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCoordinatesObservableOptionsParamsWithContext(ctx context.Context) *GetCoordinatesObservableOptionsParams { - return &GetCoordinatesObservableOptionsParams{ - Context: ctx, } } // NewGetCoordinatesObservableOptionsParamsWithHTTPClient creates a new GetCoordinatesObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCoordinatesObservableOptionsParamsWithHTTPClient(client *http.Client) *GetCoordinatesObservableOptionsParams { - return &GetCoordinatesObservableOptionsParams{ HTTPClient: client, } } -/*GetCoordinatesObservableOptionsParams contains all the parameters to send to the API endpoint -for the get coordinates observable options operation typically these are written to a http.Request +/* GetCoordinatesObservableOptionsParams contains all the parameters to send to the API endpoint + for the get coordinates observable options operation. + + Typically these are written to a http.Request. */ type GetCoordinatesObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetCoordinatesObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get coordinates observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesObservableOptionsParams) WithDefaults() *GetCoordinatesObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get coordinates observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get coordinates observable options params func (o *GetCoordinatesObservableOptionsParams) WithTimeout(timeout time.Duration) *GetCoordinatesObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_coordinates_observable_options_responses.go b/api/geo/geo_client/cors/get_coordinates_observable_options_responses.go index ac547b9..e82246d 100644 --- a/api/geo/geo_client/cors/get_coordinates_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_coordinates_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetCoordinatesObservableOptionsReader) ReadResponse(response runtime.Cl return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetCoordinatesObservableOptionsOK() *GetCoordinatesObservableOptionsOK { return &GetCoordinatesObservableOptionsOK{} } -/*GetCoordinatesObservableOptionsOK handles this case with default header values. +/* GetCoordinatesObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetCoordinatesObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetCoordinatesObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetCoordinatesObservableOptionsOK) Error() string { func (o *GetCoordinatesObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_coordinates_options_parameters.go b/api/geo/geo_client/cors/get_coordinates_options_parameters.go index 59ede33..c195148 100644 --- a/api/geo/geo_client/cors/get_coordinates_options_parameters.go +++ b/api/geo/geo_client/cors/get_coordinates_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCoordinatesOptionsParams creates a new GetCoordinatesOptionsParams object -// with the default values initialized. +// NewGetCoordinatesOptionsParams creates a new GetCoordinatesOptionsParams 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 NewGetCoordinatesOptionsParams() *GetCoordinatesOptionsParams { - return &GetCoordinatesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCoordinatesOptionsParamsWithTimeout creates a new GetCoordinatesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCoordinatesOptionsParamsWithTimeout(timeout time.Duration) *GetCoordinatesOptionsParams { - return &GetCoordinatesOptionsParams{ - timeout: timeout, } } // NewGetCoordinatesOptionsParamsWithContext creates a new GetCoordinatesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCoordinatesOptionsParamsWithContext(ctx context.Context) *GetCoordinatesOptionsParams { - return &GetCoordinatesOptionsParams{ - Context: ctx, } } // NewGetCoordinatesOptionsParamsWithHTTPClient creates a new GetCoordinatesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCoordinatesOptionsParamsWithHTTPClient(client *http.Client) *GetCoordinatesOptionsParams { - return &GetCoordinatesOptionsParams{ HTTPClient: client, } } -/*GetCoordinatesOptionsParams contains all the parameters to send to the API endpoint -for the get coordinates options operation typically these are written to a http.Request +/* GetCoordinatesOptionsParams contains all the parameters to send to the API endpoint + for the get coordinates options operation. + + Typically these are written to a http.Request. */ type GetCoordinatesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetCoordinatesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get coordinates options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesOptionsParams) WithDefaults() *GetCoordinatesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get coordinates options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get coordinates options params func (o *GetCoordinatesOptionsParams) WithTimeout(timeout time.Duration) *GetCoordinatesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_coordinates_options_responses.go b/api/geo/geo_client/cors/get_coordinates_options_responses.go index 2bbc05d..6dfc8f9 100644 --- a/api/geo/geo_client/cors/get_coordinates_options_responses.go +++ b/api/geo/geo_client/cors/get_coordinates_options_responses.go @@ -30,9 +30,8 @@ func (o *GetCoordinatesOptionsReader) ReadResponse(response runtime.ClientRespon return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetCoordinatesOptionsOK() *GetCoordinatesOptionsOK { return &GetCoordinatesOptionsOK{} } -/*GetCoordinatesOptionsOK handles this case with default header values. +/* GetCoordinatesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetCoordinatesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetCoordinatesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetCoordinatesOptionsOK) Error() string { func (o *GetCoordinatesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_counties_observable_options_parameters.go b/api/geo/geo_client/cors/get_counties_observable_options_parameters.go index 541cc69..e4faaa3 100644 --- a/api/geo/geo_client/cors/get_counties_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_counties_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCountiesObservableOptionsParams creates a new GetCountiesObservableOptionsParams object -// with the default values initialized. +// NewGetCountiesObservableOptionsParams creates a new GetCountiesObservableOptionsParams 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 NewGetCountiesObservableOptionsParams() *GetCountiesObservableOptionsParams { - return &GetCountiesObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountiesObservableOptionsParamsWithTimeout creates a new GetCountiesObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountiesObservableOptionsParamsWithTimeout(timeout time.Duration) *GetCountiesObservableOptionsParams { - return &GetCountiesObservableOptionsParams{ - timeout: timeout, } } // NewGetCountiesObservableOptionsParamsWithContext creates a new GetCountiesObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountiesObservableOptionsParamsWithContext(ctx context.Context) *GetCountiesObservableOptionsParams { - return &GetCountiesObservableOptionsParams{ - Context: ctx, } } // NewGetCountiesObservableOptionsParamsWithHTTPClient creates a new GetCountiesObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountiesObservableOptionsParamsWithHTTPClient(client *http.Client) *GetCountiesObservableOptionsParams { - return &GetCountiesObservableOptionsParams{ HTTPClient: client, } } -/*GetCountiesObservableOptionsParams contains all the parameters to send to the API endpoint -for the get counties observable options operation typically these are written to a http.Request +/* GetCountiesObservableOptionsParams contains all the parameters to send to the API endpoint + for the get counties observable options operation. + + Typically these are written to a http.Request. */ type GetCountiesObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetCountiesObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get counties observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesObservableOptionsParams) WithDefaults() *GetCountiesObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get counties observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get counties observable options params func (o *GetCountiesObservableOptionsParams) WithTimeout(timeout time.Duration) *GetCountiesObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_counties_observable_options_responses.go b/api/geo/geo_client/cors/get_counties_observable_options_responses.go index dc4fc4a..4113d01 100644 --- a/api/geo/geo_client/cors/get_counties_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_counties_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetCountiesObservableOptionsReader) ReadResponse(response runtime.Clien return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetCountiesObservableOptionsOK() *GetCountiesObservableOptionsOK { return &GetCountiesObservableOptionsOK{} } -/*GetCountiesObservableOptionsOK handles this case with default header values. +/* GetCountiesObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetCountiesObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetCountiesObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetCountiesObservableOptionsOK) Error() string { func (o *GetCountiesObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_counties_options_parameters.go b/api/geo/geo_client/cors/get_counties_options_parameters.go index dc74f2c..ab7d7b7 100644 --- a/api/geo/geo_client/cors/get_counties_options_parameters.go +++ b/api/geo/geo_client/cors/get_counties_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCountiesOptionsParams creates a new GetCountiesOptionsParams object -// with the default values initialized. +// NewGetCountiesOptionsParams creates a new GetCountiesOptionsParams 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 NewGetCountiesOptionsParams() *GetCountiesOptionsParams { - return &GetCountiesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountiesOptionsParamsWithTimeout creates a new GetCountiesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountiesOptionsParamsWithTimeout(timeout time.Duration) *GetCountiesOptionsParams { - return &GetCountiesOptionsParams{ - timeout: timeout, } } // NewGetCountiesOptionsParamsWithContext creates a new GetCountiesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountiesOptionsParamsWithContext(ctx context.Context) *GetCountiesOptionsParams { - return &GetCountiesOptionsParams{ - Context: ctx, } } // NewGetCountiesOptionsParamsWithHTTPClient creates a new GetCountiesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountiesOptionsParamsWithHTTPClient(client *http.Client) *GetCountiesOptionsParams { - return &GetCountiesOptionsParams{ HTTPClient: client, } } -/*GetCountiesOptionsParams contains all the parameters to send to the API endpoint -for the get counties options operation typically these are written to a http.Request +/* GetCountiesOptionsParams contains all the parameters to send to the API endpoint + for the get counties options operation. + + Typically these are written to a http.Request. */ type GetCountiesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetCountiesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get counties options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesOptionsParams) WithDefaults() *GetCountiesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get counties options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get counties options params func (o *GetCountiesOptionsParams) WithTimeout(timeout time.Duration) *GetCountiesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_counties_options_responses.go b/api/geo/geo_client/cors/get_counties_options_responses.go index 0c0a9b4..e45be00 100644 --- a/api/geo/geo_client/cors/get_counties_options_responses.go +++ b/api/geo/geo_client/cors/get_counties_options_responses.go @@ -30,9 +30,8 @@ func (o *GetCountiesOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetCountiesOptionsOK() *GetCountiesOptionsOK { return &GetCountiesOptionsOK{} } -/*GetCountiesOptionsOK handles this case with default header values. +/* GetCountiesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetCountiesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetCountiesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetCountiesOptionsOK) Error() string { func (o *GetCountiesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_countries_observable_options_parameters.go b/api/geo/geo_client/cors/get_countries_observable_options_parameters.go index 4dcb0a8..cd92244 100644 --- a/api/geo/geo_client/cors/get_countries_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_countries_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCountriesObservableOptionsParams creates a new GetCountriesObservableOptionsParams object -// with the default values initialized. +// NewGetCountriesObservableOptionsParams creates a new GetCountriesObservableOptionsParams 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 NewGetCountriesObservableOptionsParams() *GetCountriesObservableOptionsParams { - return &GetCountriesObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountriesObservableOptionsParamsWithTimeout creates a new GetCountriesObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountriesObservableOptionsParamsWithTimeout(timeout time.Duration) *GetCountriesObservableOptionsParams { - return &GetCountriesObservableOptionsParams{ - timeout: timeout, } } // NewGetCountriesObservableOptionsParamsWithContext creates a new GetCountriesObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountriesObservableOptionsParamsWithContext(ctx context.Context) *GetCountriesObservableOptionsParams { - return &GetCountriesObservableOptionsParams{ - Context: ctx, } } // NewGetCountriesObservableOptionsParamsWithHTTPClient creates a new GetCountriesObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountriesObservableOptionsParamsWithHTTPClient(client *http.Client) *GetCountriesObservableOptionsParams { - return &GetCountriesObservableOptionsParams{ HTTPClient: client, } } -/*GetCountriesObservableOptionsParams contains all the parameters to send to the API endpoint -for the get countries observable options operation typically these are written to a http.Request +/* GetCountriesObservableOptionsParams contains all the parameters to send to the API endpoint + for the get countries observable options operation. + + Typically these are written to a http.Request. */ type GetCountriesObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetCountriesObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get countries observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesObservableOptionsParams) WithDefaults() *GetCountriesObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get countries observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get countries observable options params func (o *GetCountriesObservableOptionsParams) WithTimeout(timeout time.Duration) *GetCountriesObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_countries_observable_options_responses.go b/api/geo/geo_client/cors/get_countries_observable_options_responses.go index aedd493..97dd326 100644 --- a/api/geo/geo_client/cors/get_countries_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_countries_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetCountriesObservableOptionsReader) ReadResponse(response runtime.Clie return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetCountriesObservableOptionsOK() *GetCountriesObservableOptionsOK { return &GetCountriesObservableOptionsOK{} } -/*GetCountriesObservableOptionsOK handles this case with default header values. +/* GetCountriesObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetCountriesObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetCountriesObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetCountriesObservableOptionsOK) Error() string { func (o *GetCountriesObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_countries_options_parameters.go b/api/geo/geo_client/cors/get_countries_options_parameters.go index cc7de5e..b771efd 100644 --- a/api/geo/geo_client/cors/get_countries_options_parameters.go +++ b/api/geo/geo_client/cors/get_countries_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCountriesOptionsParams creates a new GetCountriesOptionsParams object -// with the default values initialized. +// NewGetCountriesOptionsParams creates a new GetCountriesOptionsParams 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 NewGetCountriesOptionsParams() *GetCountriesOptionsParams { - return &GetCountriesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountriesOptionsParamsWithTimeout creates a new GetCountriesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountriesOptionsParamsWithTimeout(timeout time.Duration) *GetCountriesOptionsParams { - return &GetCountriesOptionsParams{ - timeout: timeout, } } // NewGetCountriesOptionsParamsWithContext creates a new GetCountriesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountriesOptionsParamsWithContext(ctx context.Context) *GetCountriesOptionsParams { - return &GetCountriesOptionsParams{ - Context: ctx, } } // NewGetCountriesOptionsParamsWithHTTPClient creates a new GetCountriesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountriesOptionsParamsWithHTTPClient(client *http.Client) *GetCountriesOptionsParams { - return &GetCountriesOptionsParams{ HTTPClient: client, } } -/*GetCountriesOptionsParams contains all the parameters to send to the API endpoint -for the get countries options operation typically these are written to a http.Request +/* GetCountriesOptionsParams contains all the parameters to send to the API endpoint + for the get countries options operation. + + Typically these are written to a http.Request. */ type GetCountriesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetCountriesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get countries options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesOptionsParams) WithDefaults() *GetCountriesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get countries options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get countries options params func (o *GetCountriesOptionsParams) WithTimeout(timeout time.Duration) *GetCountriesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_countries_options_responses.go b/api/geo/geo_client/cors/get_countries_options_responses.go index ea1953f..4a253b9 100644 --- a/api/geo/geo_client/cors/get_countries_options_responses.go +++ b/api/geo/geo_client/cors/get_countries_options_responses.go @@ -30,9 +30,8 @@ func (o *GetCountriesOptionsReader) ReadResponse(response runtime.ClientResponse return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetCountriesOptionsOK() *GetCountriesOptionsOK { return &GetCountriesOptionsOK{} } -/*GetCountriesOptionsOK handles this case with default header values. +/* GetCountriesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetCountriesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetCountriesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetCountriesOptionsOK) Error() string { func (o *GetCountriesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_domains_observable_options_parameters.go b/api/geo/geo_client/cors/get_domains_observable_options_parameters.go index f04d82e..0627fe4 100644 --- a/api/geo/geo_client/cors/get_domains_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_domains_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetDomainsObservableOptionsParams creates a new GetDomainsObservableOptionsParams object -// with the default values initialized. +// NewGetDomainsObservableOptionsParams creates a new GetDomainsObservableOptionsParams 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 NewGetDomainsObservableOptionsParams() *GetDomainsObservableOptionsParams { - return &GetDomainsObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetDomainsObservableOptionsParamsWithTimeout creates a new GetDomainsObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDomainsObservableOptionsParamsWithTimeout(timeout time.Duration) *GetDomainsObservableOptionsParams { - return &GetDomainsObservableOptionsParams{ - timeout: timeout, } } // NewGetDomainsObservableOptionsParamsWithContext creates a new GetDomainsObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDomainsObservableOptionsParamsWithContext(ctx context.Context) *GetDomainsObservableOptionsParams { - return &GetDomainsObservableOptionsParams{ - Context: ctx, } } // NewGetDomainsObservableOptionsParamsWithHTTPClient creates a new GetDomainsObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDomainsObservableOptionsParamsWithHTTPClient(client *http.Client) *GetDomainsObservableOptionsParams { - return &GetDomainsObservableOptionsParams{ HTTPClient: client, } } -/*GetDomainsObservableOptionsParams contains all the parameters to send to the API endpoint -for the get domains observable options operation typically these are written to a http.Request +/* GetDomainsObservableOptionsParams contains all the parameters to send to the API endpoint + for the get domains observable options operation. + + Typically these are written to a http.Request. */ type GetDomainsObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetDomainsObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get domains observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsObservableOptionsParams) WithDefaults() *GetDomainsObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get domains observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get domains observable options params func (o *GetDomainsObservableOptionsParams) WithTimeout(timeout time.Duration) *GetDomainsObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_domains_observable_options_responses.go b/api/geo/geo_client/cors/get_domains_observable_options_responses.go index 77f9820..a6a4e56 100644 --- a/api/geo/geo_client/cors/get_domains_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_domains_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetDomainsObservableOptionsReader) ReadResponse(response runtime.Client return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetDomainsObservableOptionsOK() *GetDomainsObservableOptionsOK { return &GetDomainsObservableOptionsOK{} } -/*GetDomainsObservableOptionsOK handles this case with default header values. +/* GetDomainsObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetDomainsObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetDomainsObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetDomainsObservableOptionsOK) Error() string { func (o *GetDomainsObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_domains_options_parameters.go b/api/geo/geo_client/cors/get_domains_options_parameters.go index a433306..1784b04 100644 --- a/api/geo/geo_client/cors/get_domains_options_parameters.go +++ b/api/geo/geo_client/cors/get_domains_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetDomainsOptionsParams creates a new GetDomainsOptionsParams object -// with the default values initialized. +// NewGetDomainsOptionsParams creates a new GetDomainsOptionsParams 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 NewGetDomainsOptionsParams() *GetDomainsOptionsParams { - return &GetDomainsOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetDomainsOptionsParamsWithTimeout creates a new GetDomainsOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDomainsOptionsParamsWithTimeout(timeout time.Duration) *GetDomainsOptionsParams { - return &GetDomainsOptionsParams{ - timeout: timeout, } } // NewGetDomainsOptionsParamsWithContext creates a new GetDomainsOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDomainsOptionsParamsWithContext(ctx context.Context) *GetDomainsOptionsParams { - return &GetDomainsOptionsParams{ - Context: ctx, } } // NewGetDomainsOptionsParamsWithHTTPClient creates a new GetDomainsOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDomainsOptionsParamsWithHTTPClient(client *http.Client) *GetDomainsOptionsParams { - return &GetDomainsOptionsParams{ HTTPClient: client, } } -/*GetDomainsOptionsParams contains all the parameters to send to the API endpoint -for the get domains options operation typically these are written to a http.Request +/* GetDomainsOptionsParams contains all the parameters to send to the API endpoint + for the get domains options operation. + + Typically these are written to a http.Request. */ type GetDomainsOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetDomainsOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get domains options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsOptionsParams) WithDefaults() *GetDomainsOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get domains options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get domains options params func (o *GetDomainsOptionsParams) WithTimeout(timeout time.Duration) *GetDomainsOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_domains_options_responses.go b/api/geo/geo_client/cors/get_domains_options_responses.go index 4b2a0df..1bb4a05 100644 --- a/api/geo/geo_client/cors/get_domains_options_responses.go +++ b/api/geo/geo_client/cors/get_domains_options_responses.go @@ -30,9 +30,8 @@ func (o *GetDomainsOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetDomainsOptionsOK() *GetDomainsOptionsOK { return &GetDomainsOptionsOK{} } -/*GetDomainsOptionsOK handles this case with default header values. +/* GetDomainsOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetDomainsOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetDomainsOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetDomainsOptionsOK) Error() string { func (o *GetDomainsOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_places_observable_options_parameters.go b/api/geo/geo_client/cors/get_places_observable_options_parameters.go index 5347a58..58bf9c2 100644 --- a/api/geo/geo_client/cors/get_places_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_places_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPlacesObservableOptionsParams creates a new GetPlacesObservableOptionsParams object -// with the default values initialized. +// NewGetPlacesObservableOptionsParams creates a new GetPlacesObservableOptionsParams 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 NewGetPlacesObservableOptionsParams() *GetPlacesObservableOptionsParams { - return &GetPlacesObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlacesObservableOptionsParamsWithTimeout creates a new GetPlacesObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlacesObservableOptionsParamsWithTimeout(timeout time.Duration) *GetPlacesObservableOptionsParams { - return &GetPlacesObservableOptionsParams{ - timeout: timeout, } } // NewGetPlacesObservableOptionsParamsWithContext creates a new GetPlacesObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlacesObservableOptionsParamsWithContext(ctx context.Context) *GetPlacesObservableOptionsParams { - return &GetPlacesObservableOptionsParams{ - Context: ctx, } } // NewGetPlacesObservableOptionsParamsWithHTTPClient creates a new GetPlacesObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlacesObservableOptionsParamsWithHTTPClient(client *http.Client) *GetPlacesObservableOptionsParams { - return &GetPlacesObservableOptionsParams{ HTTPClient: client, } } -/*GetPlacesObservableOptionsParams contains all the parameters to send to the API endpoint -for the get places observable options operation typically these are written to a http.Request +/* GetPlacesObservableOptionsParams contains all the parameters to send to the API endpoint + for the get places observable options operation. + + Typically these are written to a http.Request. */ type GetPlacesObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetPlacesObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get places observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesObservableOptionsParams) WithDefaults() *GetPlacesObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get places observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get places observable options params func (o *GetPlacesObservableOptionsParams) WithTimeout(timeout time.Duration) *GetPlacesObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_places_observable_options_responses.go b/api/geo/geo_client/cors/get_places_observable_options_responses.go index c53cbad..85816ca 100644 --- a/api/geo/geo_client/cors/get_places_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_places_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetPlacesObservableOptionsReader) ReadResponse(response runtime.ClientR return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetPlacesObservableOptionsOK() *GetPlacesObservableOptionsOK { return &GetPlacesObservableOptionsOK{} } -/*GetPlacesObservableOptionsOK handles this case with default header values. +/* GetPlacesObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetPlacesObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetPlacesObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetPlacesObservableOptionsOK) Error() string { func (o *GetPlacesObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_places_options_parameters.go b/api/geo/geo_client/cors/get_places_options_parameters.go index 16d50b1..419496f 100644 --- a/api/geo/geo_client/cors/get_places_options_parameters.go +++ b/api/geo/geo_client/cors/get_places_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPlacesOptionsParams creates a new GetPlacesOptionsParams object -// with the default values initialized. +// NewGetPlacesOptionsParams creates a new GetPlacesOptionsParams 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 NewGetPlacesOptionsParams() *GetPlacesOptionsParams { - return &GetPlacesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlacesOptionsParamsWithTimeout creates a new GetPlacesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlacesOptionsParamsWithTimeout(timeout time.Duration) *GetPlacesOptionsParams { - return &GetPlacesOptionsParams{ - timeout: timeout, } } // NewGetPlacesOptionsParamsWithContext creates a new GetPlacesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlacesOptionsParamsWithContext(ctx context.Context) *GetPlacesOptionsParams { - return &GetPlacesOptionsParams{ - Context: ctx, } } // NewGetPlacesOptionsParamsWithHTTPClient creates a new GetPlacesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlacesOptionsParamsWithHTTPClient(client *http.Client) *GetPlacesOptionsParams { - return &GetPlacesOptionsParams{ HTTPClient: client, } } -/*GetPlacesOptionsParams contains all the parameters to send to the API endpoint -for the get places options operation typically these are written to a http.Request +/* GetPlacesOptionsParams contains all the parameters to send to the API endpoint + for the get places options operation. + + Typically these are written to a http.Request. */ type GetPlacesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetPlacesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get places options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesOptionsParams) WithDefaults() *GetPlacesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get places options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get places options params func (o *GetPlacesOptionsParams) WithTimeout(timeout time.Duration) *GetPlacesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_places_options_responses.go b/api/geo/geo_client/cors/get_places_options_responses.go index 19267e8..f8a0d0a 100644 --- a/api/geo/geo_client/cors/get_places_options_responses.go +++ b/api/geo/geo_client/cors/get_places_options_responses.go @@ -30,9 +30,8 @@ func (o *GetPlacesOptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetPlacesOptionsOK() *GetPlacesOptionsOK { return &GetPlacesOptionsOK{} } -/*GetPlacesOptionsOK handles this case with default header values. +/* GetPlacesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetPlacesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetPlacesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetPlacesOptionsOK) Error() string { func (o *GetPlacesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_states_observable_options_parameters.go b/api/geo/geo_client/cors/get_states_observable_options_parameters.go index 7cb3060..ccda524 100644 --- a/api/geo/geo_client/cors/get_states_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_states_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetStatesObservableOptionsParams creates a new GetStatesObservableOptionsParams object -// with the default values initialized. +// NewGetStatesObservableOptionsParams creates a new GetStatesObservableOptionsParams 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 NewGetStatesObservableOptionsParams() *GetStatesObservableOptionsParams { - return &GetStatesObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetStatesObservableOptionsParamsWithTimeout creates a new GetStatesObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStatesObservableOptionsParamsWithTimeout(timeout time.Duration) *GetStatesObservableOptionsParams { - return &GetStatesObservableOptionsParams{ - timeout: timeout, } } // NewGetStatesObservableOptionsParamsWithContext creates a new GetStatesObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStatesObservableOptionsParamsWithContext(ctx context.Context) *GetStatesObservableOptionsParams { - return &GetStatesObservableOptionsParams{ - Context: ctx, } } // NewGetStatesObservableOptionsParamsWithHTTPClient creates a new GetStatesObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStatesObservableOptionsParamsWithHTTPClient(client *http.Client) *GetStatesObservableOptionsParams { - return &GetStatesObservableOptionsParams{ HTTPClient: client, } } -/*GetStatesObservableOptionsParams contains all the parameters to send to the API endpoint -for the get states observable options operation typically these are written to a http.Request +/* GetStatesObservableOptionsParams contains all the parameters to send to the API endpoint + for the get states observable options operation. + + Typically these are written to a http.Request. */ type GetStatesObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetStatesObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get states observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesObservableOptionsParams) WithDefaults() *GetStatesObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get states observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get states observable options params func (o *GetStatesObservableOptionsParams) WithTimeout(timeout time.Duration) *GetStatesObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_states_observable_options_responses.go b/api/geo/geo_client/cors/get_states_observable_options_responses.go index 82cd3e0..28d44a6 100644 --- a/api/geo/geo_client/cors/get_states_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_states_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetStatesObservableOptionsReader) ReadResponse(response runtime.ClientR return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetStatesObservableOptionsOK() *GetStatesObservableOptionsOK { return &GetStatesObservableOptionsOK{} } -/*GetStatesObservableOptionsOK handles this case with default header values. +/* GetStatesObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetStatesObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetStatesObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetStatesObservableOptionsOK) Error() string { func (o *GetStatesObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_states_options_parameters.go b/api/geo/geo_client/cors/get_states_options_parameters.go index a5375a2..b20f932 100644 --- a/api/geo/geo_client/cors/get_states_options_parameters.go +++ b/api/geo/geo_client/cors/get_states_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetStatesOptionsParams creates a new GetStatesOptionsParams object -// with the default values initialized. +// NewGetStatesOptionsParams creates a new GetStatesOptionsParams 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 NewGetStatesOptionsParams() *GetStatesOptionsParams { - return &GetStatesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetStatesOptionsParamsWithTimeout creates a new GetStatesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStatesOptionsParamsWithTimeout(timeout time.Duration) *GetStatesOptionsParams { - return &GetStatesOptionsParams{ - timeout: timeout, } } // NewGetStatesOptionsParamsWithContext creates a new GetStatesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStatesOptionsParamsWithContext(ctx context.Context) *GetStatesOptionsParams { - return &GetStatesOptionsParams{ - Context: ctx, } } // NewGetStatesOptionsParamsWithHTTPClient creates a new GetStatesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStatesOptionsParamsWithHTTPClient(client *http.Client) *GetStatesOptionsParams { - return &GetStatesOptionsParams{ HTTPClient: client, } } -/*GetStatesOptionsParams contains all the parameters to send to the API endpoint -for the get states options operation typically these are written to a http.Request +/* GetStatesOptionsParams contains all the parameters to send to the API endpoint + for the get states options operation. + + Typically these are written to a http.Request. */ type GetStatesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetStatesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get states options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesOptionsParams) WithDefaults() *GetStatesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get states options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get states options params func (o *GetStatesOptionsParams) WithTimeout(timeout time.Duration) *GetStatesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_states_options_responses.go b/api/geo/geo_client/cors/get_states_options_responses.go index 79217a4..b29c09d 100644 --- a/api/geo/geo_client/cors/get_states_options_responses.go +++ b/api/geo/geo_client/cors/get_states_options_responses.go @@ -30,9 +30,8 @@ func (o *GetStatesOptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetStatesOptionsOK() *GetStatesOptionsOK { return &GetStatesOptionsOK{} } -/*GetStatesOptionsOK handles this case with default header values. +/* GetStatesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetStatesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetStatesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetStatesOptionsOK) Error() string { func (o *GetStatesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_tax_rate_observable_options_parameters.go b/api/geo/geo_client/cors/get_tax_rate_observable_options_parameters.go index 2545d53..ac87dbb 100644 --- a/api/geo/geo_client/cors/get_tax_rate_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_tax_rate_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxRateObservableOptionsParams creates a new GetTaxRateObservableOptionsParams object -// with the default values initialized. +// NewGetTaxRateObservableOptionsParams creates a new GetTaxRateObservableOptionsParams 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 NewGetTaxRateObservableOptionsParams() *GetTaxRateObservableOptionsParams { - return &GetTaxRateObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxRateObservableOptionsParamsWithTimeout creates a new GetTaxRateObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxRateObservableOptionsParamsWithTimeout(timeout time.Duration) *GetTaxRateObservableOptionsParams { - return &GetTaxRateObservableOptionsParams{ - timeout: timeout, } } // NewGetTaxRateObservableOptionsParamsWithContext creates a new GetTaxRateObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxRateObservableOptionsParamsWithContext(ctx context.Context) *GetTaxRateObservableOptionsParams { - return &GetTaxRateObservableOptionsParams{ - Context: ctx, } } // NewGetTaxRateObservableOptionsParamsWithHTTPClient creates a new GetTaxRateObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxRateObservableOptionsParamsWithHTTPClient(client *http.Client) *GetTaxRateObservableOptionsParams { - return &GetTaxRateObservableOptionsParams{ HTTPClient: client, } } -/*GetTaxRateObservableOptionsParams contains all the parameters to send to the API endpoint -for the get tax rate observable options operation typically these are written to a http.Request +/* GetTaxRateObservableOptionsParams contains all the parameters to send to the API endpoint + for the get tax rate observable options operation. + + Typically these are written to a http.Request. */ type GetTaxRateObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTaxRateObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax rate observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRateObservableOptionsParams) WithDefaults() *GetTaxRateObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax rate observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRateObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax rate observable options params func (o *GetTaxRateObservableOptionsParams) WithTimeout(timeout time.Duration) *GetTaxRateObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_tax_rate_observable_options_responses.go b/api/geo/geo_client/cors/get_tax_rate_observable_options_responses.go index ae13fb8..18bbb02 100644 --- a/api/geo/geo_client/cors/get_tax_rate_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_tax_rate_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetTaxRateObservableOptionsReader) ReadResponse(response runtime.Client return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetTaxRateObservableOptionsOK() *GetTaxRateObservableOptionsOK { return &GetTaxRateObservableOptionsOK{} } -/*GetTaxRateObservableOptionsOK handles this case with default header values. +/* GetTaxRateObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetTaxRateObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetTaxRateObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetTaxRateObservableOptionsOK) Error() string { func (o *GetTaxRateObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_tax_rates_options_parameters.go b/api/geo/geo_client/cors/get_tax_rates_options_parameters.go index a15bd17..7ced8be 100644 --- a/api/geo/geo_client/cors/get_tax_rates_options_parameters.go +++ b/api/geo/geo_client/cors/get_tax_rates_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxRatesOptionsParams creates a new GetTaxRatesOptionsParams object -// with the default values initialized. +// NewGetTaxRatesOptionsParams creates a new GetTaxRatesOptionsParams 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 NewGetTaxRatesOptionsParams() *GetTaxRatesOptionsParams { - return &GetTaxRatesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxRatesOptionsParamsWithTimeout creates a new GetTaxRatesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxRatesOptionsParamsWithTimeout(timeout time.Duration) *GetTaxRatesOptionsParams { - return &GetTaxRatesOptionsParams{ - timeout: timeout, } } // NewGetTaxRatesOptionsParamsWithContext creates a new GetTaxRatesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxRatesOptionsParamsWithContext(ctx context.Context) *GetTaxRatesOptionsParams { - return &GetTaxRatesOptionsParams{ - Context: ctx, } } // NewGetTaxRatesOptionsParamsWithHTTPClient creates a new GetTaxRatesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxRatesOptionsParamsWithHTTPClient(client *http.Client) *GetTaxRatesOptionsParams { - return &GetTaxRatesOptionsParams{ HTTPClient: client, } } -/*GetTaxRatesOptionsParams contains all the parameters to send to the API endpoint -for the get tax rates options operation typically these are written to a http.Request +/* GetTaxRatesOptionsParams contains all the parameters to send to the API endpoint + for the get tax rates options operation. + + Typically these are written to a http.Request. */ type GetTaxRatesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTaxRatesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax rates options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRatesOptionsParams) WithDefaults() *GetTaxRatesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax rates options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRatesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax rates options params func (o *GetTaxRatesOptionsParams) WithTimeout(timeout time.Duration) *GetTaxRatesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_tax_rates_options_responses.go b/api/geo/geo_client/cors/get_tax_rates_options_responses.go index 7e9b79b..c8d72df 100644 --- a/api/geo/geo_client/cors/get_tax_rates_options_responses.go +++ b/api/geo/geo_client/cors/get_tax_rates_options_responses.go @@ -30,9 +30,8 @@ func (o *GetTaxRatesOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetTaxRatesOptionsOK() *GetTaxRatesOptionsOK { return &GetTaxRatesOptionsOK{} } -/*GetTaxRatesOptionsOK handles this case with default header values. +/* GetTaxRatesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetTaxRatesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetTaxRatesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetTaxRatesOptionsOK) Error() string { func (o *GetTaxRatesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_tax_type_observable_options_parameters.go b/api/geo/geo_client/cors/get_tax_type_observable_options_parameters.go index dac0c7d..9a4bc6a 100644 --- a/api/geo/geo_client/cors/get_tax_type_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_tax_type_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxTypeObservableOptionsParams creates a new GetTaxTypeObservableOptionsParams object -// with the default values initialized. +// NewGetTaxTypeObservableOptionsParams creates a new GetTaxTypeObservableOptionsParams 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 NewGetTaxTypeObservableOptionsParams() *GetTaxTypeObservableOptionsParams { - return &GetTaxTypeObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxTypeObservableOptionsParamsWithTimeout creates a new GetTaxTypeObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxTypeObservableOptionsParamsWithTimeout(timeout time.Duration) *GetTaxTypeObservableOptionsParams { - return &GetTaxTypeObservableOptionsParams{ - timeout: timeout, } } // NewGetTaxTypeObservableOptionsParamsWithContext creates a new GetTaxTypeObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxTypeObservableOptionsParamsWithContext(ctx context.Context) *GetTaxTypeObservableOptionsParams { - return &GetTaxTypeObservableOptionsParams{ - Context: ctx, } } // NewGetTaxTypeObservableOptionsParamsWithHTTPClient creates a new GetTaxTypeObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxTypeObservableOptionsParamsWithHTTPClient(client *http.Client) *GetTaxTypeObservableOptionsParams { - return &GetTaxTypeObservableOptionsParams{ HTTPClient: client, } } -/*GetTaxTypeObservableOptionsParams contains all the parameters to send to the API endpoint -for the get tax type observable options operation typically these are written to a http.Request +/* GetTaxTypeObservableOptionsParams contains all the parameters to send to the API endpoint + for the get tax type observable options operation. + + Typically these are written to a http.Request. */ type GetTaxTypeObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTaxTypeObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax type observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypeObservableOptionsParams) WithDefaults() *GetTaxTypeObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax type observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypeObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax type observable options params func (o *GetTaxTypeObservableOptionsParams) WithTimeout(timeout time.Duration) *GetTaxTypeObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_tax_type_observable_options_responses.go b/api/geo/geo_client/cors/get_tax_type_observable_options_responses.go index bd05209..56ac7b3 100644 --- a/api/geo/geo_client/cors/get_tax_type_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_tax_type_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetTaxTypeObservableOptionsReader) ReadResponse(response runtime.Client return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetTaxTypeObservableOptionsOK() *GetTaxTypeObservableOptionsOK { return &GetTaxTypeObservableOptionsOK{} } -/*GetTaxTypeObservableOptionsOK handles this case with default header values. +/* GetTaxTypeObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetTaxTypeObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetTaxTypeObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetTaxTypeObservableOptionsOK) Error() string { func (o *GetTaxTypeObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_tax_types_options_parameters.go b/api/geo/geo_client/cors/get_tax_types_options_parameters.go index aca2184..b27902a 100644 --- a/api/geo/geo_client/cors/get_tax_types_options_parameters.go +++ b/api/geo/geo_client/cors/get_tax_types_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxTypesOptionsParams creates a new GetTaxTypesOptionsParams object -// with the default values initialized. +// NewGetTaxTypesOptionsParams creates a new GetTaxTypesOptionsParams 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 NewGetTaxTypesOptionsParams() *GetTaxTypesOptionsParams { - return &GetTaxTypesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxTypesOptionsParamsWithTimeout creates a new GetTaxTypesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxTypesOptionsParamsWithTimeout(timeout time.Duration) *GetTaxTypesOptionsParams { - return &GetTaxTypesOptionsParams{ - timeout: timeout, } } // NewGetTaxTypesOptionsParamsWithContext creates a new GetTaxTypesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxTypesOptionsParamsWithContext(ctx context.Context) *GetTaxTypesOptionsParams { - return &GetTaxTypesOptionsParams{ - Context: ctx, } } // NewGetTaxTypesOptionsParamsWithHTTPClient creates a new GetTaxTypesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxTypesOptionsParamsWithHTTPClient(client *http.Client) *GetTaxTypesOptionsParams { - return &GetTaxTypesOptionsParams{ HTTPClient: client, } } -/*GetTaxTypesOptionsParams contains all the parameters to send to the API endpoint -for the get tax types options operation typically these are written to a http.Request +/* GetTaxTypesOptionsParams contains all the parameters to send to the API endpoint + for the get tax types options operation. + + Typically these are written to a http.Request. */ type GetTaxTypesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTaxTypesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax types options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesOptionsParams) WithDefaults() *GetTaxTypesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax types options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax types options params func (o *GetTaxTypesOptionsParams) WithTimeout(timeout time.Duration) *GetTaxTypesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_tax_types_options_responses.go b/api/geo/geo_client/cors/get_tax_types_options_responses.go index 98b7fbe..e1eefe2 100644 --- a/api/geo/geo_client/cors/get_tax_types_options_responses.go +++ b/api/geo/geo_client/cors/get_tax_types_options_responses.go @@ -30,9 +30,8 @@ func (o *GetTaxTypesOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetTaxTypesOptionsOK() *GetTaxTypesOptionsOK { return &GetTaxTypesOptionsOK{} } -/*GetTaxTypesOptionsOK handles this case with default header values. +/* GetTaxTypesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetTaxTypesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetTaxTypesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetTaxTypesOptionsOK) Error() string { func (o *GetTaxTypesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_parameters.go b/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_parameters.go index 454e809..cde7557 100644 --- a/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_parameters.go +++ b/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxnexusCodesObservableOptionsParams creates a new GetTaxnexusCodesObservableOptionsParams object -// with the default values initialized. +// NewGetTaxnexusCodesObservableOptionsParams creates a new GetTaxnexusCodesObservableOptionsParams 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 NewGetTaxnexusCodesObservableOptionsParams() *GetTaxnexusCodesObservableOptionsParams { - return &GetTaxnexusCodesObservableOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxnexusCodesObservableOptionsParamsWithTimeout creates a new GetTaxnexusCodesObservableOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxnexusCodesObservableOptionsParamsWithTimeout(timeout time.Duration) *GetTaxnexusCodesObservableOptionsParams { - return &GetTaxnexusCodesObservableOptionsParams{ - timeout: timeout, } } // NewGetTaxnexusCodesObservableOptionsParamsWithContext creates a new GetTaxnexusCodesObservableOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxnexusCodesObservableOptionsParamsWithContext(ctx context.Context) *GetTaxnexusCodesObservableOptionsParams { - return &GetTaxnexusCodesObservableOptionsParams{ - Context: ctx, } } // NewGetTaxnexusCodesObservableOptionsParamsWithHTTPClient creates a new GetTaxnexusCodesObservableOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxnexusCodesObservableOptionsParamsWithHTTPClient(client *http.Client) *GetTaxnexusCodesObservableOptionsParams { - return &GetTaxnexusCodesObservableOptionsParams{ HTTPClient: client, } } -/*GetTaxnexusCodesObservableOptionsParams contains all the parameters to send to the API endpoint -for the get taxnexus codes observable options operation typically these are written to a http.Request +/* GetTaxnexusCodesObservableOptionsParams contains all the parameters to send to the API endpoint + for the get taxnexus codes observable options operation. + + Typically these are written to a http.Request. */ type GetTaxnexusCodesObservableOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTaxnexusCodesObservableOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get taxnexus codes observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesObservableOptionsParams) WithDefaults() *GetTaxnexusCodesObservableOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get taxnexus codes observable options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesObservableOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get taxnexus codes observable options params func (o *GetTaxnexusCodesObservableOptionsParams) WithTimeout(timeout time.Duration) *GetTaxnexusCodesObservableOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_responses.go b/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_responses.go index 8282707..f2a5723 100644 --- a/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_responses.go +++ b/api/geo/geo_client/cors/get_taxnexus_codes_observable_options_responses.go @@ -30,9 +30,8 @@ func (o *GetTaxnexusCodesObservableOptionsReader) ReadResponse(response runtime. return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetTaxnexusCodesObservableOptionsOK() *GetTaxnexusCodesObservableOptions return &GetTaxnexusCodesObservableOptionsOK{} } -/*GetTaxnexusCodesObservableOptionsOK handles this case with default header values. +/* GetTaxnexusCodesObservableOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetTaxnexusCodesObservableOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetTaxnexusCodesObservableOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetTaxnexusCodesObservableOptionsOK) Error() string { func (o *GetTaxnexusCodesObservableOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/cors/get_taxnexus_codes_options_parameters.go b/api/geo/geo_client/cors/get_taxnexus_codes_options_parameters.go index 5f5d65b..bfd775b 100644 --- a/api/geo/geo_client/cors/get_taxnexus_codes_options_parameters.go +++ b/api/geo/geo_client/cors/get_taxnexus_codes_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxnexusCodesOptionsParams creates a new GetTaxnexusCodesOptionsParams object -// with the default values initialized. +// NewGetTaxnexusCodesOptionsParams creates a new GetTaxnexusCodesOptionsParams 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 NewGetTaxnexusCodesOptionsParams() *GetTaxnexusCodesOptionsParams { - return &GetTaxnexusCodesOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxnexusCodesOptionsParamsWithTimeout creates a new GetTaxnexusCodesOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxnexusCodesOptionsParamsWithTimeout(timeout time.Duration) *GetTaxnexusCodesOptionsParams { - return &GetTaxnexusCodesOptionsParams{ - timeout: timeout, } } // NewGetTaxnexusCodesOptionsParamsWithContext creates a new GetTaxnexusCodesOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxnexusCodesOptionsParamsWithContext(ctx context.Context) *GetTaxnexusCodesOptionsParams { - return &GetTaxnexusCodesOptionsParams{ - Context: ctx, } } // NewGetTaxnexusCodesOptionsParamsWithHTTPClient creates a new GetTaxnexusCodesOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxnexusCodesOptionsParamsWithHTTPClient(client *http.Client) *GetTaxnexusCodesOptionsParams { - return &GetTaxnexusCodesOptionsParams{ HTTPClient: client, } } -/*GetTaxnexusCodesOptionsParams contains all the parameters to send to the API endpoint -for the get taxnexus codes options operation typically these are written to a http.Request +/* GetTaxnexusCodesOptionsParams contains all the parameters to send to the API endpoint + for the get taxnexus codes options operation. + + Typically these are written to a http.Request. */ type GetTaxnexusCodesOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTaxnexusCodesOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get taxnexus codes options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesOptionsParams) WithDefaults() *GetTaxnexusCodesOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get taxnexus codes options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get taxnexus codes options params func (o *GetTaxnexusCodesOptionsParams) WithTimeout(timeout time.Duration) *GetTaxnexusCodesOptionsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/cors/get_taxnexus_codes_options_responses.go b/api/geo/geo_client/cors/get_taxnexus_codes_options_responses.go index 1bb5d7e..eca4efb 100644 --- a/api/geo/geo_client/cors/get_taxnexus_codes_options_responses.go +++ b/api/geo/geo_client/cors/get_taxnexus_codes_options_responses.go @@ -30,9 +30,8 @@ func (o *GetTaxnexusCodesOptionsReader) ReadResponse(response runtime.ClientResp return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewGetTaxnexusCodesOptionsOK() *GetTaxnexusCodesOptionsOK { return &GetTaxnexusCodesOptionsOK{} } -/*GetTaxnexusCodesOptionsOK handles this case with default header values. +/* GetTaxnexusCodesOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type GetTaxnexusCodesOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *GetTaxnexusCodesOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *GetTaxnexusCodesOptionsOK) Error() string { func (o *GetTaxnexusCodesOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/geo/geo_client/country/country_client.go b/api/geo/geo_client/country/country_client.go index 3059692..dcc0060 100644 --- a/api/geo/geo_client/country/country_client.go +++ b/api/geo/geo_client/country/country_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountriesOK, error) + GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountriesOK, error) - GetCountriesObservable(params *GetCountriesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountriesObservableOK, error) + GetCountriesObservable(params *GetCountriesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountriesObservableOK, error) - PostCountries(params *PostCountriesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCountriesOK, error) + PostCountries(params *PostCountriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCountriesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Retrieve Countries, filter with parameters */ -func (a *Client) GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountriesOK, error) { +func (a *Client) GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountries", Method: "GET", PathPattern: "/countries", @@ -63,7 +65,12 @@ func (a *Client) GetCountries(params *GetCountriesParams, authInfo runtime.Clien 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 } @@ -82,13 +89,12 @@ func (a *Client) GetCountries(params *GetCountriesParams, authInfo runtime.Clien Returns a country retrieval in a observable array */ -func (a *Client) GetCountriesObservable(params *GetCountriesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountriesObservableOK, error) { +func (a *Client) GetCountriesObservable(params *GetCountriesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountriesObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountriesObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountriesObservable", Method: "GET", PathPattern: "/countries/observable", @@ -100,7 +106,12 @@ func (a *Client) GetCountriesObservable(params *GetCountriesObservableParams, au 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 } @@ -119,13 +130,12 @@ func (a *Client) GetCountriesObservable(params *GetCountriesObservableParams, au Create New Countries */ -func (a *Client) PostCountries(params *PostCountriesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCountriesOK, error) { +func (a *Client) PostCountries(params *PostCountriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCountriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCountriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCountries", Method: "POST", PathPattern: "/countries", @@ -137,7 +147,12 @@ func (a *Client) PostCountries(params *PostCountriesParams, authInfo runtime.Cli 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 } diff --git a/api/geo/geo_client/country/get_countries_observable_parameters.go b/api/geo/geo_client/country/get_countries_observable_parameters.go index 9903c1a..6d2bff6 100644 --- a/api/geo/geo_client/country/get_countries_observable_parameters.go +++ b/api/geo/geo_client/country/get_countries_observable_parameters.go @@ -20,58 +20,58 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCountriesObservableParams creates a new GetCountriesObservableParams object -// with the default values initialized. +// NewGetCountriesObservableParams creates a new GetCountriesObservableParams 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 NewGetCountriesObservableParams() *GetCountriesObservableParams { - var () return &GetCountriesObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountriesObservableParamsWithTimeout creates a new GetCountriesObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountriesObservableParamsWithTimeout(timeout time.Duration) *GetCountriesObservableParams { - var () return &GetCountriesObservableParams{ - timeout: timeout, } } // NewGetCountriesObservableParamsWithContext creates a new GetCountriesObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountriesObservableParamsWithContext(ctx context.Context) *GetCountriesObservableParams { - var () return &GetCountriesObservableParams{ - Context: ctx, } } // NewGetCountriesObservableParamsWithHTTPClient creates a new GetCountriesObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountriesObservableParamsWithHTTPClient(client *http.Client) *GetCountriesObservableParams { - var () return &GetCountriesObservableParams{ HTTPClient: client, } } -/*GetCountriesObservableParams contains all the parameters to send to the API endpoint -for the get countries observable operation typically these are written to a http.Request +/* GetCountriesObservableParams contains all the parameters to send to the API endpoint + for the get countries observable operation. + + Typically these are written to a http.Request. */ type GetCountriesObservableParams struct { - /*CountryCode - The Country abbreviation (2 char) + /* CountryCode. + The Country abbreviation (2 char) */ CountryCode *string - /*CountryID - The ID of this Object + /* CountryID. + + The ID of this Object */ CountryID *string @@ -80,6 +80,21 @@ type GetCountriesObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get countries observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesObservableParams) WithDefaults() *GetCountriesObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get countries observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get countries observable params func (o *GetCountriesObservableParams) WithTimeout(timeout time.Duration) *GetCountriesObservableParams { o.SetTimeout(timeout) @@ -147,32 +162,34 @@ func (o *GetCountriesObservableParams) WriteToRequest(r runtime.ClientRequest, r // query param countryCode var qrCountryCode string + if o.CountryCode != nil { qrCountryCode = *o.CountryCode } qCountryCode := qrCountryCode if qCountryCode != "" { + if err := r.SetQueryParam("countryCode", qCountryCode); err != nil { return err } } - } if o.CountryID != nil { // query param countryId var qrCountryID string + if o.CountryID != nil { qrCountryID = *o.CountryID } qCountryID := qrCountryID if qCountryID != "" { + if err := r.SetQueryParam("countryId", qCountryID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/country/get_countries_observable_responses.go b/api/geo/geo_client/country/get_countries_observable_responses.go index 764b072..e8bae1d 100644 --- a/api/geo/geo_client/country/get_countries_observable_responses.go +++ b/api/geo/geo_client/country/get_countries_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetCountriesObservableReader) ReadResponse(response runtime.ClientRespo return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCountriesObservableOK() *GetCountriesObservableOK { return &GetCountriesObservableOK{} } -/*GetCountriesObservableOK handles this case with default header values. +/* GetCountriesObservableOK describes a response with status code 200, with default header values. Observable array response to a country retrieval */ type GetCountriesObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.Country } @@ -89,18 +87,25 @@ type GetCountriesObservableOK struct { func (o *GetCountriesObservableOK) Error() string { return fmt.Sprintf("[GET /countries/observable][%d] getCountriesObservableOK %+v", 200, o.Payload) } - func (o *GetCountriesObservableOK) GetPayload() []*geo_models.Country { return o.Payload } func (o *GetCountriesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetCountriesObservableUnauthorized() *GetCountriesObservableUnauthorized return &GetCountriesObservableUnauthorized{} } -/*GetCountriesObservableUnauthorized handles this case with default header values. +/* GetCountriesObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetCountriesObservableUnauthorized struct { func (o *GetCountriesObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /countries/observable][%d] getCountriesObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetCountriesObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetCountriesObservableForbidden() *GetCountriesObservableForbidden { return &GetCountriesObservableForbidden{} } -/*GetCountriesObservableForbidden handles this case with default header values. +/* GetCountriesObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetCountriesObservableForbidden struct { func (o *GetCountriesObservableForbidden) Error() string { return fmt.Sprintf("[GET /countries/observable][%d] getCountriesObservableForbidden %+v", 403, o.Payload) } - func (o *GetCountriesObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetCountriesObservableNotFound() *GetCountriesObservableNotFound { return &GetCountriesObservableNotFound{} } -/*GetCountriesObservableNotFound handles this case with default header values. +/* GetCountriesObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetCountriesObservableNotFound struct { func (o *GetCountriesObservableNotFound) Error() string { return fmt.Sprintf("[GET /countries/observable][%d] getCountriesObservableNotFound %+v", 404, o.Payload) } - func (o *GetCountriesObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetCountriesObservableUnprocessableEntity() *GetCountriesObservableUnpro return &GetCountriesObservableUnprocessableEntity{} } -/*GetCountriesObservableUnprocessableEntity handles this case with default header values. +/* GetCountriesObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetCountriesObservableUnprocessableEntity struct { func (o *GetCountriesObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /countries/observable][%d] getCountriesObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCountriesObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetCountriesObservableInternalServerError() *GetCountriesObservableInter return &GetCountriesObservableInternalServerError{} } -/*GetCountriesObservableInternalServerError handles this case with default header values. +/* GetCountriesObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetCountriesObservableInternalServerError struct { func (o *GetCountriesObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /countries/observable][%d] getCountriesObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetCountriesObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/country/get_countries_parameters.go b/api/geo/geo_client/country/get_countries_parameters.go index 3c77264..0b2cb06 100644 --- a/api/geo/geo_client/country/get_countries_parameters.go +++ b/api/geo/geo_client/country/get_countries_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCountriesParams creates a new GetCountriesParams object -// with the default values initialized. +// NewGetCountriesParams creates a new GetCountriesParams 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 NewGetCountriesParams() *GetCountriesParams { - var () return &GetCountriesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountriesParamsWithTimeout creates a new GetCountriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountriesParamsWithTimeout(timeout time.Duration) *GetCountriesParams { - var () return &GetCountriesParams{ - timeout: timeout, } } // NewGetCountriesParamsWithContext creates a new GetCountriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountriesParamsWithContext(ctx context.Context) *GetCountriesParams { - var () return &GetCountriesParams{ - Context: ctx, } } // NewGetCountriesParamsWithHTTPClient creates a new GetCountriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountriesParamsWithHTTPClient(client *http.Client) *GetCountriesParams { - var () return &GetCountriesParams{ HTTPClient: client, } } -/*GetCountriesParams contains all the parameters to send to the API endpoint -for the get countries operation typically these are written to a http.Request +/* GetCountriesParams contains all the parameters to send to the API endpoint + for the get countries operation. + + Typically these are written to a http.Request. */ type GetCountriesParams struct { - /*CountryCode - The Country abbreviation (2 char) + /* CountryCode. + The Country abbreviation (2 char) */ CountryCode *string - /*CountryID - The ID of this Object + /* CountryID. + + The ID of this Object */ CountryID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetCountriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get countries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesParams) WithDefaults() *GetCountriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get countries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get countries params func (o *GetCountriesParams) WithTimeout(timeout time.Duration) *GetCountriesParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetCountriesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param countryCode var qrCountryCode string + if o.CountryCode != nil { qrCountryCode = *o.CountryCode } qCountryCode := qrCountryCode if qCountryCode != "" { + if err := r.SetQueryParam("countryCode", qCountryCode); err != nil { return err } } - } if o.CountryID != nil { // query param countryId var qrCountryID string + if o.CountryID != nil { qrCountryID = *o.CountryID } qCountryID := qrCountryID if qCountryID != "" { + if err := r.SetQueryParam("countryId", qCountryID); 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 { diff --git a/api/geo/geo_client/country/get_countries_responses.go b/api/geo/geo_client/country/get_countries_responses.go index 27e1c4d..01fccde 100644 --- a/api/geo/geo_client/country/get_countries_responses.go +++ b/api/geo/geo_client/country/get_countries_responses.go @@ -63,9 +63,8 @@ func (o *GetCountriesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCountriesOK() *GetCountriesOK { return &GetCountriesOK{} } -/*GetCountriesOK handles this case with default header values. +/* GetCountriesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Country objects */ type GetCountriesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.CountryResponse } @@ -89,18 +87,25 @@ type GetCountriesOK struct { func (o *GetCountriesOK) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesOK %+v", 200, o.Payload) } - func (o *GetCountriesOK) GetPayload() *geo_models.CountryResponse { return o.Payload } func (o *GetCountriesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.CountryResponse) @@ -117,7 +122,7 @@ func NewGetCountriesUnauthorized() *GetCountriesUnauthorized { return &GetCountriesUnauthorized{} } -/*GetCountriesUnauthorized handles this case with default header values. +/* GetCountriesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetCountriesUnauthorized struct { func (o *GetCountriesUnauthorized) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesUnauthorized %+v", 401, o.Payload) } - func (o *GetCountriesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetCountriesForbidden() *GetCountriesForbidden { return &GetCountriesForbidden{} } -/*GetCountriesForbidden handles this case with default header values. +/* GetCountriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetCountriesForbidden struct { func (o *GetCountriesForbidden) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesForbidden %+v", 403, o.Payload) } - func (o *GetCountriesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetCountriesNotFound() *GetCountriesNotFound { return &GetCountriesNotFound{} } -/*GetCountriesNotFound handles this case with default header values. +/* GetCountriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetCountriesNotFound struct { func (o *GetCountriesNotFound) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesNotFound %+v", 404, o.Payload) } - func (o *GetCountriesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetCountriesUnprocessableEntity() *GetCountriesUnprocessableEntity { return &GetCountriesUnprocessableEntity{} } -/*GetCountriesUnprocessableEntity handles this case with default header values. +/* GetCountriesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetCountriesUnprocessableEntity struct { func (o *GetCountriesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCountriesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetCountriesInternalServerError() *GetCountriesInternalServerError { return &GetCountriesInternalServerError{} } -/*GetCountriesInternalServerError handles this case with default header values. +/* GetCountriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetCountriesInternalServerError struct { func (o *GetCountriesInternalServerError) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesInternalServerError %+v", 500, o.Payload) } - func (o *GetCountriesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountriesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/country/post_countries_parameters.go b/api/geo/geo_client/country/post_countries_parameters.go index 3f9b0cd..8280c54 100644 --- a/api/geo/geo_client/country/post_countries_parameters.go +++ b/api/geo/geo_client/country/post_countries_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostCountriesParams creates a new PostCountriesParams object -// with the default values initialized. +// NewPostCountriesParams creates a new PostCountriesParams 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 NewPostCountriesParams() *PostCountriesParams { - var () return &PostCountriesParams{ - timeout: cr.DefaultTimeout, } } // NewPostCountriesParamsWithTimeout creates a new PostCountriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCountriesParamsWithTimeout(timeout time.Duration) *PostCountriesParams { - var () return &PostCountriesParams{ - timeout: timeout, } } // NewPostCountriesParamsWithContext creates a new PostCountriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCountriesParamsWithContext(ctx context.Context) *PostCountriesParams { - var () return &PostCountriesParams{ - Context: ctx, } } // NewPostCountriesParamsWithHTTPClient creates a new PostCountriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCountriesParamsWithHTTPClient(client *http.Client) *PostCountriesParams { - var () return &PostCountriesParams{ HTTPClient: client, } } -/*PostCountriesParams contains all the parameters to send to the API endpoint -for the post countries operation typically these are written to a http.Request +/* PostCountriesParams contains all the parameters to send to the API endpoint + for the post countries operation. + + Typically these are written to a http.Request. */ type PostCountriesParams struct { - /*CountryRequest*/ + // CountryRequest. CountryRequest *geo_models.CountryRequest timeout time.Duration @@ -74,6 +73,21 @@ type PostCountriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post countries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCountriesParams) WithDefaults() *PostCountriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post countries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCountriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post countries params func (o *PostCountriesParams) WithTimeout(timeout time.Duration) *PostCountriesParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostCountriesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.CountryRequest != nil { if err := r.SetBodyParam(o.CountryRequest); err != nil { return err diff --git a/api/geo/geo_client/country/post_countries_responses.go b/api/geo/geo_client/country/post_countries_responses.go index 1c7bb41..94a48ed 100644 --- a/api/geo/geo_client/country/post_countries_responses.go +++ b/api/geo/geo_client/country/post_countries_responses.go @@ -57,9 +57,8 @@ func (o *PostCountriesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,14 +67,13 @@ func NewPostCountriesOK() *PostCountriesOK { return &PostCountriesOK{} } -/*PostCountriesOK handles this case with default header values. +/* PostCountriesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Country objects */ type PostCountriesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.CountryResponse } @@ -83,18 +81,25 @@ type PostCountriesOK struct { func (o *PostCountriesOK) Error() string { return fmt.Sprintf("[POST /countries][%d] postCountriesOK %+v", 200, o.Payload) } - func (o *PostCountriesOK) GetPayload() *geo_models.CountryResponse { return o.Payload } func (o *PostCountriesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.CountryResponse) @@ -111,7 +116,7 @@ func NewPostCountriesUnauthorized() *PostCountriesUnauthorized { return &PostCountriesUnauthorized{} } -/*PostCountriesUnauthorized handles this case with default header values. +/* PostCountriesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -124,15 +129,18 @@ type PostCountriesUnauthorized struct { func (o *PostCountriesUnauthorized) Error() string { return fmt.Sprintf("[POST /countries][%d] postCountriesUnauthorized %+v", 401, o.Payload) } - func (o *PostCountriesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountriesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -149,7 +157,7 @@ func NewPostCountriesForbidden() *PostCountriesForbidden { return &PostCountriesForbidden{} } -/*PostCountriesForbidden handles this case with default header values. +/* PostCountriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -162,15 +170,18 @@ type PostCountriesForbidden struct { func (o *PostCountriesForbidden) Error() string { return fmt.Sprintf("[POST /countries][%d] postCountriesForbidden %+v", 403, o.Payload) } - func (o *PostCountriesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountriesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -187,7 +198,7 @@ func NewPostCountriesNotFound() *PostCountriesNotFound { return &PostCountriesNotFound{} } -/*PostCountriesNotFound handles this case with default header values. +/* PostCountriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -200,15 +211,18 @@ type PostCountriesNotFound struct { func (o *PostCountriesNotFound) Error() string { return fmt.Sprintf("[POST /countries][%d] postCountriesNotFound %+v", 404, o.Payload) } - func (o *PostCountriesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountriesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -225,7 +239,7 @@ func NewPostCountriesInternalServerError() *PostCountriesInternalServerError { return &PostCountriesInternalServerError{} } -/*PostCountriesInternalServerError handles this case with default header values. +/* PostCountriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -238,15 +252,18 @@ type PostCountriesInternalServerError struct { func (o *PostCountriesInternalServerError) Error() string { return fmt.Sprintf("[POST /countries][%d] postCountriesInternalServerError %+v", 500, o.Payload) } - func (o *PostCountriesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountriesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/county/county_client.go b/api/geo/geo_client/county/county_client.go index 844ab68..bc7ac1f 100644 --- a/api/geo/geo_client/county/county_client.go +++ b/api/geo/geo_client/county/county_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountiesOK, error) + GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountiesOK, error) - GetCountiesObservable(params *GetCountiesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountiesObservableOK, error) + GetCountiesObservable(params *GetCountiesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountiesObservableOK, error) - PostCounties(params *PostCountiesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCountiesOK, error) + PostCounties(params *PostCountiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCountiesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Retrieve Counties, filter with parameters */ -func (a *Client) GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountiesOK, error) { +func (a *Client) GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCounties", Method: "GET", PathPattern: "/counties", @@ -63,7 +65,12 @@ func (a *Client) GetCounties(params *GetCountiesParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetCounties(params *GetCountiesParams, authInfo runtime.ClientA Returns a county retrieval in a observable array */ -func (a *Client) GetCountiesObservable(params *GetCountiesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountiesObservableOK, error) { +func (a *Client) GetCountiesObservable(params *GetCountiesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountiesObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountiesObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountiesObservable", Method: "GET", PathPattern: "/counties/observable", @@ -100,7 +106,12 @@ func (a *Client) GetCountiesObservable(params *GetCountiesObservableParams, auth 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 } @@ -119,13 +130,12 @@ func (a *Client) GetCountiesObservable(params *GetCountiesObservableParams, auth Create New Counties */ -func (a *Client) PostCounties(params *PostCountiesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCountiesOK, error) { +func (a *Client) PostCounties(params *PostCountiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCountiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCountiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCounties", Method: "POST", PathPattern: "/counties", @@ -137,7 +147,12 @@ func (a *Client) PostCounties(params *PostCountiesParams, authInfo runtime.Clien 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 } diff --git a/api/geo/geo_client/county/get_counties_observable_parameters.go b/api/geo/geo_client/county/get_counties_observable_parameters.go index 2a9f5bc..1aac54e 100644 --- a/api/geo/geo_client/county/get_counties_observable_parameters.go +++ b/api/geo/geo_client/county/get_counties_observable_parameters.go @@ -20,68 +20,70 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCountiesObservableParams creates a new GetCountiesObservableParams object -// with the default values initialized. +// NewGetCountiesObservableParams creates a new GetCountiesObservableParams 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 NewGetCountiesObservableParams() *GetCountiesObservableParams { - var () return &GetCountiesObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountiesObservableParamsWithTimeout creates a new GetCountiesObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountiesObservableParamsWithTimeout(timeout time.Duration) *GetCountiesObservableParams { - var () return &GetCountiesObservableParams{ - timeout: timeout, } } // NewGetCountiesObservableParamsWithContext creates a new GetCountiesObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountiesObservableParamsWithContext(ctx context.Context) *GetCountiesObservableParams { - var () return &GetCountiesObservableParams{ - Context: ctx, } } // NewGetCountiesObservableParamsWithHTTPClient creates a new GetCountiesObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountiesObservableParamsWithHTTPClient(client *http.Client) *GetCountiesObservableParams { - var () return &GetCountiesObservableParams{ HTTPClient: client, } } -/*GetCountiesObservableParams contains all the parameters to send to the API endpoint -for the get counties observable operation typically these are written to a http.Request +/* GetCountiesObservableParams contains all the parameters to send to the API endpoint + for the get counties observable operation. + + Typically these are written to a http.Request. */ type GetCountiesObservableParams struct { - /*County - The County Name + /* County. + The County Name */ County *string - /*CountyID - The ID of this Object + /* CountyID. + + The ID of this Object */ CountyID *string - /*Geocode - The Geocode of this Place record + /* Geocode. + + The Geocode of this Place record */ Geocode *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string @@ -90,6 +92,21 @@ type GetCountiesObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get counties observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesObservableParams) WithDefaults() *GetCountiesObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get counties observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get counties observable params func (o *GetCountiesObservableParams) WithTimeout(timeout time.Duration) *GetCountiesObservableParams { o.SetTimeout(timeout) @@ -179,64 +196,68 @@ func (o *GetCountiesObservableParams) WriteToRequest(r runtime.ClientRequest, re // query param county var qrCounty string + if o.County != nil { qrCounty = *o.County } qCounty := qrCounty if qCounty != "" { + if err := r.SetQueryParam("county", qCounty); err != nil { return err } } - } if o.CountyID != nil { // query param countyId var qrCountyID string + if o.CountyID != nil { qrCountyID = *o.CountyID } qCountyID := qrCountyID if qCountyID != "" { + if err := r.SetQueryParam("countyId", qCountyID); err != nil { return err } } - } if o.Geocode != nil { // query param geocode var qrGeocode string + if o.Geocode != nil { qrGeocode = *o.Geocode } qGeocode := qrGeocode if qGeocode != "" { + if err := r.SetQueryParam("geocode", qGeocode); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/county/get_counties_observable_responses.go b/api/geo/geo_client/county/get_counties_observable_responses.go index 8c58b32..ee32813 100644 --- a/api/geo/geo_client/county/get_counties_observable_responses.go +++ b/api/geo/geo_client/county/get_counties_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetCountiesObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCountiesObservableOK() *GetCountiesObservableOK { return &GetCountiesObservableOK{} } -/*GetCountiesObservableOK handles this case with default header values. +/* GetCountiesObservableOK describes a response with status code 200, with default header values. Observable array response to a county retrieval */ type GetCountiesObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.County } @@ -89,18 +87,25 @@ type GetCountiesObservableOK struct { func (o *GetCountiesObservableOK) Error() string { return fmt.Sprintf("[GET /counties/observable][%d] getCountiesObservableOK %+v", 200, o.Payload) } - func (o *GetCountiesObservableOK) GetPayload() []*geo_models.County { return o.Payload } func (o *GetCountiesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetCountiesObservableUnauthorized() *GetCountiesObservableUnauthorized { return &GetCountiesObservableUnauthorized{} } -/*GetCountiesObservableUnauthorized handles this case with default header values. +/* GetCountiesObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetCountiesObservableUnauthorized struct { func (o *GetCountiesObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /counties/observable][%d] getCountiesObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetCountiesObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetCountiesObservableForbidden() *GetCountiesObservableForbidden { return &GetCountiesObservableForbidden{} } -/*GetCountiesObservableForbidden handles this case with default header values. +/* GetCountiesObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetCountiesObservableForbidden struct { func (o *GetCountiesObservableForbidden) Error() string { return fmt.Sprintf("[GET /counties/observable][%d] getCountiesObservableForbidden %+v", 403, o.Payload) } - func (o *GetCountiesObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetCountiesObservableNotFound() *GetCountiesObservableNotFound { return &GetCountiesObservableNotFound{} } -/*GetCountiesObservableNotFound handles this case with default header values. +/* GetCountiesObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetCountiesObservableNotFound struct { func (o *GetCountiesObservableNotFound) Error() string { return fmt.Sprintf("[GET /counties/observable][%d] getCountiesObservableNotFound %+v", 404, o.Payload) } - func (o *GetCountiesObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetCountiesObservableUnprocessableEntity() *GetCountiesObservableUnproce return &GetCountiesObservableUnprocessableEntity{} } -/*GetCountiesObservableUnprocessableEntity handles this case with default header values. +/* GetCountiesObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetCountiesObservableUnprocessableEntity struct { func (o *GetCountiesObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /counties/observable][%d] getCountiesObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCountiesObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetCountiesObservableInternalServerError() *GetCountiesObservableInterna return &GetCountiesObservableInternalServerError{} } -/*GetCountiesObservableInternalServerError handles this case with default header values. +/* GetCountiesObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetCountiesObservableInternalServerError struct { func (o *GetCountiesObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /counties/observable][%d] getCountiesObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetCountiesObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/county/get_counties_parameters.go b/api/geo/geo_client/county/get_counties_parameters.go index e4e6e4e..015f5ae 100644 --- a/api/geo/geo_client/county/get_counties_parameters.go +++ b/api/geo/geo_client/county/get_counties_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCountiesParams creates a new GetCountiesParams object -// with the default values initialized. +// NewGetCountiesParams creates a new GetCountiesParams 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 NewGetCountiesParams() *GetCountiesParams { - var () return &GetCountiesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountiesParamsWithTimeout creates a new GetCountiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountiesParamsWithTimeout(timeout time.Duration) *GetCountiesParams { - var () return &GetCountiesParams{ - timeout: timeout, } } // NewGetCountiesParamsWithContext creates a new GetCountiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountiesParamsWithContext(ctx context.Context) *GetCountiesParams { - var () return &GetCountiesParams{ - Context: ctx, } } // NewGetCountiesParamsWithHTTPClient creates a new GetCountiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountiesParamsWithHTTPClient(client *http.Client) *GetCountiesParams { - var () return &GetCountiesParams{ HTTPClient: client, } } -/*GetCountiesParams contains all the parameters to send to the API endpoint -for the get counties operation typically these are written to a http.Request +/* GetCountiesParams contains all the parameters to send to the API endpoint + for the get counties operation. + + Typically these are written to a http.Request. */ type GetCountiesParams struct { - /*County - The County Name + /* County. + The County Name */ County *string - /*CountyID - The ID of this Object + /* CountyID. + + The ID of this Object */ CountyID *string - /*Geocode - The Geocode of this Place record + /* Geocode. + + The Geocode of this Place record */ Geocode *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string @@ -101,6 +109,21 @@ type GetCountiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get counties params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesParams) WithDefaults() *GetCountiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get counties params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get counties params func (o *GetCountiesParams) WithTimeout(timeout time.Duration) *GetCountiesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetCountiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param county var qrCounty string + if o.County != nil { qrCounty = *o.County } qCounty := qrCounty if qCounty != "" { + if err := r.SetQueryParam("county", qCounty); err != nil { return err } } - } if o.CountyID != nil { // query param countyId var qrCountyID string + if o.CountyID != nil { qrCountyID = *o.CountyID } qCountyID := qrCountyID if qCountyID != "" { + if err := r.SetQueryParam("countyId", qCountyID); err != nil { return err } } - } if o.Geocode != nil { // query param geocode var qrGeocode string + if o.Geocode != nil { qrGeocode = *o.Geocode } qGeocode := qrGeocode if qGeocode != "" { + if err := r.SetQueryParam("geocode", qGeocode); 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 o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/county/get_counties_responses.go b/api/geo/geo_client/county/get_counties_responses.go index a66542b..1050d40 100644 --- a/api/geo/geo_client/county/get_counties_responses.go +++ b/api/geo/geo_client/county/get_counties_responses.go @@ -63,9 +63,8 @@ func (o *GetCountiesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCountiesOK() *GetCountiesOK { return &GetCountiesOK{} } -/*GetCountiesOK handles this case with default header values. +/* GetCountiesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of County objects */ type GetCountiesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.CountyResponse } @@ -89,18 +87,25 @@ type GetCountiesOK struct { func (o *GetCountiesOK) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesOK %+v", 200, o.Payload) } - func (o *GetCountiesOK) GetPayload() *geo_models.CountyResponse { return o.Payload } func (o *GetCountiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.CountyResponse) @@ -117,7 +122,7 @@ func NewGetCountiesUnauthorized() *GetCountiesUnauthorized { return &GetCountiesUnauthorized{} } -/*GetCountiesUnauthorized handles this case with default header values. +/* GetCountiesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetCountiesUnauthorized struct { func (o *GetCountiesUnauthorized) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesUnauthorized %+v", 401, o.Payload) } - func (o *GetCountiesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetCountiesForbidden() *GetCountiesForbidden { return &GetCountiesForbidden{} } -/*GetCountiesForbidden handles this case with default header values. +/* GetCountiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetCountiesForbidden struct { func (o *GetCountiesForbidden) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesForbidden %+v", 403, o.Payload) } - func (o *GetCountiesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetCountiesNotFound() *GetCountiesNotFound { return &GetCountiesNotFound{} } -/*GetCountiesNotFound handles this case with default header values. +/* GetCountiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetCountiesNotFound struct { func (o *GetCountiesNotFound) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesNotFound %+v", 404, o.Payload) } - func (o *GetCountiesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetCountiesUnprocessableEntity() *GetCountiesUnprocessableEntity { return &GetCountiesUnprocessableEntity{} } -/*GetCountiesUnprocessableEntity handles this case with default header values. +/* GetCountiesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetCountiesUnprocessableEntity struct { func (o *GetCountiesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCountiesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetCountiesInternalServerError() *GetCountiesInternalServerError { return &GetCountiesInternalServerError{} } -/*GetCountiesInternalServerError handles this case with default header values. +/* GetCountiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetCountiesInternalServerError struct { func (o *GetCountiesInternalServerError) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesInternalServerError %+v", 500, o.Payload) } - func (o *GetCountiesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetCountiesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/county/post_counties_parameters.go b/api/geo/geo_client/county/post_counties_parameters.go index be3517b..6d5a2f0 100644 --- a/api/geo/geo_client/county/post_counties_parameters.go +++ b/api/geo/geo_client/county/post_counties_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostCountiesParams creates a new PostCountiesParams object -// with the default values initialized. +// NewPostCountiesParams creates a new PostCountiesParams 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 NewPostCountiesParams() *PostCountiesParams { - var () return &PostCountiesParams{ - timeout: cr.DefaultTimeout, } } // NewPostCountiesParamsWithTimeout creates a new PostCountiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCountiesParamsWithTimeout(timeout time.Duration) *PostCountiesParams { - var () return &PostCountiesParams{ - timeout: timeout, } } // NewPostCountiesParamsWithContext creates a new PostCountiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCountiesParamsWithContext(ctx context.Context) *PostCountiesParams { - var () return &PostCountiesParams{ - Context: ctx, } } // NewPostCountiesParamsWithHTTPClient creates a new PostCountiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCountiesParamsWithHTTPClient(client *http.Client) *PostCountiesParams { - var () return &PostCountiesParams{ HTTPClient: client, } } -/*PostCountiesParams contains all the parameters to send to the API endpoint -for the post counties operation typically these are written to a http.Request +/* PostCountiesParams contains all the parameters to send to the API endpoint + for the post counties operation. + + Typically these are written to a http.Request. */ type PostCountiesParams struct { - /*CountyRequest*/ + // CountyRequest. CountyRequest *geo_models.CountyRequest timeout time.Duration @@ -74,6 +73,21 @@ type PostCountiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post counties params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCountiesParams) WithDefaults() *PostCountiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post counties params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCountiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post counties params func (o *PostCountiesParams) WithTimeout(timeout time.Duration) *PostCountiesParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostCountiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.CountyRequest != nil { if err := r.SetBodyParam(o.CountyRequest); err != nil { return err diff --git a/api/geo/geo_client/county/post_counties_responses.go b/api/geo/geo_client/county/post_counties_responses.go index d152bef..40dfc42 100644 --- a/api/geo/geo_client/county/post_counties_responses.go +++ b/api/geo/geo_client/county/post_counties_responses.go @@ -57,9 +57,8 @@ func (o *PostCountiesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,14 +67,13 @@ func NewPostCountiesOK() *PostCountiesOK { return &PostCountiesOK{} } -/*PostCountiesOK handles this case with default header values. +/* PostCountiesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of County objects */ type PostCountiesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.CountyResponse } @@ -83,18 +81,25 @@ type PostCountiesOK struct { func (o *PostCountiesOK) Error() string { return fmt.Sprintf("[POST /counties][%d] postCountiesOK %+v", 200, o.Payload) } - func (o *PostCountiesOK) GetPayload() *geo_models.CountyResponse { return o.Payload } func (o *PostCountiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.CountyResponse) @@ -111,7 +116,7 @@ func NewPostCountiesUnauthorized() *PostCountiesUnauthorized { return &PostCountiesUnauthorized{} } -/*PostCountiesUnauthorized handles this case with default header values. +/* PostCountiesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -124,15 +129,18 @@ type PostCountiesUnauthorized struct { func (o *PostCountiesUnauthorized) Error() string { return fmt.Sprintf("[POST /counties][%d] postCountiesUnauthorized %+v", 401, o.Payload) } - func (o *PostCountiesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountiesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -149,7 +157,7 @@ func NewPostCountiesForbidden() *PostCountiesForbidden { return &PostCountiesForbidden{} } -/*PostCountiesForbidden handles this case with default header values. +/* PostCountiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -162,15 +170,18 @@ type PostCountiesForbidden struct { func (o *PostCountiesForbidden) Error() string { return fmt.Sprintf("[POST /counties][%d] postCountiesForbidden %+v", 403, o.Payload) } - func (o *PostCountiesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountiesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -187,7 +198,7 @@ func NewPostCountiesNotFound() *PostCountiesNotFound { return &PostCountiesNotFound{} } -/*PostCountiesNotFound handles this case with default header values. +/* PostCountiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -200,15 +211,18 @@ type PostCountiesNotFound struct { func (o *PostCountiesNotFound) Error() string { return fmt.Sprintf("[POST /counties][%d] postCountiesNotFound %+v", 404, o.Payload) } - func (o *PostCountiesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountiesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -225,7 +239,7 @@ func NewPostCountiesInternalServerError() *PostCountiesInternalServerError { return &PostCountiesInternalServerError{} } -/*PostCountiesInternalServerError handles this case with default header values. +/* PostCountiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -238,15 +252,18 @@ type PostCountiesInternalServerError struct { func (o *PostCountiesInternalServerError) Error() string { return fmt.Sprintf("[POST /counties][%d] postCountiesInternalServerError %+v", 500, o.Payload) } - func (o *PostCountiesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostCountiesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/domain/domain_client.go b/api/geo/geo_client/domain/domain_client.go index 180dbdb..4bd5709 100644 --- a/api/geo/geo_client/domain/domain_client.go +++ b/api/geo/geo_client/domain/domain_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetDomainObservable(params *GetDomainObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetDomainObservableOK, error) + GetDomainObservable(params *GetDomainObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainObservableOK, error) - GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter) (*GetDomainsOK, error) + GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainsOK, error) - PostDomains(params *PostDomainsParams, authInfo runtime.ClientAuthInfoWriter) (*PostDomainsOK, error) + PostDomains(params *PostDomainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDomainsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Returns a domain retrieval in a observable array */ -func (a *Client) GetDomainObservable(params *GetDomainObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetDomainObservableOK, error) { +func (a *Client) GetDomainObservable(params *GetDomainObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDomainObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDomainObservable", Method: "GET", PathPattern: "/domains/observable", @@ -63,7 +65,12 @@ func (a *Client) GetDomainObservable(params *GetDomainObservableParams, authInfo 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 } @@ -82,13 +89,12 @@ func (a *Client) GetDomainObservable(params *GetDomainObservableParams, authInfo Return all Domain records or by ID */ -func (a *Client) GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter) (*GetDomainsOK, error) { +func (a *Client) GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDomainsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDomains", Method: "GET", PathPattern: "/domains", @@ -100,7 +106,12 @@ func (a *Client) GetDomains(params *GetDomainsParams, authInfo runtime.ClientAut 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 } @@ -119,13 +130,12 @@ func (a *Client) GetDomains(params *GetDomainsParams, authInfo runtime.ClientAut Store a batch of new Domain records */ -func (a *Client) PostDomains(params *PostDomainsParams, authInfo runtime.ClientAuthInfoWriter) (*PostDomainsOK, error) { +func (a *Client) PostDomains(params *PostDomainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDomainsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostDomainsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postDomains", Method: "POST", PathPattern: "/domains", @@ -137,7 +147,12 @@ func (a *Client) PostDomains(params *PostDomainsParams, authInfo runtime.ClientA 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 } diff --git a/api/geo/geo_client/domain/get_domain_observable_parameters.go b/api/geo/geo_client/domain/get_domain_observable_parameters.go index 9651d55..2970e71 100644 --- a/api/geo/geo_client/domain/get_domain_observable_parameters.go +++ b/api/geo/geo_client/domain/get_domain_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetDomainObservableParams creates a new GetDomainObservableParams object -// with the default values initialized. +// NewGetDomainObservableParams creates a new GetDomainObservableParams 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 NewGetDomainObservableParams() *GetDomainObservableParams { - return &GetDomainObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetDomainObservableParamsWithTimeout creates a new GetDomainObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDomainObservableParamsWithTimeout(timeout time.Duration) *GetDomainObservableParams { - return &GetDomainObservableParams{ - timeout: timeout, } } // NewGetDomainObservableParamsWithContext creates a new GetDomainObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDomainObservableParamsWithContext(ctx context.Context) *GetDomainObservableParams { - return &GetDomainObservableParams{ - Context: ctx, } } // NewGetDomainObservableParamsWithHTTPClient creates a new GetDomainObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDomainObservableParamsWithHTTPClient(client *http.Client) *GetDomainObservableParams { - return &GetDomainObservableParams{ HTTPClient: client, } } -/*GetDomainObservableParams contains all the parameters to send to the API endpoint -for the get domain observable operation typically these are written to a http.Request +/* GetDomainObservableParams contains all the parameters to send to the API endpoint + for the get domain observable operation. + + Typically these are written to a http.Request. */ type GetDomainObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetDomainObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get domain observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainObservableParams) WithDefaults() *GetDomainObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get domain observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get domain observable params func (o *GetDomainObservableParams) WithTimeout(timeout time.Duration) *GetDomainObservableParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/domain/get_domain_observable_responses.go b/api/geo/geo_client/domain/get_domain_observable_responses.go index ccf2b78..705d8e7 100644 --- a/api/geo/geo_client/domain/get_domain_observable_responses.go +++ b/api/geo/geo_client/domain/get_domain_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetDomainObservableReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetDomainObservableOK() *GetDomainObservableOK { return &GetDomainObservableOK{} } -/*GetDomainObservableOK handles this case with default header values. +/* GetDomainObservableOK describes a response with status code 200, with default header values. Observable array response to a domain retrieval */ type GetDomainObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.Domain } @@ -89,18 +87,25 @@ type GetDomainObservableOK struct { func (o *GetDomainObservableOK) Error() string { return fmt.Sprintf("[GET /domains/observable][%d] getDomainObservableOK %+v", 200, o.Payload) } - func (o *GetDomainObservableOK) GetPayload() []*geo_models.Domain { return o.Payload } func (o *GetDomainObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetDomainObservableUnauthorized() *GetDomainObservableUnauthorized { return &GetDomainObservableUnauthorized{} } -/*GetDomainObservableUnauthorized handles this case with default header values. +/* GetDomainObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetDomainObservableUnauthorized struct { func (o *GetDomainObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /domains/observable][%d] getDomainObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetDomainObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetDomainObservableForbidden() *GetDomainObservableForbidden { return &GetDomainObservableForbidden{} } -/*GetDomainObservableForbidden handles this case with default header values. +/* GetDomainObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetDomainObservableForbidden struct { func (o *GetDomainObservableForbidden) Error() string { return fmt.Sprintf("[GET /domains/observable][%d] getDomainObservableForbidden %+v", 403, o.Payload) } - func (o *GetDomainObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetDomainObservableNotFound() *GetDomainObservableNotFound { return &GetDomainObservableNotFound{} } -/*GetDomainObservableNotFound handles this case with default header values. +/* GetDomainObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetDomainObservableNotFound struct { func (o *GetDomainObservableNotFound) Error() string { return fmt.Sprintf("[GET /domains/observable][%d] getDomainObservableNotFound %+v", 404, o.Payload) } - func (o *GetDomainObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetDomainObservableUnprocessableEntity() *GetDomainObservableUnprocessab return &GetDomainObservableUnprocessableEntity{} } -/*GetDomainObservableUnprocessableEntity handles this case with default header values. +/* GetDomainObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetDomainObservableUnprocessableEntity struct { func (o *GetDomainObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /domains/observable][%d] getDomainObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetDomainObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetDomainObservableInternalServerError() *GetDomainObservableInternalSer return &GetDomainObservableInternalServerError{} } -/*GetDomainObservableInternalServerError handles this case with default header values. +/* GetDomainObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetDomainObservableInternalServerError struct { func (o *GetDomainObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /domains/observable][%d] getDomainObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetDomainObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/domain/get_domains_parameters.go b/api/geo/geo_client/domain/get_domains_parameters.go index 94f87ae..b112174 100644 --- a/api/geo/geo_client/domain/get_domains_parameters.go +++ b/api/geo/geo_client/domain/get_domains_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetDomainsParams creates a new GetDomainsParams object -// with the default values initialized. +// NewGetDomainsParams creates a new GetDomainsParams 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 NewGetDomainsParams() *GetDomainsParams { - return &GetDomainsParams{ - timeout: cr.DefaultTimeout, } } // NewGetDomainsParamsWithTimeout creates a new GetDomainsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDomainsParamsWithTimeout(timeout time.Duration) *GetDomainsParams { - return &GetDomainsParams{ - timeout: timeout, } } // NewGetDomainsParamsWithContext creates a new GetDomainsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDomainsParamsWithContext(ctx context.Context) *GetDomainsParams { - return &GetDomainsParams{ - Context: ctx, } } // NewGetDomainsParamsWithHTTPClient creates a new GetDomainsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDomainsParamsWithHTTPClient(client *http.Client) *GetDomainsParams { - return &GetDomainsParams{ HTTPClient: client, } } -/*GetDomainsParams contains all the parameters to send to the API endpoint -for the get domains operation typically these are written to a http.Request +/* GetDomainsParams contains all the parameters to send to the API endpoint + for the get domains operation. + + Typically these are written to a http.Request. */ type GetDomainsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetDomainsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get domains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsParams) WithDefaults() *GetDomainsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get domains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get domains params func (o *GetDomainsParams) WithTimeout(timeout time.Duration) *GetDomainsParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/domain/get_domains_responses.go b/api/geo/geo_client/domain/get_domains_responses.go index 7509fb6..74bf22e 100644 --- a/api/geo/geo_client/domain/get_domains_responses.go +++ b/api/geo/geo_client/domain/get_domains_responses.go @@ -63,9 +63,8 @@ func (o *GetDomainsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetDomainsOK() *GetDomainsOK { return &GetDomainsOK{} } -/*GetDomainsOK handles this case with default header values. +/* GetDomainsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Domain objects */ type GetDomainsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.DomainResponse } @@ -89,18 +87,25 @@ type GetDomainsOK struct { func (o *GetDomainsOK) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsOK %+v", 200, o.Payload) } - func (o *GetDomainsOK) GetPayload() *geo_models.DomainResponse { return o.Payload } func (o *GetDomainsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.DomainResponse) @@ -117,7 +122,7 @@ func NewGetDomainsUnauthorized() *GetDomainsUnauthorized { return &GetDomainsUnauthorized{} } -/*GetDomainsUnauthorized handles this case with default header values. +/* GetDomainsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetDomainsUnauthorized struct { func (o *GetDomainsUnauthorized) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsUnauthorized %+v", 401, o.Payload) } - func (o *GetDomainsUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetDomainsForbidden() *GetDomainsForbidden { return &GetDomainsForbidden{} } -/*GetDomainsForbidden handles this case with default header values. +/* GetDomainsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetDomainsForbidden struct { func (o *GetDomainsForbidden) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsForbidden %+v", 403, o.Payload) } - func (o *GetDomainsForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetDomainsNotFound() *GetDomainsNotFound { return &GetDomainsNotFound{} } -/*GetDomainsNotFound handles this case with default header values. +/* GetDomainsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetDomainsNotFound struct { func (o *GetDomainsNotFound) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsNotFound %+v", 404, o.Payload) } - func (o *GetDomainsNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetDomainsUnprocessableEntity() *GetDomainsUnprocessableEntity { return &GetDomainsUnprocessableEntity{} } -/*GetDomainsUnprocessableEntity handles this case with default header values. +/* GetDomainsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetDomainsUnprocessableEntity struct { func (o *GetDomainsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetDomainsUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetDomainsInternalServerError() *GetDomainsInternalServerError { return &GetDomainsInternalServerError{} } -/*GetDomainsInternalServerError handles this case with default header values. +/* GetDomainsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetDomainsInternalServerError struct { func (o *GetDomainsInternalServerError) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsInternalServerError %+v", 500, o.Payload) } - func (o *GetDomainsInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetDomainsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/domain/post_domains_parameters.go b/api/geo/geo_client/domain/post_domains_parameters.go index 0cf0c88..7c12e8d 100644 --- a/api/geo/geo_client/domain/post_domains_parameters.go +++ b/api/geo/geo_client/domain/post_domains_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostDomainsParams creates a new PostDomainsParams object -// with the default values initialized. +// NewPostDomainsParams creates a new PostDomainsParams 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 NewPostDomainsParams() *PostDomainsParams { - var () return &PostDomainsParams{ - timeout: cr.DefaultTimeout, } } // NewPostDomainsParamsWithTimeout creates a new PostDomainsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostDomainsParamsWithTimeout(timeout time.Duration) *PostDomainsParams { - var () return &PostDomainsParams{ - timeout: timeout, } } // NewPostDomainsParamsWithContext creates a new PostDomainsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostDomainsParamsWithContext(ctx context.Context) *PostDomainsParams { - var () return &PostDomainsParams{ - Context: ctx, } } // NewPostDomainsParamsWithHTTPClient creates a new PostDomainsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostDomainsParamsWithHTTPClient(client *http.Client) *PostDomainsParams { - var () return &PostDomainsParams{ HTTPClient: client, } } -/*PostDomainsParams contains all the parameters to send to the API endpoint -for the post domains operation typically these are written to a http.Request +/* PostDomainsParams contains all the parameters to send to the API endpoint + for the post domains operation. + + Typically these are written to a http.Request. */ type PostDomainsParams struct { - /*DomainRequest*/ + // DomainRequest. DomainRequest *geo_models.DomainRequest timeout time.Duration @@ -74,6 +73,21 @@ type PostDomainsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post domains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostDomainsParams) WithDefaults() *PostDomainsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post domains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostDomainsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post domains params func (o *PostDomainsParams) WithTimeout(timeout time.Duration) *PostDomainsParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostDomainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.DomainRequest != nil { if err := r.SetBodyParam(o.DomainRequest); err != nil { return err diff --git a/api/geo/geo_client/domain/post_domains_responses.go b/api/geo/geo_client/domain/post_domains_responses.go index b296296..09d6bcc 100644 --- a/api/geo/geo_client/domain/post_domains_responses.go +++ b/api/geo/geo_client/domain/post_domains_responses.go @@ -63,9 +63,8 @@ func (o *PostDomainsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostDomainsOK() *PostDomainsOK { return &PostDomainsOK{} } -/*PostDomainsOK handles this case with default header values. +/* PostDomainsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Domain objects */ type PostDomainsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.DomainResponse } @@ -89,18 +87,25 @@ type PostDomainsOK struct { func (o *PostDomainsOK) Error() string { return fmt.Sprintf("[POST /domains][%d] postDomainsOK %+v", 200, o.Payload) } - func (o *PostDomainsOK) GetPayload() *geo_models.DomainResponse { return o.Payload } func (o *PostDomainsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.DomainResponse) @@ -117,7 +122,7 @@ func NewPostDomainsUnauthorized() *PostDomainsUnauthorized { return &PostDomainsUnauthorized{} } -/*PostDomainsUnauthorized handles this case with default header values. +/* PostDomainsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostDomainsUnauthorized struct { func (o *PostDomainsUnauthorized) Error() string { return fmt.Sprintf("[POST /domains][%d] postDomainsUnauthorized %+v", 401, o.Payload) } - func (o *PostDomainsUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostDomainsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewPostDomainsForbidden() *PostDomainsForbidden { return &PostDomainsForbidden{} } -/*PostDomainsForbidden handles this case with default header values. +/* PostDomainsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostDomainsForbidden struct { func (o *PostDomainsForbidden) Error() string { return fmt.Sprintf("[POST /domains][%d] postDomainsForbidden %+v", 403, o.Payload) } - func (o *PostDomainsForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostDomainsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewPostDomainsNotFound() *PostDomainsNotFound { return &PostDomainsNotFound{} } -/*PostDomainsNotFound handles this case with default header values. +/* PostDomainsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostDomainsNotFound struct { func (o *PostDomainsNotFound) Error() string { return fmt.Sprintf("[POST /domains][%d] postDomainsNotFound %+v", 404, o.Payload) } - func (o *PostDomainsNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostDomainsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewPostDomainsUnprocessableEntity() *PostDomainsUnprocessableEntity { return &PostDomainsUnprocessableEntity{} } -/*PostDomainsUnprocessableEntity handles this case with default header values. +/* PostDomainsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostDomainsUnprocessableEntity struct { func (o *PostDomainsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /domains][%d] postDomainsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostDomainsUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *PostDomainsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewPostDomainsInternalServerError() *PostDomainsInternalServerError { return &PostDomainsInternalServerError{} } -/*PostDomainsInternalServerError handles this case with default header values. +/* PostDomainsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostDomainsInternalServerError struct { func (o *PostDomainsInternalServerError) Error() string { return fmt.Sprintf("[POST /domains][%d] postDomainsInternalServerError %+v", 500, o.Payload) } - func (o *PostDomainsInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostDomainsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/place/get_place_observable_parameters.go b/api/geo/geo_client/place/get_place_observable_parameters.go index 8df754f..0023d22 100644 --- a/api/geo/geo_client/place/get_place_observable_parameters.go +++ b/api/geo/geo_client/place/get_place_observable_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPlaceObservableParams creates a new GetPlaceObservableParams object -// with the default values initialized. +// NewGetPlaceObservableParams creates a new GetPlaceObservableParams 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 NewGetPlaceObservableParams() *GetPlaceObservableParams { - var () return &GetPlaceObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlaceObservableParamsWithTimeout creates a new GetPlaceObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlaceObservableParamsWithTimeout(timeout time.Duration) *GetPlaceObservableParams { - var () return &GetPlaceObservableParams{ - timeout: timeout, } } // NewGetPlaceObservableParamsWithContext creates a new GetPlaceObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlaceObservableParamsWithContext(ctx context.Context) *GetPlaceObservableParams { - var () return &GetPlaceObservableParams{ - Context: ctx, } } // NewGetPlaceObservableParamsWithHTTPClient creates a new GetPlaceObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlaceObservableParamsWithHTTPClient(client *http.Client) *GetPlaceObservableParams { - var () return &GetPlaceObservableParams{ HTTPClient: client, } } -/*GetPlaceObservableParams contains all the parameters to send to the API endpoint -for the get place observable operation typically these are written to a http.Request +/* GetPlaceObservableParams contains all the parameters to send to the API endpoint + for the get place observable operation. + + Typically these are written to a http.Request. */ type GetPlaceObservableParams struct { - /*Geocode - The Geocode of this Place record + /* Geocode. + The Geocode of this Place record */ Geocode *string - /*PlaceID - The ID of a Place record + /* PlaceID. + + The ID of a Place record */ PlaceID *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string @@ -85,6 +86,21 @@ type GetPlaceObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get place observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlaceObservableParams) WithDefaults() *GetPlaceObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get place observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlaceObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get place observable params func (o *GetPlaceObservableParams) WithTimeout(timeout time.Duration) *GetPlaceObservableParams { o.SetTimeout(timeout) @@ -163,48 +179,51 @@ func (o *GetPlaceObservableParams) WriteToRequest(r runtime.ClientRequest, reg s // query param geocode var qrGeocode string + if o.Geocode != nil { qrGeocode = *o.Geocode } qGeocode := qrGeocode if qGeocode != "" { + if err := r.SetQueryParam("geocode", qGeocode); err != nil { return err } } - } if o.PlaceID != nil { // query param placeId var qrPlaceID string + if o.PlaceID != nil { qrPlaceID = *o.PlaceID } qPlaceID := qrPlaceID if qPlaceID != "" { + if err := r.SetQueryParam("placeId", qPlaceID); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/place/get_place_observable_responses.go b/api/geo/geo_client/place/get_place_observable_responses.go index a3623a8..7f13456 100644 --- a/api/geo/geo_client/place/get_place_observable_responses.go +++ b/api/geo/geo_client/place/get_place_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetPlaceObservableReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetPlaceObservableOK() *GetPlaceObservableOK { return &GetPlaceObservableOK{} } -/*GetPlaceObservableOK handles this case with default header values. +/* GetPlaceObservableOK describes a response with status code 200, with default header values. Observable array response to a place retrieval */ type GetPlaceObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.Place } @@ -89,18 +87,25 @@ type GetPlaceObservableOK struct { func (o *GetPlaceObservableOK) Error() string { return fmt.Sprintf("[GET /places/observable][%d] getPlaceObservableOK %+v", 200, o.Payload) } - func (o *GetPlaceObservableOK) GetPayload() []*geo_models.Place { return o.Payload } func (o *GetPlaceObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetPlaceObservableUnauthorized() *GetPlaceObservableUnauthorized { return &GetPlaceObservableUnauthorized{} } -/*GetPlaceObservableUnauthorized handles this case with default header values. +/* GetPlaceObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetPlaceObservableUnauthorized struct { func (o *GetPlaceObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /places/observable][%d] getPlaceObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetPlaceObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlaceObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetPlaceObservableForbidden() *GetPlaceObservableForbidden { return &GetPlaceObservableForbidden{} } -/*GetPlaceObservableForbidden handles this case with default header values. +/* GetPlaceObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetPlaceObservableForbidden struct { func (o *GetPlaceObservableForbidden) Error() string { return fmt.Sprintf("[GET /places/observable][%d] getPlaceObservableForbidden %+v", 403, o.Payload) } - func (o *GetPlaceObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlaceObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetPlaceObservableNotFound() *GetPlaceObservableNotFound { return &GetPlaceObservableNotFound{} } -/*GetPlaceObservableNotFound handles this case with default header values. +/* GetPlaceObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetPlaceObservableNotFound struct { func (o *GetPlaceObservableNotFound) Error() string { return fmt.Sprintf("[GET /places/observable][%d] getPlaceObservableNotFound %+v", 404, o.Payload) } - func (o *GetPlaceObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlaceObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetPlaceObservableUnprocessableEntity() *GetPlaceObservableUnprocessable return &GetPlaceObservableUnprocessableEntity{} } -/*GetPlaceObservableUnprocessableEntity handles this case with default header values. +/* GetPlaceObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetPlaceObservableUnprocessableEntity struct { func (o *GetPlaceObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /places/observable][%d] getPlaceObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPlaceObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlaceObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetPlaceObservableInternalServerError() *GetPlaceObservableInternalServe return &GetPlaceObservableInternalServerError{} } -/*GetPlaceObservableInternalServerError handles this case with default header values. +/* GetPlaceObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetPlaceObservableInternalServerError struct { func (o *GetPlaceObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /places/observable][%d] getPlaceObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetPlaceObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlaceObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/place/get_places_parameters.go b/api/geo/geo_client/place/get_places_parameters.go index 103ec31..e143025 100644 --- a/api/geo/geo_client/place/get_places_parameters.go +++ b/api/geo/geo_client/place/get_places_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPlacesParams creates a new GetPlacesParams object -// with the default values initialized. +// NewGetPlacesParams creates a new GetPlacesParams 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 NewGetPlacesParams() *GetPlacesParams { - var () return &GetPlacesParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlacesParamsWithTimeout creates a new GetPlacesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlacesParamsWithTimeout(timeout time.Duration) *GetPlacesParams { - var () return &GetPlacesParams{ - timeout: timeout, } } // NewGetPlacesParamsWithContext creates a new GetPlacesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlacesParamsWithContext(ctx context.Context) *GetPlacesParams { - var () return &GetPlacesParams{ - Context: ctx, } } // NewGetPlacesParamsWithHTTPClient creates a new GetPlacesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlacesParamsWithHTTPClient(client *http.Client) *GetPlacesParams { - var () return &GetPlacesParams{ HTTPClient: client, } } -/*GetPlacesParams contains all the parameters to send to the API endpoint -for the get places operation typically these are written to a http.Request +/* GetPlacesParams contains all the parameters to send to the API endpoint + for the get places operation. + + Typically these are written to a http.Request. */ type GetPlacesParams struct { - /*Geocode - The Geocode of this Place record + /* Geocode. + The Geocode of this Place record */ Geocode *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*PlaceID - The ID of a Place record + /* PlaceID. + + The ID of a Place record */ PlaceID *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string @@ -96,6 +103,21 @@ type GetPlacesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get places params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesParams) WithDefaults() *GetPlacesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get places params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get places params func (o *GetPlacesParams) WithTimeout(timeout time.Duration) *GetPlacesParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetPlacesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // query param geocode var qrGeocode string + if o.Geocode != nil { qrGeocode = *o.Geocode } qGeocode := qrGeocode if qGeocode != "" { + if err := r.SetQueryParam("geocode", qGeocode); 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 o.PlaceID != nil { // query param placeId var qrPlaceID string + if o.PlaceID != nil { qrPlaceID = *o.PlaceID } qPlaceID := qrPlaceID if qPlaceID != "" { + if err := r.SetQueryParam("placeId", qPlaceID); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/place/get_places_responses.go b/api/geo/geo_client/place/get_places_responses.go index 50e6272..cdd6245 100644 --- a/api/geo/geo_client/place/get_places_responses.go +++ b/api/geo/geo_client/place/get_places_responses.go @@ -63,9 +63,8 @@ func (o *GetPlacesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetPlacesOK() *GetPlacesOK { return &GetPlacesOK{} } -/*GetPlacesOK handles this case with default header values. +/* GetPlacesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Place objects */ type GetPlacesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.PlaceResponse } @@ -89,18 +87,25 @@ type GetPlacesOK struct { func (o *GetPlacesOK) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesOK %+v", 200, o.Payload) } - func (o *GetPlacesOK) GetPayload() *geo_models.PlaceResponse { return o.Payload } func (o *GetPlacesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.PlaceResponse) @@ -117,7 +122,7 @@ func NewGetPlacesUnauthorized() *GetPlacesUnauthorized { return &GetPlacesUnauthorized{} } -/*GetPlacesUnauthorized handles this case with default header values. +/* GetPlacesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetPlacesUnauthorized struct { func (o *GetPlacesUnauthorized) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesUnauthorized %+v", 401, o.Payload) } - func (o *GetPlacesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlacesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetPlacesForbidden() *GetPlacesForbidden { return &GetPlacesForbidden{} } -/*GetPlacesForbidden handles this case with default header values. +/* GetPlacesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetPlacesForbidden struct { func (o *GetPlacesForbidden) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesForbidden %+v", 403, o.Payload) } - func (o *GetPlacesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlacesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetPlacesNotFound() *GetPlacesNotFound { return &GetPlacesNotFound{} } -/*GetPlacesNotFound handles this case with default header values. +/* GetPlacesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetPlacesNotFound struct { func (o *GetPlacesNotFound) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesNotFound %+v", 404, o.Payload) } - func (o *GetPlacesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlacesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetPlacesUnprocessableEntity() *GetPlacesUnprocessableEntity { return &GetPlacesUnprocessableEntity{} } -/*GetPlacesUnprocessableEntity handles this case with default header values. +/* GetPlacesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetPlacesUnprocessableEntity struct { func (o *GetPlacesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPlacesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlacesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetPlacesInternalServerError() *GetPlacesInternalServerError { return &GetPlacesInternalServerError{} } -/*GetPlacesInternalServerError handles this case with default header values. +/* GetPlacesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetPlacesInternalServerError struct { func (o *GetPlacesInternalServerError) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesInternalServerError %+v", 500, o.Payload) } - func (o *GetPlacesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetPlacesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/place/place_client.go b/api/geo/geo_client/place/place_client.go index de430c7..e2af26c 100644 --- a/api/geo/geo_client/place/place_client.go +++ b/api/geo/geo_client/place/place_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetPlaceObservable(params *GetPlaceObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlaceObservableOK, error) + GetPlaceObservable(params *GetPlaceObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlaceObservableOK, error) - GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlacesOK, error) + GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlacesOK, error) - PostPlaces(params *PostPlacesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlacesOK, error) + PostPlaces(params *PostPlacesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPlacesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Returns a place retrieval in a observable array */ -func (a *Client) GetPlaceObservable(params *GetPlaceObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlaceObservableOK, error) { +func (a *Client) GetPlaceObservable(params *GetPlaceObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlaceObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlaceObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlaceObservable", Method: "GET", PathPattern: "/places/observable", @@ -63,7 +65,12 @@ func (a *Client) GetPlaceObservable(params *GetPlaceObservableParams, authInfo r 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 } @@ -82,13 +89,12 @@ func (a *Client) GetPlaceObservable(params *GetPlaceObservableParams, authInfo r Retrieve Places, filter with parameters */ -func (a *Client) GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlacesOK, error) { +func (a *Client) GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlacesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlacesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlaces", Method: "GET", PathPattern: "/places", @@ -100,7 +106,12 @@ func (a *Client) GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthI 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 } @@ -119,13 +130,12 @@ func (a *Client) GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthI Store a batch of new Place records */ -func (a *Client) PostPlaces(params *PostPlacesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlacesOK, error) { +func (a *Client) PostPlaces(params *PostPlacesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPlacesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPlacesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPlaces", Method: "POST", PathPattern: "/places", @@ -137,7 +147,12 @@ func (a *Client) PostPlaces(params *PostPlacesParams, authInfo runtime.ClientAut 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 } diff --git a/api/geo/geo_client/place/post_places_parameters.go b/api/geo/geo_client/place/post_places_parameters.go index e116cd0..813e009 100644 --- a/api/geo/geo_client/place/post_places_parameters.go +++ b/api/geo/geo_client/place/post_places_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostPlacesParams creates a new PostPlacesParams object -// with the default values initialized. +// NewPostPlacesParams creates a new PostPlacesParams 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 NewPostPlacesParams() *PostPlacesParams { - var () return &PostPlacesParams{ - timeout: cr.DefaultTimeout, } } // NewPostPlacesParamsWithTimeout creates a new PostPlacesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPlacesParamsWithTimeout(timeout time.Duration) *PostPlacesParams { - var () return &PostPlacesParams{ - timeout: timeout, } } // NewPostPlacesParamsWithContext creates a new PostPlacesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPlacesParamsWithContext(ctx context.Context) *PostPlacesParams { - var () return &PostPlacesParams{ - Context: ctx, } } // NewPostPlacesParamsWithHTTPClient creates a new PostPlacesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPlacesParamsWithHTTPClient(client *http.Client) *PostPlacesParams { - var () return &PostPlacesParams{ HTTPClient: client, } } -/*PostPlacesParams contains all the parameters to send to the API endpoint -for the post places operation typically these are written to a http.Request +/* PostPlacesParams contains all the parameters to send to the API endpoint + for the post places operation. + + Typically these are written to a http.Request. */ type PostPlacesParams struct { - /*PlaceRequest - The new Places request package + /* PlaceRequest. + The new Places request package */ PlaceRequest *geo_models.PlaceRequest @@ -77,6 +76,21 @@ type PostPlacesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post places params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPlacesParams) WithDefaults() *PostPlacesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post places params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPlacesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post places params func (o *PostPlacesParams) WithTimeout(timeout time.Duration) *PostPlacesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPlacesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.PlaceRequest != nil { if err := r.SetBodyParam(o.PlaceRequest); err != nil { return err diff --git a/api/geo/geo_client/place/post_places_responses.go b/api/geo/geo_client/place/post_places_responses.go index 7425cca..8bf0c5a 100644 --- a/api/geo/geo_client/place/post_places_responses.go +++ b/api/geo/geo_client/place/post_places_responses.go @@ -63,9 +63,8 @@ func (o *PostPlacesReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostPlacesOK() *PostPlacesOK { return &PostPlacesOK{} } -/*PostPlacesOK handles this case with default header values. +/* PostPlacesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Place objects */ type PostPlacesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.PlaceResponse } @@ -89,18 +87,25 @@ type PostPlacesOK struct { func (o *PostPlacesOK) Error() string { return fmt.Sprintf("[POST /places][%d] postPlacesOK %+v", 200, o.Payload) } - func (o *PostPlacesOK) GetPayload() *geo_models.PlaceResponse { return o.Payload } func (o *PostPlacesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.PlaceResponse) @@ -117,7 +122,7 @@ func NewPostPlacesUnauthorized() *PostPlacesUnauthorized { return &PostPlacesUnauthorized{} } -/*PostPlacesUnauthorized handles this case with default header values. +/* PostPlacesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostPlacesUnauthorized struct { func (o *PostPlacesUnauthorized) Error() string { return fmt.Sprintf("[POST /places][%d] postPlacesUnauthorized %+v", 401, o.Payload) } - func (o *PostPlacesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostPlacesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewPostPlacesForbidden() *PostPlacesForbidden { return &PostPlacesForbidden{} } -/*PostPlacesForbidden handles this case with default header values. +/* PostPlacesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostPlacesForbidden struct { func (o *PostPlacesForbidden) Error() string { return fmt.Sprintf("[POST /places][%d] postPlacesForbidden %+v", 403, o.Payload) } - func (o *PostPlacesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostPlacesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewPostPlacesNotFound() *PostPlacesNotFound { return &PostPlacesNotFound{} } -/*PostPlacesNotFound handles this case with default header values. +/* PostPlacesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostPlacesNotFound struct { func (o *PostPlacesNotFound) Error() string { return fmt.Sprintf("[POST /places][%d] postPlacesNotFound %+v", 404, o.Payload) } - func (o *PostPlacesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostPlacesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewPostPlacesUnprocessableEntity() *PostPlacesUnprocessableEntity { return &PostPlacesUnprocessableEntity{} } -/*PostPlacesUnprocessableEntity handles this case with default header values. +/* PostPlacesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostPlacesUnprocessableEntity struct { func (o *PostPlacesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /places][%d] postPlacesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostPlacesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *PostPlacesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewPostPlacesInternalServerError() *PostPlacesInternalServerError { return &PostPlacesInternalServerError{} } -/*PostPlacesInternalServerError handles this case with default header values. +/* PostPlacesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostPlacesInternalServerError struct { func (o *PostPlacesInternalServerError) Error() string { return fmt.Sprintf("[POST /places][%d] postPlacesInternalServerError %+v", 500, o.Payload) } - func (o *PostPlacesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostPlacesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/state/get_state_observable_parameters.go b/api/geo/geo_client/state/get_state_observable_parameters.go index b1c4de4..c0ab97c 100644 --- a/api/geo/geo_client/state/get_state_observable_parameters.go +++ b/api/geo/geo_client/state/get_state_observable_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetStateObservableParams creates a new GetStateObservableParams object -// with the default values initialized. +// NewGetStateObservableParams creates a new GetStateObservableParams 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 NewGetStateObservableParams() *GetStateObservableParams { - var () return &GetStateObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetStateObservableParamsWithTimeout creates a new GetStateObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStateObservableParamsWithTimeout(timeout time.Duration) *GetStateObservableParams { - var () return &GetStateObservableParams{ - timeout: timeout, } } // NewGetStateObservableParamsWithContext creates a new GetStateObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStateObservableParamsWithContext(ctx context.Context) *GetStateObservableParams { - var () return &GetStateObservableParams{ - Context: ctx, } } // NewGetStateObservableParamsWithHTTPClient creates a new GetStateObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStateObservableParamsWithHTTPClient(client *http.Client) *GetStateObservableParams { - var () return &GetStateObservableParams{ HTTPClient: client, } } -/*GetStateObservableParams contains all the parameters to send to the API endpoint -for the get state observable operation typically these are written to a http.Request +/* GetStateObservableParams contains all the parameters to send to the API endpoint + for the get state observable operation. + + Typically these are written to a http.Request. */ type GetStateObservableParams struct { - /*StateID - The ID of this Object + /* StateID. + The ID of this Object */ StateID *string - /*CountryCode - The Country abbreviation (2 char) + /* CountryCode. + + The Country abbreviation (2 char) */ CountryCode *string - /*Geocode - The Geocode of this Place record + /* Geocode. + + The Geocode of this Place record */ Geocode *string @@ -85,6 +86,21 @@ type GetStateObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get state observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStateObservableParams) WithDefaults() *GetStateObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get state observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStateObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get state observable params func (o *GetStateObservableParams) WithTimeout(timeout time.Duration) *GetStateObservableParams { o.SetTimeout(timeout) @@ -163,48 +179,51 @@ func (o *GetStateObservableParams) WriteToRequest(r runtime.ClientRequest, reg s // query param StateID var qrStateID string + if o.StateID != nil { qrStateID = *o.StateID } qStateID := qrStateID if qStateID != "" { + if err := r.SetQueryParam("StateID", qStateID); err != nil { return err } } - } if o.CountryCode != nil { // query param countryCode var qrCountryCode string + if o.CountryCode != nil { qrCountryCode = *o.CountryCode } qCountryCode := qrCountryCode if qCountryCode != "" { + if err := r.SetQueryParam("countryCode", qCountryCode); err != nil { return err } } - } if o.Geocode != nil { // query param geocode var qrGeocode string + if o.Geocode != nil { qrGeocode = *o.Geocode } qGeocode := qrGeocode if qGeocode != "" { + if err := r.SetQueryParam("geocode", qGeocode); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/state/get_state_observable_responses.go b/api/geo/geo_client/state/get_state_observable_responses.go index b407f3e..a8ca9b4 100644 --- a/api/geo/geo_client/state/get_state_observable_responses.go +++ b/api/geo/geo_client/state/get_state_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetStateObservableReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetStateObservableOK() *GetStateObservableOK { return &GetStateObservableOK{} } -/*GetStateObservableOK handles this case with default header values. +/* GetStateObservableOK describes a response with status code 200, with default header values. Observable array response to a state retrieval */ type GetStateObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.State } @@ -89,18 +87,25 @@ type GetStateObservableOK struct { func (o *GetStateObservableOK) Error() string { return fmt.Sprintf("[GET /states/observable][%d] getStateObservableOK %+v", 200, o.Payload) } - func (o *GetStateObservableOK) GetPayload() []*geo_models.State { return o.Payload } func (o *GetStateObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetStateObservableUnauthorized() *GetStateObservableUnauthorized { return &GetStateObservableUnauthorized{} } -/*GetStateObservableUnauthorized handles this case with default header values. +/* GetStateObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetStateObservableUnauthorized struct { func (o *GetStateObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /states/observable][%d] getStateObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetStateObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStateObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetStateObservableForbidden() *GetStateObservableForbidden { return &GetStateObservableForbidden{} } -/*GetStateObservableForbidden handles this case with default header values. +/* GetStateObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetStateObservableForbidden struct { func (o *GetStateObservableForbidden) Error() string { return fmt.Sprintf("[GET /states/observable][%d] getStateObservableForbidden %+v", 403, o.Payload) } - func (o *GetStateObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStateObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetStateObservableNotFound() *GetStateObservableNotFound { return &GetStateObservableNotFound{} } -/*GetStateObservableNotFound handles this case with default header values. +/* GetStateObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetStateObservableNotFound struct { func (o *GetStateObservableNotFound) Error() string { return fmt.Sprintf("[GET /states/observable][%d] getStateObservableNotFound %+v", 404, o.Payload) } - func (o *GetStateObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStateObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetStateObservableUnprocessableEntity() *GetStateObservableUnprocessable return &GetStateObservableUnprocessableEntity{} } -/*GetStateObservableUnprocessableEntity handles this case with default header values. +/* GetStateObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetStateObservableUnprocessableEntity struct { func (o *GetStateObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /states/observable][%d] getStateObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetStateObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStateObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetStateObservableInternalServerError() *GetStateObservableInternalServe return &GetStateObservableInternalServerError{} } -/*GetStateObservableInternalServerError handles this case with default header values. +/* GetStateObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetStateObservableInternalServerError struct { func (o *GetStateObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /states/observable][%d] getStateObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetStateObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStateObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/state/get_states_parameters.go b/api/geo/geo_client/state/get_states_parameters.go index 974655f..d57b07b 100644 --- a/api/geo/geo_client/state/get_states_parameters.go +++ b/api/geo/geo_client/state/get_states_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetStatesParams creates a new GetStatesParams object -// with the default values initialized. +// NewGetStatesParams creates a new GetStatesParams 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 NewGetStatesParams() *GetStatesParams { - var () return &GetStatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetStatesParamsWithTimeout creates a new GetStatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStatesParamsWithTimeout(timeout time.Duration) *GetStatesParams { - var () return &GetStatesParams{ - timeout: timeout, } } // NewGetStatesParamsWithContext creates a new GetStatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStatesParamsWithContext(ctx context.Context) *GetStatesParams { - var () return &GetStatesParams{ - Context: ctx, } } // NewGetStatesParamsWithHTTPClient creates a new GetStatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStatesParamsWithHTTPClient(client *http.Client) *GetStatesParams { - var () return &GetStatesParams{ HTTPClient: client, } } -/*GetStatesParams contains all the parameters to send to the API endpoint -for the get states operation typically these are written to a http.Request +/* GetStatesParams contains all the parameters to send to the API endpoint + for the get states operation. + + Typically these are written to a http.Request. */ type GetStatesParams struct { - /*StateID - The ID of this Object + /* StateID. + The ID of this Object */ StateID *string - /*CountryCode - The Country abbreviation (2 char) + /* CountryCode. + + The Country abbreviation (2 char) */ CountryCode *string - /*Geocode - The Geocode of this Place record + /* Geocode. + + The Geocode of this Place record */ Geocode *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -96,6 +103,21 @@ type GetStatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesParams) WithDefaults() *GetStatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get states params func (o *GetStatesParams) WithTimeout(timeout time.Duration) *GetStatesParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetStatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // query param StateID var qrStateID string + if o.StateID != nil { qrStateID = *o.StateID } qStateID := qrStateID if qStateID != "" { + if err := r.SetQueryParam("StateID", qStateID); err != nil { return err } } - } if o.CountryCode != nil { // query param countryCode var qrCountryCode string + if o.CountryCode != nil { qrCountryCode = *o.CountryCode } qCountryCode := qrCountryCode if qCountryCode != "" { + if err := r.SetQueryParam("countryCode", qCountryCode); err != nil { return err } } - } if o.Geocode != nil { // query param geocode var qrGeocode string + if o.Geocode != nil { qrGeocode = *o.Geocode } qGeocode := qrGeocode if qGeocode != "" { + if err := r.SetQueryParam("geocode", qGeocode); 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 { diff --git a/api/geo/geo_client/state/get_states_responses.go b/api/geo/geo_client/state/get_states_responses.go index 16d5b6d..9ea1c37 100644 --- a/api/geo/geo_client/state/get_states_responses.go +++ b/api/geo/geo_client/state/get_states_responses.go @@ -63,9 +63,8 @@ func (o *GetStatesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetStatesOK() *GetStatesOK { return &GetStatesOK{} } -/*GetStatesOK handles this case with default header values. +/* GetStatesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of State objects */ type GetStatesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.StateResponse } @@ -89,18 +87,25 @@ type GetStatesOK struct { func (o *GetStatesOK) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesOK %+v", 200, o.Payload) } - func (o *GetStatesOK) GetPayload() *geo_models.StateResponse { return o.Payload } func (o *GetStatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.StateResponse) @@ -117,7 +122,7 @@ func NewGetStatesUnauthorized() *GetStatesUnauthorized { return &GetStatesUnauthorized{} } -/*GetStatesUnauthorized handles this case with default header values. +/* GetStatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetStatesUnauthorized struct { func (o *GetStatesUnauthorized) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesUnauthorized %+v", 401, o.Payload) } - func (o *GetStatesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetStatesForbidden() *GetStatesForbidden { return &GetStatesForbidden{} } -/*GetStatesForbidden handles this case with default header values. +/* GetStatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetStatesForbidden struct { func (o *GetStatesForbidden) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesForbidden %+v", 403, o.Payload) } - func (o *GetStatesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetStatesNotFound() *GetStatesNotFound { return &GetStatesNotFound{} } -/*GetStatesNotFound handles this case with default header values. +/* GetStatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetStatesNotFound struct { func (o *GetStatesNotFound) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesNotFound %+v", 404, o.Payload) } - func (o *GetStatesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetStatesUnprocessableEntity() *GetStatesUnprocessableEntity { return &GetStatesUnprocessableEntity{} } -/*GetStatesUnprocessableEntity handles this case with default header values. +/* GetStatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetStatesUnprocessableEntity struct { func (o *GetStatesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetStatesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetStatesInternalServerError() *GetStatesInternalServerError { return &GetStatesInternalServerError{} } -/*GetStatesInternalServerError handles this case with default header values. +/* GetStatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetStatesInternalServerError struct { func (o *GetStatesInternalServerError) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesInternalServerError %+v", 500, o.Payload) } - func (o *GetStatesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetStatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/state/post_states_parameters.go b/api/geo/geo_client/state/post_states_parameters.go index dd1ed69..fa103a2 100644 --- a/api/geo/geo_client/state/post_states_parameters.go +++ b/api/geo/geo_client/state/post_states_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostStatesParams creates a new PostStatesParams object -// with the default values initialized. +// NewPostStatesParams creates a new PostStatesParams 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 NewPostStatesParams() *PostStatesParams { - var () return &PostStatesParams{ - timeout: cr.DefaultTimeout, } } // NewPostStatesParamsWithTimeout creates a new PostStatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostStatesParamsWithTimeout(timeout time.Duration) *PostStatesParams { - var () return &PostStatesParams{ - timeout: timeout, } } // NewPostStatesParamsWithContext creates a new PostStatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostStatesParamsWithContext(ctx context.Context) *PostStatesParams { - var () return &PostStatesParams{ - Context: ctx, } } // NewPostStatesParamsWithHTTPClient creates a new PostStatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostStatesParamsWithHTTPClient(client *http.Client) *PostStatesParams { - var () return &PostStatesParams{ HTTPClient: client, } } -/*PostStatesParams contains all the parameters to send to the API endpoint -for the post states operation typically these are written to a http.Request +/* PostStatesParams contains all the parameters to send to the API endpoint + for the post states operation. + + Typically these are written to a http.Request. */ type PostStatesParams struct { - /*StateRequest - The new Places request package + /* StateRequest. + The new Places request package */ StateRequest *geo_models.StateRequest @@ -77,6 +76,21 @@ type PostStatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostStatesParams) WithDefaults() *PostStatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostStatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post states params func (o *PostStatesParams) WithTimeout(timeout time.Duration) *PostStatesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostStatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.StateRequest != nil { if err := r.SetBodyParam(o.StateRequest); err != nil { return err diff --git a/api/geo/geo_client/state/post_states_responses.go b/api/geo/geo_client/state/post_states_responses.go index 8642d5f..cfd9461 100644 --- a/api/geo/geo_client/state/post_states_responses.go +++ b/api/geo/geo_client/state/post_states_responses.go @@ -63,9 +63,8 @@ func (o *PostStatesReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostStatesOK() *PostStatesOK { return &PostStatesOK{} } -/*PostStatesOK handles this case with default header values. +/* PostStatesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of State objects */ type PostStatesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.StateResponse } @@ -89,18 +87,25 @@ type PostStatesOK struct { func (o *PostStatesOK) Error() string { return fmt.Sprintf("[POST /states][%d] postStatesOK %+v", 200, o.Payload) } - func (o *PostStatesOK) GetPayload() *geo_models.StateResponse { return o.Payload } func (o *PostStatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.StateResponse) @@ -117,7 +122,7 @@ func NewPostStatesUnauthorized() *PostStatesUnauthorized { return &PostStatesUnauthorized{} } -/*PostStatesUnauthorized handles this case with default header values. +/* PostStatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostStatesUnauthorized struct { func (o *PostStatesUnauthorized) Error() string { return fmt.Sprintf("[POST /states][%d] postStatesUnauthorized %+v", 401, o.Payload) } - func (o *PostStatesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostStatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewPostStatesForbidden() *PostStatesForbidden { return &PostStatesForbidden{} } -/*PostStatesForbidden handles this case with default header values. +/* PostStatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostStatesForbidden struct { func (o *PostStatesForbidden) Error() string { return fmt.Sprintf("[POST /states][%d] postStatesForbidden %+v", 403, o.Payload) } - func (o *PostStatesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostStatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewPostStatesNotFound() *PostStatesNotFound { return &PostStatesNotFound{} } -/*PostStatesNotFound handles this case with default header values. +/* PostStatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostStatesNotFound struct { func (o *PostStatesNotFound) Error() string { return fmt.Sprintf("[POST /states][%d] postStatesNotFound %+v", 404, o.Payload) } - func (o *PostStatesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostStatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewPostStatesUnprocessableEntity() *PostStatesUnprocessableEntity { return &PostStatesUnprocessableEntity{} } -/*PostStatesUnprocessableEntity handles this case with default header values. +/* PostStatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostStatesUnprocessableEntity struct { func (o *PostStatesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /states][%d] postStatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostStatesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *PostStatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewPostStatesInternalServerError() *PostStatesInternalServerError { return &PostStatesInternalServerError{} } -/*PostStatesInternalServerError handles this case with default header values. +/* PostStatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostStatesInternalServerError struct { func (o *PostStatesInternalServerError) Error() string { return fmt.Sprintf("[POST /states][%d] postStatesInternalServerError %+v", 500, o.Payload) } - func (o *PostStatesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostStatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/state/state_client.go b/api/geo/geo_client/state/state_client.go index 221fe49..54f0d62 100644 --- a/api/geo/geo_client/state/state_client.go +++ b/api/geo/geo_client/state/state_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetStateObservable(params *GetStateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetStateObservableOK, error) + GetStateObservable(params *GetStateObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStateObservableOK, error) - GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetStatesOK, error) + GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStatesOK, error) - PostStates(params *PostStatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostStatesOK, error) + PostStates(params *PostStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostStatesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Returns a state retrieval in a observable array */ -func (a *Client) GetStateObservable(params *GetStateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetStateObservableOK, error) { +func (a *Client) GetStateObservable(params *GetStateObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStateObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStateObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getStateObservable", Method: "GET", PathPattern: "/states/observable", @@ -63,7 +65,12 @@ func (a *Client) GetStateObservable(params *GetStateObservableParams, authInfo r 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 } @@ -82,13 +89,12 @@ func (a *Client) GetStateObservable(params *GetStateObservableParams, authInfo r Retrieve States, filter with parameters */ -func (a *Client) GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetStatesOK, error) { +func (a *Client) GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getStates", Method: "GET", PathPattern: "/states", @@ -100,7 +106,12 @@ func (a *Client) GetStates(params *GetStatesParams, authInfo runtime.ClientAuthI 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 } @@ -119,13 +130,12 @@ func (a *Client) GetStates(params *GetStatesParams, authInfo runtime.ClientAuthI Store a batch of new State records */ -func (a *Client) PostStates(params *PostStatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostStatesOK, error) { +func (a *Client) PostStates(params *PostStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostStatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostStatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postStates", Method: "POST", PathPattern: "/states", @@ -137,7 +147,12 @@ func (a *Client) PostStates(params *PostStatesParams, authInfo runtime.ClientAut 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 } diff --git a/api/geo/geo_client/tax_rate/get_tax_rate_observable_parameters.go b/api/geo/geo_client/tax_rate/get_tax_rate_observable_parameters.go index 6c7cb8a..f6032b4 100644 --- a/api/geo/geo_client/tax_rate/get_tax_rate_observable_parameters.go +++ b/api/geo/geo_client/tax_rate/get_tax_rate_observable_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxRateObservableParams creates a new GetTaxRateObservableParams object -// with the default values initialized. +// NewGetTaxRateObservableParams creates a new GetTaxRateObservableParams 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 NewGetTaxRateObservableParams() *GetTaxRateObservableParams { - var () return &GetTaxRateObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxRateObservableParamsWithTimeout creates a new GetTaxRateObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxRateObservableParamsWithTimeout(timeout time.Duration) *GetTaxRateObservableParams { - var () return &GetTaxRateObservableParams{ - timeout: timeout, } } // NewGetTaxRateObservableParamsWithContext creates a new GetTaxRateObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxRateObservableParamsWithContext(ctx context.Context) *GetTaxRateObservableParams { - var () return &GetTaxRateObservableParams{ - Context: ctx, } } // NewGetTaxRateObservableParamsWithHTTPClient creates a new GetTaxRateObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxRateObservableParamsWithHTTPClient(client *http.Client) *GetTaxRateObservableParams { - var () return &GetTaxRateObservableParams{ HTTPClient: client, } } -/*GetTaxRateObservableParams contains all the parameters to send to the API endpoint -for the get tax rate observable operation typically these are written to a http.Request +/* GetTaxRateObservableParams contains all the parameters to send to the API endpoint + for the get tax rate observable operation. + + Typically these are written to a http.Request. */ type GetTaxRateObservableParams struct { - /*CountyID - The ID of this Object + /* CountyID. + The ID of this Object */ CountyID *string - /*JournalDate - Journal Entry Date (transaction date), required + /* JournalDate. + + Journal Entry Date (transaction date), required */ JournalDate string - /*PlaceID - The ID of a Place record + /* PlaceID. + + The ID of a Place record */ PlaceID *string @@ -85,6 +86,21 @@ type GetTaxRateObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax rate observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRateObservableParams) WithDefaults() *GetTaxRateObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax rate observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRateObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax rate observable params func (o *GetTaxRateObservableParams) WithTimeout(timeout time.Duration) *GetTaxRateObservableParams { o.SetTimeout(timeout) @@ -163,22 +179,24 @@ func (o *GetTaxRateObservableParams) WriteToRequest(r runtime.ClientRequest, reg // query param countyId var qrCountyID string + if o.CountyID != nil { qrCountyID = *o.CountyID } qCountyID := qrCountyID if qCountyID != "" { + if err := r.SetQueryParam("countyId", qCountyID); err != nil { return err } } - } // query param journalDate qrJournalDate := o.JournalDate qJournalDate := qrJournalDate if qJournalDate != "" { + if err := r.SetQueryParam("journalDate", qJournalDate); err != nil { return err } @@ -188,16 +206,17 @@ func (o *GetTaxRateObservableParams) WriteToRequest(r runtime.ClientRequest, reg // query param placeId var qrPlaceID string + if o.PlaceID != nil { qrPlaceID = *o.PlaceID } qPlaceID := qrPlaceID if qPlaceID != "" { + if err := r.SetQueryParam("placeId", qPlaceID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/tax_rate/get_tax_rate_observable_responses.go b/api/geo/geo_client/tax_rate/get_tax_rate_observable_responses.go index 901ac5f..24591e0 100644 --- a/api/geo/geo_client/tax_rate/get_tax_rate_observable_responses.go +++ b/api/geo/geo_client/tax_rate/get_tax_rate_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxRateObservableReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTaxRateObservableOK() *GetTaxRateObservableOK { return &GetTaxRateObservableOK{} } -/*GetTaxRateObservableOK handles this case with default header values. +/* GetTaxRateObservableOK describes a response with status code 200, with default header values. Observable array response to a tax rate retrieval */ type GetTaxRateObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.TaxRate } @@ -89,18 +87,25 @@ type GetTaxRateObservableOK struct { func (o *GetTaxRateObservableOK) Error() string { return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableOK %+v", 200, o.Payload) } - func (o *GetTaxRateObservableOK) GetPayload() []*geo_models.TaxRate { return o.Payload } func (o *GetTaxRateObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetTaxRateObservableUnauthorized() *GetTaxRateObservableUnauthorized { return &GetTaxRateObservableUnauthorized{} } -/*GetTaxRateObservableUnauthorized handles this case with default header values. +/* GetTaxRateObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetTaxRateObservableUnauthorized struct { func (o *GetTaxRateObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxRateObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRateObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetTaxRateObservableForbidden() *GetTaxRateObservableForbidden { return &GetTaxRateObservableForbidden{} } -/*GetTaxRateObservableForbidden handles this case with default header values. +/* GetTaxRateObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetTaxRateObservableForbidden struct { func (o *GetTaxRateObservableForbidden) Error() string { return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableForbidden %+v", 403, o.Payload) } - func (o *GetTaxRateObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRateObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetTaxRateObservableNotFound() *GetTaxRateObservableNotFound { return &GetTaxRateObservableNotFound{} } -/*GetTaxRateObservableNotFound handles this case with default header values. +/* GetTaxRateObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetTaxRateObservableNotFound struct { func (o *GetTaxRateObservableNotFound) Error() string { return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableNotFound %+v", 404, o.Payload) } - func (o *GetTaxRateObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRateObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetTaxRateObservableUnprocessableEntity() *GetTaxRateObservableUnprocess return &GetTaxRateObservableUnprocessableEntity{} } -/*GetTaxRateObservableUnprocessableEntity handles this case with default header values. +/* GetTaxRateObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetTaxRateObservableUnprocessableEntity struct { func (o *GetTaxRateObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxRateObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRateObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetTaxRateObservableInternalServerError() *GetTaxRateObservableInternalS return &GetTaxRateObservableInternalServerError{} } -/*GetTaxRateObservableInternalServerError handles this case with default header values. +/* GetTaxRateObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetTaxRateObservableInternalServerError struct { func (o *GetTaxRateObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /taxrates/observable][%d] getTaxRateObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxRateObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRateObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/tax_rate/get_tax_rates_parameters.go b/api/geo/geo_client/tax_rate/get_tax_rates_parameters.go index 963597f..a17668e 100644 --- a/api/geo/geo_client/tax_rate/get_tax_rates_parameters.go +++ b/api/geo/geo_client/tax_rate/get_tax_rates_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxRatesParams creates a new GetTaxRatesParams object -// with the default values initialized. +// NewGetTaxRatesParams creates a new GetTaxRatesParams 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 NewGetTaxRatesParams() *GetTaxRatesParams { - var () return &GetTaxRatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxRatesParamsWithTimeout creates a new GetTaxRatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxRatesParamsWithTimeout(timeout time.Duration) *GetTaxRatesParams { - var () return &GetTaxRatesParams{ - timeout: timeout, } } // NewGetTaxRatesParamsWithContext creates a new GetTaxRatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxRatesParamsWithContext(ctx context.Context) *GetTaxRatesParams { - var () return &GetTaxRatesParams{ - Context: ctx, } } // NewGetTaxRatesParamsWithHTTPClient creates a new GetTaxRatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxRatesParamsWithHTTPClient(client *http.Client) *GetTaxRatesParams { - var () return &GetTaxRatesParams{ HTTPClient: client, } } -/*GetTaxRatesParams contains all the parameters to send to the API endpoint -for the get tax rates operation typically these are written to a http.Request +/* GetTaxRatesParams contains all the parameters to send to the API endpoint + for the get tax rates operation. + + Typically these are written to a http.Request. */ type GetTaxRatesParams struct { - /*CountyID - The ID of this Object + /* CountyID. + The ID of this Object */ CountyID *string - /*JournalDate - Journal Entry Date (transaction date), required + /* JournalDate. + + Journal Entry Date (transaction date), required */ JournalDate string - /*PlaceID - The ID of a Place record + /* PlaceID. + + The ID of a Place record */ PlaceID *string @@ -85,6 +86,21 @@ type GetTaxRatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRatesParams) WithDefaults() *GetTaxRatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxRatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax rates params func (o *GetTaxRatesParams) WithTimeout(timeout time.Duration) *GetTaxRatesParams { o.SetTimeout(timeout) @@ -163,22 +179,24 @@ func (o *GetTaxRatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param countyId var qrCountyID string + if o.CountyID != nil { qrCountyID = *o.CountyID } qCountyID := qrCountyID if qCountyID != "" { + if err := r.SetQueryParam("countyId", qCountyID); err != nil { return err } } - } // query param journalDate qrJournalDate := o.JournalDate qJournalDate := qrJournalDate if qJournalDate != "" { + if err := r.SetQueryParam("journalDate", qJournalDate); err != nil { return err } @@ -188,16 +206,17 @@ func (o *GetTaxRatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param placeId var qrPlaceID string + if o.PlaceID != nil { qrPlaceID = *o.PlaceID } qPlaceID := qrPlaceID if qPlaceID != "" { + if err := r.SetQueryParam("placeId", qPlaceID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/tax_rate/get_tax_rates_responses.go b/api/geo/geo_client/tax_rate/get_tax_rates_responses.go index d850608..9376980 100644 --- a/api/geo/geo_client/tax_rate/get_tax_rates_responses.go +++ b/api/geo/geo_client/tax_rate/get_tax_rates_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxRatesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTaxRatesOK() *GetTaxRatesOK { return &GetTaxRatesOK{} } -/*GetTaxRatesOK handles this case with default header values. +/* GetTaxRatesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Tax Rate records */ type GetTaxRatesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.TaxRateResponse } @@ -89,18 +87,25 @@ type GetTaxRatesOK struct { func (o *GetTaxRatesOK) Error() string { return fmt.Sprintf("[GET /taxrates][%d] getTaxRatesOK %+v", 200, o.Payload) } - func (o *GetTaxRatesOK) GetPayload() *geo_models.TaxRateResponse { return o.Payload } func (o *GetTaxRatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.TaxRateResponse) @@ -117,7 +122,7 @@ func NewGetTaxRatesUnauthorized() *GetTaxRatesUnauthorized { return &GetTaxRatesUnauthorized{} } -/*GetTaxRatesUnauthorized handles this case with default header values. +/* GetTaxRatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetTaxRatesUnauthorized struct { func (o *GetTaxRatesUnauthorized) Error() string { return fmt.Sprintf("[GET /taxrates][%d] getTaxRatesUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxRatesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetTaxRatesForbidden() *GetTaxRatesForbidden { return &GetTaxRatesForbidden{} } -/*GetTaxRatesForbidden handles this case with default header values. +/* GetTaxRatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetTaxRatesForbidden struct { func (o *GetTaxRatesForbidden) Error() string { return fmt.Sprintf("[GET /taxrates][%d] getTaxRatesForbidden %+v", 403, o.Payload) } - func (o *GetTaxRatesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetTaxRatesNotFound() *GetTaxRatesNotFound { return &GetTaxRatesNotFound{} } -/*GetTaxRatesNotFound handles this case with default header values. +/* GetTaxRatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetTaxRatesNotFound struct { func (o *GetTaxRatesNotFound) Error() string { return fmt.Sprintf("[GET /taxrates][%d] getTaxRatesNotFound %+v", 404, o.Payload) } - func (o *GetTaxRatesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetTaxRatesUnprocessableEntity() *GetTaxRatesUnprocessableEntity { return &GetTaxRatesUnprocessableEntity{} } -/*GetTaxRatesUnprocessableEntity handles this case with default header values. +/* GetTaxRatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetTaxRatesUnprocessableEntity struct { func (o *GetTaxRatesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxrates][%d] getTaxRatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxRatesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetTaxRatesInternalServerError() *GetTaxRatesInternalServerError { return &GetTaxRatesInternalServerError{} } -/*GetTaxRatesInternalServerError handles this case with default header values. +/* GetTaxRatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetTaxRatesInternalServerError struct { func (o *GetTaxRatesInternalServerError) Error() string { return fmt.Sprintf("[GET /taxrates][%d] getTaxRatesInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxRatesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxRatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/tax_rate/tax_rate_client.go b/api/geo/geo_client/tax_rate/tax_rate_client.go index 992d287..8f035d8 100644 --- a/api/geo/geo_client/tax_rate/tax_rate_client.go +++ b/api/geo/geo_client/tax_rate/tax_rate_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetTaxRateObservable(params *GetTaxRateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxRateObservableOK, error) + GetTaxRateObservable(params *GetTaxRateObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxRateObservableOK, error) - GetTaxRates(params *GetTaxRatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxRatesOK, error) + GetTaxRates(params *GetTaxRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxRatesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Returns a taxrate retrieval in a observable array */ -func (a *Client) GetTaxRateObservable(params *GetTaxRateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxRateObservableOK, error) { +func (a *Client) GetTaxRateObservable(params *GetTaxRateObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxRateObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxRateObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxRateObservable", Method: "GET", PathPattern: "/taxrates/observable", @@ -61,7 +63,12 @@ func (a *Client) GetTaxRateObservable(params *GetTaxRateObservableParams, authIn 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 } @@ -80,13 +87,12 @@ func (a *Client) GetTaxRateObservable(params *GetTaxRateObservableParams, authIn Returns SALES TAX rates based on County or Place ID */ -func (a *Client) GetTaxRates(params *GetTaxRatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxRatesOK, error) { +func (a *Client) GetTaxRates(params *GetTaxRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxRatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxRatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxRates", Method: "GET", PathPattern: "/taxrates", @@ -98,7 +104,12 @@ func (a *Client) GetTaxRates(params *GetTaxRatesParams, authInfo runtime.ClientA 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 } diff --git a/api/geo/geo_client/tax_type/get_tax_types_observable_parameters.go b/api/geo/geo_client/tax_type/get_tax_types_observable_parameters.go index bc993c8..8697858 100644 --- a/api/geo/geo_client/tax_type/get_tax_types_observable_parameters.go +++ b/api/geo/geo_client/tax_type/get_tax_types_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxTypesObservableParams creates a new GetTaxTypesObservableParams object -// with the default values initialized. +// NewGetTaxTypesObservableParams creates a new GetTaxTypesObservableParams 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 NewGetTaxTypesObservableParams() *GetTaxTypesObservableParams { - return &GetTaxTypesObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxTypesObservableParamsWithTimeout creates a new GetTaxTypesObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxTypesObservableParamsWithTimeout(timeout time.Duration) *GetTaxTypesObservableParams { - return &GetTaxTypesObservableParams{ - timeout: timeout, } } // NewGetTaxTypesObservableParamsWithContext creates a new GetTaxTypesObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxTypesObservableParamsWithContext(ctx context.Context) *GetTaxTypesObservableParams { - return &GetTaxTypesObservableParams{ - Context: ctx, } } // NewGetTaxTypesObservableParamsWithHTTPClient creates a new GetTaxTypesObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxTypesObservableParamsWithHTTPClient(client *http.Client) *GetTaxTypesObservableParams { - return &GetTaxTypesObservableParams{ HTTPClient: client, } } -/*GetTaxTypesObservableParams contains all the parameters to send to the API endpoint -for the get tax types observable operation typically these are written to a http.Request +/* GetTaxTypesObservableParams contains all the parameters to send to the API endpoint + for the get tax types observable operation. + + Typically these are written to a http.Request. */ type GetTaxTypesObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetTaxTypesObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax types observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesObservableParams) WithDefaults() *GetTaxTypesObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax types observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax types observable params func (o *GetTaxTypesObservableParams) WithTimeout(timeout time.Duration) *GetTaxTypesObservableParams { o.SetTimeout(timeout) diff --git a/api/geo/geo_client/tax_type/get_tax_types_observable_responses.go b/api/geo/geo_client/tax_type/get_tax_types_observable_responses.go index 563f5eb..e15c57f 100644 --- a/api/geo/geo_client/tax_type/get_tax_types_observable_responses.go +++ b/api/geo/geo_client/tax_type/get_tax_types_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxTypesObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTaxTypesObservableOK() *GetTaxTypesObservableOK { return &GetTaxTypesObservableOK{} } -/*GetTaxTypesObservableOK handles this case with default header values. +/* GetTaxTypesObservableOK describes a response with status code 200, with default header values. Observable array response to a taxtype retrieval */ type GetTaxTypesObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.TaxType } @@ -89,18 +87,25 @@ type GetTaxTypesObservableOK struct { func (o *GetTaxTypesObservableOK) Error() string { return fmt.Sprintf("[GET /taxtypes/observable][%d] getTaxTypesObservableOK %+v", 200, o.Payload) } - func (o *GetTaxTypesObservableOK) GetPayload() []*geo_models.TaxType { return o.Payload } func (o *GetTaxTypesObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetTaxTypesObservableUnauthorized() *GetTaxTypesObservableUnauthorized { return &GetTaxTypesObservableUnauthorized{} } -/*GetTaxTypesObservableUnauthorized handles this case with default header values. +/* GetTaxTypesObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetTaxTypesObservableUnauthorized struct { func (o *GetTaxTypesObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /taxtypes/observable][%d] getTaxTypesObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxTypesObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetTaxTypesObservableForbidden() *GetTaxTypesObservableForbidden { return &GetTaxTypesObservableForbidden{} } -/*GetTaxTypesObservableForbidden handles this case with default header values. +/* GetTaxTypesObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetTaxTypesObservableForbidden struct { func (o *GetTaxTypesObservableForbidden) Error() string { return fmt.Sprintf("[GET /taxtypes/observable][%d] getTaxTypesObservableForbidden %+v", 403, o.Payload) } - func (o *GetTaxTypesObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetTaxTypesObservableNotFound() *GetTaxTypesObservableNotFound { return &GetTaxTypesObservableNotFound{} } -/*GetTaxTypesObservableNotFound handles this case with default header values. +/* GetTaxTypesObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetTaxTypesObservableNotFound struct { func (o *GetTaxTypesObservableNotFound) Error() string { return fmt.Sprintf("[GET /taxtypes/observable][%d] getTaxTypesObservableNotFound %+v", 404, o.Payload) } - func (o *GetTaxTypesObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetTaxTypesObservableUnprocessableEntity() *GetTaxTypesObservableUnproce return &GetTaxTypesObservableUnprocessableEntity{} } -/*GetTaxTypesObservableUnprocessableEntity handles this case with default header values. +/* GetTaxTypesObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetTaxTypesObservableUnprocessableEntity struct { func (o *GetTaxTypesObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxtypes/observable][%d] getTaxTypesObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxTypesObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetTaxTypesObservableInternalServerError() *GetTaxTypesObservableInterna return &GetTaxTypesObservableInternalServerError{} } -/*GetTaxTypesObservableInternalServerError handles this case with default header values. +/* GetTaxTypesObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetTaxTypesObservableInternalServerError struct { func (o *GetTaxTypesObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /taxtypes/observable][%d] getTaxTypesObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxTypesObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/tax_type/get_tax_types_parameters.go b/api/geo/geo_client/tax_type/get_tax_types_parameters.go index bf83ffc..723c9d7 100644 --- a/api/geo/geo_client/tax_type/get_tax_types_parameters.go +++ b/api/geo/geo_client/tax_type/get_tax_types_parameters.go @@ -21,103 +21,116 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTaxTypesParams creates a new GetTaxTypesParams object -// with the default values initialized. +// NewGetTaxTypesParams creates a new GetTaxTypesParams 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 NewGetTaxTypesParams() *GetTaxTypesParams { - var () return &GetTaxTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxTypesParamsWithTimeout creates a new GetTaxTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxTypesParamsWithTimeout(timeout time.Duration) *GetTaxTypesParams { - var () return &GetTaxTypesParams{ - timeout: timeout, } } // NewGetTaxTypesParamsWithContext creates a new GetTaxTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxTypesParamsWithContext(ctx context.Context) *GetTaxTypesParams { - var () return &GetTaxTypesParams{ - Context: ctx, } } // NewGetTaxTypesParamsWithHTTPClient creates a new GetTaxTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxTypesParamsWithHTTPClient(client *http.Client) *GetTaxTypesParams { - var () return &GetTaxTypesParams{ HTTPClient: client, } } -/*GetTaxTypesParams contains all the parameters to send to the API endpoint -for the get tax types operation typically these are written to a http.Request +/* GetTaxTypesParams contains all the parameters to send to the API endpoint + for the get tax types operation. + + Typically these are written to a http.Request. */ type GetTaxTypesParams struct { - /*Active - Retrieve only active records? + /* Active. + Retrieve only active records? */ Active *bool - /*Address - Postal Address URL encoded; partial addresses allowed + /* Address. + + Postal Address URL encoded; partial addresses allowed */ Address *string - /*CountryCode - The Country abbreviation (2 char) + /* CountryCode. + + The Country abbreviation (2 char) */ CountryCode *string - /*County - The County Name + /* County. + + The County Name */ County *string - /*Date - Transaction date (defaults to current) + /* Date. + + Transaction date (defaults to current) */ Date *string - /*Ids - Taxnexus Record Ids of the Tax Types in a JSON array url encoded + /* Ids. + + Taxnexus Record Ids of the Tax Types in a JSON array url encoded */ Ids *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*Place - The City name (must be accompanied by State) + /* Place. + + The City name (must be accompanied by State) */ Place *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string - /*TaxTypeID - Taxnexus Record Id of the Tax Type + /* TaxTypeID. + + Taxnexus Record Id of the Tax Type */ TaxTypeID *string @@ -126,6 +139,21 @@ type GetTaxTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesParams) WithDefaults() *GetTaxTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax types params func (o *GetTaxTypesParams) WithTimeout(timeout time.Duration) *GetTaxTypesParams { o.SetTimeout(timeout) @@ -292,176 +320,187 @@ func (o *GetTaxTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.Address != nil { // query param address var qrAddress string + if o.Address != nil { qrAddress = *o.Address } qAddress := qrAddress if qAddress != "" { + if err := r.SetQueryParam("address", qAddress); err != nil { return err } } - } if o.CountryCode != nil { // query param countryCode var qrCountryCode string + if o.CountryCode != nil { qrCountryCode = *o.CountryCode } qCountryCode := qrCountryCode if qCountryCode != "" { + if err := r.SetQueryParam("countryCode", qCountryCode); err != nil { return err } } - } if o.County != nil { // query param county var qrCounty string + if o.County != nil { qrCounty = *o.County } qCounty := qrCounty if qCounty != "" { + if err := r.SetQueryParam("county", qCounty); err != nil { return err } } - } if o.Date != nil { // query param date var qrDate string + if o.Date != nil { qrDate = *o.Date } qDate := qrDate if qDate != "" { + if err := r.SetQueryParam("date", qDate); err != nil { return err } } - } if o.Ids != nil { // query param ids var qrIds string + if o.Ids != nil { qrIds = *o.Ids } qIds := qrIds if qIds != "" { + if err := r.SetQueryParam("ids", qIds); 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 o.Place != nil { // query param place var qrPlace string + if o.Place != nil { qrPlace = *o.Place } qPlace := qrPlace if qPlace != "" { + if err := r.SetQueryParam("place", qPlace); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if o.TaxTypeID != nil { // query param taxTypeId var qrTaxTypeID string + if o.TaxTypeID != nil { qrTaxTypeID = *o.TaxTypeID } qTaxTypeID := qrTaxTypeID if qTaxTypeID != "" { + if err := r.SetQueryParam("taxTypeId", qTaxTypeID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/tax_type/get_tax_types_responses.go b/api/geo/geo_client/tax_type/get_tax_types_responses.go index 3d31dde..fd1df98 100644 --- a/api/geo/geo_client/tax_type/get_tax_types_responses.go +++ b/api/geo/geo_client/tax_type/get_tax_types_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxTypesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTaxTypesOK() *GetTaxTypesOK { return &GetTaxTypesOK{} } -/*GetTaxTypesOK handles this case with default header values. +/* GetTaxTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Tax Type objects */ type GetTaxTypesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.TaxTypeResponse } @@ -89,18 +87,25 @@ type GetTaxTypesOK struct { func (o *GetTaxTypesOK) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesOK %+v", 200, o.Payload) } - func (o *GetTaxTypesOK) GetPayload() *geo_models.TaxTypeResponse { return o.Payload } func (o *GetTaxTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.TaxTypeResponse) @@ -117,7 +122,7 @@ func NewGetTaxTypesUnauthorized() *GetTaxTypesUnauthorized { return &GetTaxTypesUnauthorized{} } -/*GetTaxTypesUnauthorized handles this case with default header values. +/* GetTaxTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetTaxTypesUnauthorized struct { func (o *GetTaxTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxTypesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetTaxTypesForbidden() *GetTaxTypesForbidden { return &GetTaxTypesForbidden{} } -/*GetTaxTypesForbidden handles this case with default header values. +/* GetTaxTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetTaxTypesForbidden struct { func (o *GetTaxTypesForbidden) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesForbidden %+v", 403, o.Payload) } - func (o *GetTaxTypesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetTaxTypesNotFound() *GetTaxTypesNotFound { return &GetTaxTypesNotFound{} } -/*GetTaxTypesNotFound handles this case with default header values. +/* GetTaxTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetTaxTypesNotFound struct { func (o *GetTaxTypesNotFound) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesNotFound %+v", 404, o.Payload) } - func (o *GetTaxTypesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetTaxTypesUnprocessableEntity() *GetTaxTypesUnprocessableEntity { return &GetTaxTypesUnprocessableEntity{} } -/*GetTaxTypesUnprocessableEntity handles this case with default header values. +/* GetTaxTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetTaxTypesUnprocessableEntity struct { func (o *GetTaxTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxTypesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetTaxTypesInternalServerError() *GetTaxTypesInternalServerError { return &GetTaxTypesInternalServerError{} } -/*GetTaxTypesInternalServerError handles this case with default header values. +/* GetTaxTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetTaxTypesInternalServerError struct { func (o *GetTaxTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxTypesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxTypesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/tax_type/post_tax_types_parameters.go b/api/geo/geo_client/tax_type/post_tax_types_parameters.go index 29cd664..fd971b1 100644 --- a/api/geo/geo_client/tax_type/post_tax_types_parameters.go +++ b/api/geo/geo_client/tax_type/post_tax_types_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostTaxTypesParams creates a new PostTaxTypesParams object -// with the default values initialized. +// NewPostTaxTypesParams creates a new PostTaxTypesParams 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 NewPostTaxTypesParams() *PostTaxTypesParams { - var () return &PostTaxTypesParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxTypesParamsWithTimeout creates a new PostTaxTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxTypesParamsWithTimeout(timeout time.Duration) *PostTaxTypesParams { - var () return &PostTaxTypesParams{ - timeout: timeout, } } // NewPostTaxTypesParamsWithContext creates a new PostTaxTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxTypesParamsWithContext(ctx context.Context) *PostTaxTypesParams { - var () return &PostTaxTypesParams{ - Context: ctx, } } // NewPostTaxTypesParamsWithHTTPClient creates a new PostTaxTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxTypesParamsWithHTTPClient(client *http.Client) *PostTaxTypesParams { - var () return &PostTaxTypesParams{ HTTPClient: client, } } -/*PostTaxTypesParams contains all the parameters to send to the API endpoint -for the post tax types operation typically these are written to a http.Request +/* PostTaxTypesParams contains all the parameters to send to the API endpoint + for the post tax types operation. + + Typically these are written to a http.Request. */ type PostTaxTypesParams struct { - /*TaxTypeRequest - The new Places request package + /* TaxTypeRequest. + The new Places request package */ TaxTypeRequest *geo_models.TaxTypeRequest @@ -77,6 +76,21 @@ type PostTaxTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post tax types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxTypesParams) WithDefaults() *PostTaxTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post tax types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post tax types params func (o *PostTaxTypesParams) WithTimeout(timeout time.Duration) *PostTaxTypesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.TaxTypeRequest != nil { if err := r.SetBodyParam(o.TaxTypeRequest); err != nil { return err diff --git a/api/geo/geo_client/tax_type/post_tax_types_responses.go b/api/geo/geo_client/tax_type/post_tax_types_responses.go index c547fc7..12f8166 100644 --- a/api/geo/geo_client/tax_type/post_tax_types_responses.go +++ b/api/geo/geo_client/tax_type/post_tax_types_responses.go @@ -63,9 +63,8 @@ func (o *PostTaxTypesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTaxTypesOK() *PostTaxTypesOK { return &PostTaxTypesOK{} } -/*PostTaxTypesOK handles this case with default header values. +/* PostTaxTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Tax Type objects */ type PostTaxTypesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.TaxTypeResponse } @@ -89,18 +87,25 @@ type PostTaxTypesOK struct { func (o *PostTaxTypesOK) Error() string { return fmt.Sprintf("[POST /taxtypes][%d] postTaxTypesOK %+v", 200, o.Payload) } - func (o *PostTaxTypesOK) GetPayload() *geo_models.TaxTypeResponse { return o.Payload } func (o *PostTaxTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.TaxTypeResponse) @@ -117,7 +122,7 @@ func NewPostTaxTypesUnauthorized() *PostTaxTypesUnauthorized { return &PostTaxTypesUnauthorized{} } -/*PostTaxTypesUnauthorized handles this case with default header values. +/* PostTaxTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTaxTypesUnauthorized struct { func (o *PostTaxTypesUnauthorized) Error() string { return fmt.Sprintf("[POST /taxtypes][%d] postTaxTypesUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxTypesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxTypesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewPostTaxTypesForbidden() *PostTaxTypesForbidden { return &PostTaxTypesForbidden{} } -/*PostTaxTypesForbidden handles this case with default header values. +/* PostTaxTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTaxTypesForbidden struct { func (o *PostTaxTypesForbidden) Error() string { return fmt.Sprintf("[POST /taxtypes][%d] postTaxTypesForbidden %+v", 403, o.Payload) } - func (o *PostTaxTypesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxTypesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewPostTaxTypesNotFound() *PostTaxTypesNotFound { return &PostTaxTypesNotFound{} } -/*PostTaxTypesNotFound handles this case with default header values. +/* PostTaxTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTaxTypesNotFound struct { func (o *PostTaxTypesNotFound) Error() string { return fmt.Sprintf("[POST /taxtypes][%d] postTaxTypesNotFound %+v", 404, o.Payload) } - func (o *PostTaxTypesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxTypesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewPostTaxTypesUnprocessableEntity() *PostTaxTypesUnprocessableEntity { return &PostTaxTypesUnprocessableEntity{} } -/*PostTaxTypesUnprocessableEntity handles this case with default header values. +/* PostTaxTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTaxTypesUnprocessableEntity struct { func (o *PostTaxTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /taxtypes][%d] postTaxTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTaxTypesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxTypesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewPostTaxTypesInternalServerError() *PostTaxTypesInternalServerError { return &PostTaxTypesInternalServerError{} } -/*PostTaxTypesInternalServerError handles this case with default header values. +/* PostTaxTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTaxTypesInternalServerError struct { func (o *PostTaxTypesInternalServerError) Error() string { return fmt.Sprintf("[POST /taxtypes][%d] postTaxTypesInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxTypesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxTypesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/tax_type/tax_type_client.go b/api/geo/geo_client/tax_type/tax_type_client.go index b010686..998449e 100644 --- a/api/geo/geo_client/tax_type/tax_type_client.go +++ b/api/geo/geo_client/tax_type/tax_type_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypesOK, error) + GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypesOK, error) - GetTaxTypesObservable(params *GetTaxTypesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypesObservableOK, error) + GetTaxTypesObservable(params *GetTaxTypesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypesObservableOK, error) - PostTaxTypes(params *PostTaxTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxTypesOK, error) + PostTaxTypes(params *PostTaxTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxTypesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of tax types */ -func (a *Client) GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypesOK, error) { +func (a *Client) GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxTypes", Method: "GET", PathPattern: "/taxtypes", @@ -63,7 +65,12 @@ func (a *Client) GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientA Returns a taxtype retrieval in a observable array */ -func (a *Client) GetTaxTypesObservable(params *GetTaxTypesObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypesObservableOK, error) { +func (a *Client) GetTaxTypesObservable(params *GetTaxTypesObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypesObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxTypesObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxTypesObservable", Method: "GET", PathPattern: "/taxtypes/observable", @@ -100,7 +106,12 @@ func (a *Client) GetTaxTypesObservable(params *GetTaxTypesObservableParams, auth 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 } @@ -119,13 +130,12 @@ func (a *Client) GetTaxTypesObservable(params *GetTaxTypesObservableParams, auth Store a batch of new TaxType records */ -func (a *Client) PostTaxTypes(params *PostTaxTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxTypesOK, error) { +func (a *Client) PostTaxTypes(params *PostTaxTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxTypes", Method: "POST", PathPattern: "/taxtypes", @@ -137,7 +147,12 @@ func (a *Client) PostTaxTypes(params *PostTaxTypesParams, authInfo runtime.Clien 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 } diff --git a/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_parameters.go b/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_parameters.go index fedda49..8c9ff24 100644 --- a/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_parameters.go +++ b/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetTaxnexusCodeObservableParams creates a new GetTaxnexusCodeObservableParams object -// with the default values initialized. +// NewGetTaxnexusCodeObservableParams creates a new GetTaxnexusCodeObservableParams 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 NewGetTaxnexusCodeObservableParams() *GetTaxnexusCodeObservableParams { - var () return &GetTaxnexusCodeObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxnexusCodeObservableParamsWithTimeout creates a new GetTaxnexusCodeObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxnexusCodeObservableParamsWithTimeout(timeout time.Duration) *GetTaxnexusCodeObservableParams { - var () return &GetTaxnexusCodeObservableParams{ - timeout: timeout, } } // NewGetTaxnexusCodeObservableParamsWithContext creates a new GetTaxnexusCodeObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxnexusCodeObservableParamsWithContext(ctx context.Context) *GetTaxnexusCodeObservableParams { - var () return &GetTaxnexusCodeObservableParams{ - Context: ctx, } } // NewGetTaxnexusCodeObservableParamsWithHTTPClient creates a new GetTaxnexusCodeObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxnexusCodeObservableParamsWithHTTPClient(client *http.Client) *GetTaxnexusCodeObservableParams { - var () return &GetTaxnexusCodeObservableParams{ HTTPClient: client, } } -/*GetTaxnexusCodeObservableParams contains all the parameters to send to the API endpoint -for the get taxnexus code observable operation typically these are written to a http.Request +/* GetTaxnexusCodeObservableParams contains all the parameters to send to the API endpoint + for the get taxnexus code observable operation. + + Typically these are written to a http.Request. */ type GetTaxnexusCodeObservableParams struct { - /*StateID - The ID of this Object + /* StateID. + The ID of this Object */ StateID *string - /*CountryCode - The Country abbreviation (2 char) + /* CountryCode. + + The Country abbreviation (2 char) */ CountryCode *string - /*Geocode - The Geocode of this Place record + /* Geocode. + + The Geocode of this Place record */ Geocode *string @@ -85,6 +86,21 @@ type GetTaxnexusCodeObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get taxnexus code observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodeObservableParams) WithDefaults() *GetTaxnexusCodeObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get taxnexus code observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodeObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get taxnexus code observable params func (o *GetTaxnexusCodeObservableParams) WithTimeout(timeout time.Duration) *GetTaxnexusCodeObservableParams { o.SetTimeout(timeout) @@ -163,48 +179,51 @@ func (o *GetTaxnexusCodeObservableParams) WriteToRequest(r runtime.ClientRequest // query param StateID var qrStateID string + if o.StateID != nil { qrStateID = *o.StateID } qStateID := qrStateID if qStateID != "" { + if err := r.SetQueryParam("StateID", qStateID); err != nil { return err } } - } if o.CountryCode != nil { // query param countryCode var qrCountryCode string + if o.CountryCode != nil { qrCountryCode = *o.CountryCode } qCountryCode := qrCountryCode if qCountryCode != "" { + if err := r.SetQueryParam("countryCode", qCountryCode); err != nil { return err } } - } if o.Geocode != nil { // query param geocode var qrGeocode string + if o.Geocode != nil { qrGeocode = *o.Geocode } qGeocode := qrGeocode if qGeocode != "" { + if err := r.SetQueryParam("geocode", qGeocode); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_responses.go b/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_responses.go index 1fdb111..98ca2e2 100644 --- a/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_responses.go +++ b/api/geo/geo_client/taxnexus_code/get_taxnexus_code_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxnexusCodeObservableReader) ReadResponse(response runtime.ClientRe return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTaxnexusCodeObservableOK() *GetTaxnexusCodeObservableOK { return &GetTaxnexusCodeObservableOK{} } -/*GetTaxnexusCodeObservableOK handles this case with default header values. +/* GetTaxnexusCodeObservableOK describes a response with status code 200, with default header values. Observable array response to a Taxnexus Code retrieval */ type GetTaxnexusCodeObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*geo_models.TaxnexusCode } @@ -89,18 +87,25 @@ type GetTaxnexusCodeObservableOK struct { func (o *GetTaxnexusCodeObservableOK) Error() string { return fmt.Sprintf("[GET /taxnexuscodes/observable][%d] getTaxnexusCodeObservableOK %+v", 200, o.Payload) } - func (o *GetTaxnexusCodeObservableOK) GetPayload() []*geo_models.TaxnexusCode { return o.Payload } func (o *GetTaxnexusCodeObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetTaxnexusCodeObservableUnauthorized() *GetTaxnexusCodeObservableUnauth return &GetTaxnexusCodeObservableUnauthorized{} } -/*GetTaxnexusCodeObservableUnauthorized handles this case with default header values. +/* GetTaxnexusCodeObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetTaxnexusCodeObservableUnauthorized struct { func (o *GetTaxnexusCodeObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /taxnexuscodes/observable][%d] getTaxnexusCodeObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxnexusCodeObservableUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodeObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -153,7 +161,7 @@ func NewGetTaxnexusCodeObservableForbidden() *GetTaxnexusCodeObservableForbidden return &GetTaxnexusCodeObservableForbidden{} } -/*GetTaxnexusCodeObservableForbidden handles this case with default header values. +/* GetTaxnexusCodeObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetTaxnexusCodeObservableForbidden struct { func (o *GetTaxnexusCodeObservableForbidden) Error() string { return fmt.Sprintf("[GET /taxnexuscodes/observable][%d] getTaxnexusCodeObservableForbidden %+v", 403, o.Payload) } - func (o *GetTaxnexusCodeObservableForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodeObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -191,7 +202,7 @@ func NewGetTaxnexusCodeObservableNotFound() *GetTaxnexusCodeObservableNotFound { return &GetTaxnexusCodeObservableNotFound{} } -/*GetTaxnexusCodeObservableNotFound handles this case with default header values. +/* GetTaxnexusCodeObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetTaxnexusCodeObservableNotFound struct { func (o *GetTaxnexusCodeObservableNotFound) Error() string { return fmt.Sprintf("[GET /taxnexuscodes/observable][%d] getTaxnexusCodeObservableNotFound %+v", 404, o.Payload) } - func (o *GetTaxnexusCodeObservableNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodeObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -229,7 +243,7 @@ func NewGetTaxnexusCodeObservableUnprocessableEntity() *GetTaxnexusCodeObservabl return &GetTaxnexusCodeObservableUnprocessableEntity{} } -/*GetTaxnexusCodeObservableUnprocessableEntity handles this case with default header values. +/* GetTaxnexusCodeObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetTaxnexusCodeObservableUnprocessableEntity struct { func (o *GetTaxnexusCodeObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxnexuscodes/observable][%d] getTaxnexusCodeObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxnexusCodeObservableUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodeObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -267,7 +284,7 @@ func NewGetTaxnexusCodeObservableInternalServerError() *GetTaxnexusCodeObservabl return &GetTaxnexusCodeObservableInternalServerError{} } -/*GetTaxnexusCodeObservableInternalServerError handles this case with default header values. +/* GetTaxnexusCodeObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetTaxnexusCodeObservableInternalServerError struct { func (o *GetTaxnexusCodeObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /taxnexuscodes/observable][%d] getTaxnexusCodeObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxnexusCodeObservableInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodeObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_parameters.go b/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_parameters.go index 96d9bf8..173d1cd 100644 --- a/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_parameters.go +++ b/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTaxnexusCodesParams creates a new GetTaxnexusCodesParams object -// with the default values initialized. +// NewGetTaxnexusCodesParams creates a new GetTaxnexusCodesParams 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 NewGetTaxnexusCodesParams() *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxnexusCodesParamsWithTimeout creates a new GetTaxnexusCodesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxnexusCodesParamsWithTimeout(timeout time.Duration) *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ - timeout: timeout, } } // NewGetTaxnexusCodesParamsWithContext creates a new GetTaxnexusCodesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxnexusCodesParamsWithContext(ctx context.Context) *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ - Context: ctx, } } // NewGetTaxnexusCodesParamsWithHTTPClient creates a new GetTaxnexusCodesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxnexusCodesParamsWithHTTPClient(client *http.Client) *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ HTTPClient: client, } } -/*GetTaxnexusCodesParams contains all the parameters to send to the API endpoint -for the get taxnexus codes operation typically these are written to a http.Request +/* GetTaxnexusCodesParams contains all the parameters to send to the API endpoint + for the get taxnexus codes operation. + + Typically these are written to a http.Request. */ type GetTaxnexusCodesParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TaxnexusCodeID - Taxnexus Code ID + /* TaxnexusCodeID. + + Taxnexus Code ID */ TaxnexusCodeID *string @@ -86,6 +91,21 @@ type GetTaxnexusCodesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get taxnexus codes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesParams) WithDefaults() *GetTaxnexusCodesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get taxnexus codes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get taxnexus codes params func (o *GetTaxnexusCodesParams) WithTimeout(timeout time.Duration) *GetTaxnexusCodesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetTaxnexusCodesParams) WriteToRequest(r runtime.ClientRequest, reg str // 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 o.TaxnexusCodeID != nil { // query param taxnexusCodeId var qrTaxnexusCodeID string + if o.TaxnexusCodeID != nil { qrTaxnexusCodeID = *o.TaxnexusCodeID } qTaxnexusCodeID := qrTaxnexusCodeID if qTaxnexusCodeID != "" { + if err := r.SetQueryParam("taxnexusCodeId", qTaxnexusCodeID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_responses.go b/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_responses.go index c9611cf..90c5c7f 100644 --- a/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_responses.go +++ b/api/geo/geo_client/taxnexus_code/get_taxnexus_codes_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxnexusCodesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTaxnexusCodesOK() *GetTaxnexusCodesOK { return &GetTaxnexusCodesOK{} } -/*GetTaxnexusCodesOK handles this case with default header values. +/* GetTaxnexusCodesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Taxnexus Codes */ type GetTaxnexusCodesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.TaxnexusCodeResponse } @@ -89,18 +87,25 @@ type GetTaxnexusCodesOK struct { func (o *GetTaxnexusCodesOK) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesOK %+v", 200, o.Payload) } - func (o *GetTaxnexusCodesOK) GetPayload() *geo_models.TaxnexusCodeResponse { return o.Payload } func (o *GetTaxnexusCodesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.TaxnexusCodeResponse) @@ -117,7 +122,7 @@ func NewGetTaxnexusCodesUnauthorized() *GetTaxnexusCodesUnauthorized { return &GetTaxnexusCodesUnauthorized{} } -/*GetTaxnexusCodesUnauthorized handles this case with default header values. +/* GetTaxnexusCodesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetTaxnexusCodesUnauthorized struct { func (o *GetTaxnexusCodesUnauthorized) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxnexusCodesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewGetTaxnexusCodesForbidden() *GetTaxnexusCodesForbidden { return &GetTaxnexusCodesForbidden{} } -/*GetTaxnexusCodesForbidden handles this case with default header values. +/* GetTaxnexusCodesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetTaxnexusCodesForbidden struct { func (o *GetTaxnexusCodesForbidden) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesForbidden %+v", 403, o.Payload) } - func (o *GetTaxnexusCodesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewGetTaxnexusCodesNotFound() *GetTaxnexusCodesNotFound { return &GetTaxnexusCodesNotFound{} } -/*GetTaxnexusCodesNotFound handles this case with default header values. +/* GetTaxnexusCodesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetTaxnexusCodesNotFound struct { func (o *GetTaxnexusCodesNotFound) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesNotFound %+v", 404, o.Payload) } - func (o *GetTaxnexusCodesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewGetTaxnexusCodesUnprocessableEntity() *GetTaxnexusCodesUnprocessableEnti return &GetTaxnexusCodesUnprocessableEntity{} } -/*GetTaxnexusCodesUnprocessableEntity handles this case with default header values. +/* GetTaxnexusCodesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetTaxnexusCodesUnprocessableEntity struct { func (o *GetTaxnexusCodesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxnexusCodesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewGetTaxnexusCodesInternalServerError() *GetTaxnexusCodesInternalServerErr return &GetTaxnexusCodesInternalServerError{} } -/*GetTaxnexusCodesInternalServerError handles this case with default header values. +/* GetTaxnexusCodesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetTaxnexusCodesInternalServerError struct { func (o *GetTaxnexusCodesInternalServerError) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxnexusCodesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *GetTaxnexusCodesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_parameters.go b/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_parameters.go index 04133b7..d16ffe6 100644 --- a/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_parameters.go +++ b/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -// NewPostTaxnexusCodesParams creates a new PostTaxnexusCodesParams object -// with the default values initialized. +// NewPostTaxnexusCodesParams creates a new PostTaxnexusCodesParams 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 NewPostTaxnexusCodesParams() *PostTaxnexusCodesParams { - var () return &PostTaxnexusCodesParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxnexusCodesParamsWithTimeout creates a new PostTaxnexusCodesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxnexusCodesParamsWithTimeout(timeout time.Duration) *PostTaxnexusCodesParams { - var () return &PostTaxnexusCodesParams{ - timeout: timeout, } } // NewPostTaxnexusCodesParamsWithContext creates a new PostTaxnexusCodesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxnexusCodesParamsWithContext(ctx context.Context) *PostTaxnexusCodesParams { - var () return &PostTaxnexusCodesParams{ - Context: ctx, } } // NewPostTaxnexusCodesParamsWithHTTPClient creates a new PostTaxnexusCodesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxnexusCodesParamsWithHTTPClient(client *http.Client) *PostTaxnexusCodesParams { - var () return &PostTaxnexusCodesParams{ HTTPClient: client, } } -/*PostTaxnexusCodesParams contains all the parameters to send to the API endpoint -for the post taxnexus codes operation typically these are written to a http.Request +/* PostTaxnexusCodesParams contains all the parameters to send to the API endpoint + for the post taxnexus codes operation. + + Typically these are written to a http.Request. */ type PostTaxnexusCodesParams struct { - /*TaxnexusCodeRequest - The new Places request package + /* TaxnexusCodeRequest. + The new Places request package */ TaxnexusCodeRequest *geo_models.TaxnexusCodeRequest @@ -77,6 +76,21 @@ type PostTaxnexusCodesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post taxnexus codes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxnexusCodesParams) WithDefaults() *PostTaxnexusCodesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post taxnexus codes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxnexusCodesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post taxnexus codes params func (o *PostTaxnexusCodesParams) WithTimeout(timeout time.Duration) *PostTaxnexusCodesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxnexusCodesParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.TaxnexusCodeRequest != nil { if err := r.SetBodyParam(o.TaxnexusCodeRequest); err != nil { return err diff --git a/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_responses.go b/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_responses.go index bbad65e..9b44f9c 100644 --- a/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_responses.go +++ b/api/geo/geo_client/taxnexus_code/post_taxnexus_codes_responses.go @@ -63,9 +63,8 @@ func (o *PostTaxnexusCodesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTaxnexusCodesOK() *PostTaxnexusCodesOK { return &PostTaxnexusCodesOK{} } -/*PostTaxnexusCodesOK handles this case with default header values. +/* PostTaxnexusCodesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Taxnexus Codes */ type PostTaxnexusCodesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *geo_models.TaxnexusCodeResponse } @@ -89,18 +87,25 @@ type PostTaxnexusCodesOK struct { func (o *PostTaxnexusCodesOK) Error() string { return fmt.Sprintf("[POST /taxnexuscodes][%d] postTaxnexusCodesOK %+v", 200, o.Payload) } - func (o *PostTaxnexusCodesOK) GetPayload() *geo_models.TaxnexusCodeResponse { return o.Payload } func (o *PostTaxnexusCodesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(geo_models.TaxnexusCodeResponse) @@ -117,7 +122,7 @@ func NewPostTaxnexusCodesUnauthorized() *PostTaxnexusCodesUnauthorized { return &PostTaxnexusCodesUnauthorized{} } -/*PostTaxnexusCodesUnauthorized handles this case with default header values. +/* PostTaxnexusCodesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTaxnexusCodesUnauthorized struct { func (o *PostTaxnexusCodesUnauthorized) Error() string { return fmt.Sprintf("[POST /taxnexuscodes][%d] postTaxnexusCodesUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxnexusCodesUnauthorized) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxnexusCodesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -155,7 +163,7 @@ func NewPostTaxnexusCodesForbidden() *PostTaxnexusCodesForbidden { return &PostTaxnexusCodesForbidden{} } -/*PostTaxnexusCodesForbidden handles this case with default header values. +/* PostTaxnexusCodesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTaxnexusCodesForbidden struct { func (o *PostTaxnexusCodesForbidden) Error() string { return fmt.Sprintf("[POST /taxnexuscodes][%d] postTaxnexusCodesForbidden %+v", 403, o.Payload) } - func (o *PostTaxnexusCodesForbidden) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxnexusCodesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -193,7 +204,7 @@ func NewPostTaxnexusCodesNotFound() *PostTaxnexusCodesNotFound { return &PostTaxnexusCodesNotFound{} } -/*PostTaxnexusCodesNotFound handles this case with default header values. +/* PostTaxnexusCodesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTaxnexusCodesNotFound struct { func (o *PostTaxnexusCodesNotFound) Error() string { return fmt.Sprintf("[POST /taxnexuscodes][%d] postTaxnexusCodesNotFound %+v", 404, o.Payload) } - func (o *PostTaxnexusCodesNotFound) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxnexusCodesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -231,7 +245,7 @@ func NewPostTaxnexusCodesUnprocessableEntity() *PostTaxnexusCodesUnprocessableEn return &PostTaxnexusCodesUnprocessableEntity{} } -/*PostTaxnexusCodesUnprocessableEntity handles this case with default header values. +/* PostTaxnexusCodesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTaxnexusCodesUnprocessableEntity struct { func (o *PostTaxnexusCodesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /taxnexuscodes][%d] postTaxnexusCodesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTaxnexusCodesUnprocessableEntity) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxnexusCodesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) @@ -269,7 +286,7 @@ func NewPostTaxnexusCodesInternalServerError() *PostTaxnexusCodesInternalServerE return &PostTaxnexusCodesInternalServerError{} } -/*PostTaxnexusCodesInternalServerError handles this case with default header values. +/* PostTaxnexusCodesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTaxnexusCodesInternalServerError struct { func (o *PostTaxnexusCodesInternalServerError) Error() string { return fmt.Sprintf("[POST /taxnexuscodes][%d] postTaxnexusCodesInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxnexusCodesInternalServerError) GetPayload() *geo_models.Error { return o.Payload } func (o *PostTaxnexusCodesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(geo_models.Error) diff --git a/api/geo/geo_client/taxnexus_code/taxnexus_code_client.go b/api/geo/geo_client/taxnexus_code/taxnexus_code_client.go index c76c8d3..bd78fc7 100644 --- a/api/geo/geo_client/taxnexus_code/taxnexus_code_client.go +++ b/api/geo/geo_client/taxnexus_code/taxnexus_code_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetTaxnexusCodeObservable(params *GetTaxnexusCodeObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxnexusCodeObservableOK, error) + GetTaxnexusCodeObservable(params *GetTaxnexusCodeObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxnexusCodeObservableOK, error) - GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxnexusCodesOK, error) + GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxnexusCodesOK, error) - PostTaxnexusCodes(params *PostTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxnexusCodesOK, error) + PostTaxnexusCodes(params *PostTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxnexusCodesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Returns a taxnexuscode retrieval in a observable array */ -func (a *Client) GetTaxnexusCodeObservable(params *GetTaxnexusCodeObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxnexusCodeObservableOK, error) { +func (a *Client) GetTaxnexusCodeObservable(params *GetTaxnexusCodeObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxnexusCodeObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxnexusCodeObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxnexusCodeObservable", Method: "GET", PathPattern: "/taxnexuscodes/observable", @@ -63,7 +65,12 @@ func (a *Client) GetTaxnexusCodeObservable(params *GetTaxnexusCodeObservablePara 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 } @@ -82,13 +89,12 @@ func (a *Client) GetTaxnexusCodeObservable(params *GetTaxnexusCodeObservablePara Return a list of TaxnexusCodes */ -func (a *Client) GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxnexusCodesOK, error) { +func (a *Client) GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxnexusCodesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxnexusCodesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxnexusCodes", Method: "GET", PathPattern: "/taxnexuscodes", @@ -100,7 +106,12 @@ func (a *Client) GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runti 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 } @@ -119,13 +130,12 @@ func (a *Client) GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runti Store a batch of new TaxnexusCode records */ -func (a *Client) PostTaxnexusCodes(params *PostTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxnexusCodesOK, error) { +func (a *Client) PostTaxnexusCodes(params *PostTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxnexusCodesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxnexusCodesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxnexusCodes", Method: "POST", PathPattern: "/taxnexuscodes", @@ -137,7 +147,12 @@ func (a *Client) PostTaxnexusCodes(params *PostTaxnexusCodesParams, authInfo run 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 } diff --git a/api/geo/geo_models/address.go b/api/geo/geo_models/address.go index bd8731d..08d6233 100644 --- a/api/geo/geo_models/address.go +++ b/api/geo/geo_models/address.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *Address) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this address based on context it is used +func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Address) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/coordinate.go b/api/geo/geo_models/coordinate.go index 717cc99..039d939 100644 --- a/api/geo/geo_models/coordinate.go +++ b/api/geo/geo_models/coordinate.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -137,7 +138,6 @@ func (m *Coordinate) Validate(formats strfmt.Registry) error { } func (m *Coordinate) validateTaxRate(formats strfmt.Registry) error { - if swag.IsZero(m.TaxRate) { // not required return nil } @@ -155,7 +155,6 @@ func (m *Coordinate) validateTaxRate(formats strfmt.Registry) error { } func (m *Coordinate) validateTaxTypes(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTypes) { // not required return nil } @@ -179,6 +178,56 @@ func (m *Coordinate) validateTaxTypes(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate based on the context it is used +func (m *Coordinate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxRate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTypes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Coordinate) contextValidateTaxRate(ctx context.Context, formats strfmt.Registry) error { + + if m.TaxRate != nil { + if err := m.TaxRate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxRate") + } + return err + } + } + + return nil +} + +func (m *Coordinate) contextValidateTaxTypes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTypes); i++ { + + if m.TaxTypes[i] != nil { + if err := m.TaxTypes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTypes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Coordinate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/coordinate_basic.go b/api/geo/geo_models/coordinate_basic.go index cb58997..4a87bd9 100644 --- a/api/geo/geo_models/coordinate_basic.go +++ b/api/geo/geo_models/coordinate_basic.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -71,7 +72,6 @@ func (m *CoordinateBasic) Validate(formats strfmt.Registry) error { } func (m *CoordinateBasic) validateTaxTypes(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTypes) { // not required return nil } @@ -95,6 +95,38 @@ func (m *CoordinateBasic) validateTaxTypes(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate basic based on the context it is used +func (m *CoordinateBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxTypes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CoordinateBasic) contextValidateTaxTypes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTypes); i++ { + + if m.TaxTypes[i] != nil { + if err := m.TaxTypes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTypes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CoordinateBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/coordinate_basic_response.go b/api/geo/geo_models/coordinate_basic_response.go index 86d9c70..6f5389a 100644 --- a/api/geo/geo_models/coordinate_basic_response.go +++ b/api/geo/geo_models/coordinate_basic_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CoordinateBasicResponse) Validate(formats strfmt.Registry) error { } func (m *CoordinateBasicResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CoordinateBasicResponse) validateData(formats strfmt.Registry) error { } func (m *CoordinateBasicResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CoordinateBasicResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate basic response based on the context it is used +func (m *CoordinateBasicResponse) 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 *CoordinateBasicResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CoordinateBasicResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CoordinateBasicResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/coordinate_request.go b/api/geo/geo_models/coordinate_request.go index ecc85ad..29bb705 100644 --- a/api/geo/geo_models/coordinate_request.go +++ b/api/geo/geo_models/coordinate_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *CoordinateRequest) Validate(formats strfmt.Registry) error { } func (m *CoordinateRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *CoordinateRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate request based on the context it is used +func (m *CoordinateRequest) 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 *CoordinateRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CoordinateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/coordinate_request_item.go b/api/geo/geo_models/coordinate_request_item.go index 2b6e6d5..7d41184 100644 --- a/api/geo/geo_models/coordinate_request_item.go +++ b/api/geo/geo_models/coordinate_request_item.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *CoordinateRequestItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this coordinate request item based on context it is used +func (m *CoordinateRequestItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CoordinateRequestItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/coordinate_response.go b/api/geo/geo_models/coordinate_response.go index f047eb8..df52caf 100644 --- a/api/geo/geo_models/coordinate_response.go +++ b/api/geo/geo_models/coordinate_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CoordinateResponse) Validate(formats strfmt.Registry) error { } func (m *CoordinateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CoordinateResponse) validateData(formats strfmt.Registry) error { } func (m *CoordinateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CoordinateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate response based on the context it is used +func (m *CoordinateResponse) 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 *CoordinateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CoordinateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CoordinateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/country.go b/api/geo/geo_models/country.go index aed7092..9530728 100644 --- a/api/geo/geo_models/country.go +++ b/api/geo/geo_models/country.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -131,7 +132,6 @@ func (m *Country) Validate(formats strfmt.Registry) error { } func (m *Country) validateTaxInstances(formats strfmt.Registry) error { - if swag.IsZero(m.TaxInstances) { // not required return nil } @@ -155,6 +155,38 @@ func (m *Country) validateTaxInstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this country based on the context it is used +func (m *Country) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Country) contextValidateTaxInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxInstances); i++ { + + if m.TaxInstances[i] != nil { + if err := m.TaxInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Country) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/country_request.go b/api/geo/geo_models/country_request.go index e65b55a..f389898 100644 --- a/api/geo/geo_models/country_request.go +++ b/api/geo/geo_models/country_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *CountryRequest) Validate(formats strfmt.Registry) error { } func (m *CountryRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *CountryRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this country request based on the context it is used +func (m *CountryRequest) 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 *CountryRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CountryRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/country_response.go b/api/geo/geo_models/country_response.go index 8cab4ad..25ec7a7 100644 --- a/api/geo/geo_models/country_response.go +++ b/api/geo/geo_models/country_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CountryResponse) Validate(formats strfmt.Registry) error { } func (m *CountryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CountryResponse) validateData(formats strfmt.Registry) error { } func (m *CountryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CountryResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this country response based on the context it is used +func (m *CountryResponse) 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 *CountryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CountryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CountryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/county.go b/api/geo/geo_models/county.go index d08a4a2..04691bf 100644 --- a/api/geo/geo_models/county.go +++ b/api/geo/geo_models/county.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -174,7 +175,6 @@ func (m *County) Validate(formats strfmt.Registry) error { } func (m *County) validateSalesTaxRate(formats strfmt.Registry) error { - if swag.IsZero(m.SalesTaxRate) { // not required return nil } @@ -192,7 +192,6 @@ func (m *County) validateSalesTaxRate(formats strfmt.Registry) error { } func (m *County) validateTaxInstances(formats strfmt.Registry) error { - if swag.IsZero(m.TaxInstances) { // not required return nil } @@ -216,6 +215,56 @@ func (m *County) validateTaxInstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this county based on the context it is used +func (m *County) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSalesTaxRate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *County) contextValidateSalesTaxRate(ctx context.Context, formats strfmt.Registry) error { + + if m.SalesTaxRate != nil { + if err := m.SalesTaxRate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SalesTaxRate") + } + return err + } + } + + return nil +} + +func (m *County) contextValidateTaxInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxInstances); i++ { + + if m.TaxInstances[i] != nil { + if err := m.TaxInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *County) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/county_request.go b/api/geo/geo_models/county_request.go index 7ac7874..678c337 100644 --- a/api/geo/geo_models/county_request.go +++ b/api/geo/geo_models/county_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *CountyRequest) Validate(formats strfmt.Registry) error { } func (m *CountyRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *CountyRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this county request based on the context it is used +func (m *CountyRequest) 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 *CountyRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CountyRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/county_response.go b/api/geo/geo_models/county_response.go index 8943fee..0045382 100644 --- a/api/geo/geo_models/county_response.go +++ b/api/geo/geo_models/county_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CountyResponse) Validate(formats strfmt.Registry) error { } func (m *CountyResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CountyResponse) validateData(formats strfmt.Registry) error { } func (m *CountyResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CountyResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this county response based on the context it is used +func (m *CountyResponse) 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 *CountyResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CountyResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CountyResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/delete_response.go b/api/geo/geo_models/delete_response.go index 5e8aa84..089a5c9 100644 --- a/api/geo/geo_models/delete_response.go +++ b/api/geo/geo_models/delete_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error { } func (m *DeleteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error { } func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this delete response based on the context it is used +func (m *DeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DeleteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DeleteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/domain.go b/api/geo/geo_models/domain.go index f3a559b..6c25ca7 100644 --- a/api/geo/geo_models/domain.go +++ b/api/geo/geo_models/domain.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Domain) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this domain based on context it is used +func (m *Domain) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Domain) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/domain_request.go b/api/geo/geo_models/domain_request.go index 2465fe7..cac87ac 100644 --- a/api/geo/geo_models/domain_request.go +++ b/api/geo/geo_models/domain_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *DomainRequest) Validate(formats strfmt.Registry) error { } func (m *DomainRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *DomainRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this domain request based on the context it is used +func (m *DomainRequest) 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 *DomainRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *DomainRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/domain_response.go b/api/geo/geo_models/domain_response.go index 9dc8bec..077c632 100644 --- a/api/geo/geo_models/domain_response.go +++ b/api/geo/geo_models/domain_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DomainResponse) Validate(formats strfmt.Registry) error { } func (m *DomainResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DomainResponse) validateData(formats strfmt.Registry) error { } func (m *DomainResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DomainResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this domain response based on the context it is used +func (m *DomainResponse) 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 *DomainResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DomainResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DomainResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/error.go b/api/geo/geo_models/error.go index 6f57158..787db50 100644 --- a/api/geo/geo_models/error.go +++ b/api/geo/geo_models/error.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/invalid_error.go b/api/geo/geo_models/invalid_error.go index b54de31..e595399 100644 --- a/api/geo/geo_models/invalid_error.go +++ b/api/geo/geo_models/invalid_error.go @@ -10,6 +10,8 @@ package geo_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/message.go b/api/geo/geo_models/message.go index f77832e..67035d9 100644 --- a/api/geo/geo_models/message.go +++ b/api/geo/geo_models/message.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/pagination.go b/api/geo/geo_models/pagination.go index 50316d3..4d3588f 100644 --- a/api/geo/geo_models/pagination.go +++ b/api/geo/geo_models/pagination.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/place.go b/api/geo/geo_models/place.go index 3d608b6..f3fd614 100644 --- a/api/geo/geo_models/place.go +++ b/api/geo/geo_models/place.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -183,7 +184,6 @@ func (m *Place) Validate(formats strfmt.Registry) error { } func (m *Place) validateSalesTaxRate(formats strfmt.Registry) error { - if swag.IsZero(m.SalesTaxRate) { // not required return nil } @@ -201,7 +201,6 @@ func (m *Place) validateSalesTaxRate(formats strfmt.Registry) error { } func (m *Place) validateTaxInstances(formats strfmt.Registry) error { - if swag.IsZero(m.TaxInstances) { // not required return nil } @@ -225,6 +224,56 @@ func (m *Place) validateTaxInstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this place based on the context it is used +func (m *Place) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSalesTaxRate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Place) contextValidateSalesTaxRate(ctx context.Context, formats strfmt.Registry) error { + + if m.SalesTaxRate != nil { + if err := m.SalesTaxRate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SalesTaxRate") + } + return err + } + } + + return nil +} + +func (m *Place) contextValidateTaxInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxInstances); i++ { + + if m.TaxInstances[i] != nil { + if err := m.TaxInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Place) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/place_request.go b/api/geo/geo_models/place_request.go index 55160e3..bac8ffd 100644 --- a/api/geo/geo_models/place_request.go +++ b/api/geo/geo_models/place_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *PlaceRequest) Validate(formats strfmt.Registry) error { } func (m *PlaceRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *PlaceRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this place request based on the context it is used +func (m *PlaceRequest) 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 *PlaceRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PlaceRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/place_response.go b/api/geo/geo_models/place_response.go index 269da00..23b543d 100644 --- a/api/geo/geo_models/place_response.go +++ b/api/geo/geo_models/place_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlaceResponse) Validate(formats strfmt.Registry) error { } func (m *PlaceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlaceResponse) validateData(formats strfmt.Registry) error { } func (m *PlaceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlaceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this place response based on the context it is used +func (m *PlaceResponse) 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 *PlaceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlaceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlaceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/request_meta.go b/api/geo/geo_models/request_meta.go index 6341d45..2b98d1e 100644 --- a/api/geo/geo_models/request_meta.go +++ b/api/geo/geo_models/request_meta.go @@ -10,6 +10,8 @@ package geo_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/response_meta.go b/api/geo/geo_models/response_meta.go index 08e58c7..f274aae 100644 --- a/api/geo/geo_models/response_meta.go +++ b/api/geo/geo_models/response_meta.go @@ -10,6 +10,8 @@ package geo_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/state.go b/api/geo/geo_models/state.go index 010aa43..2338d0b 100644 --- a/api/geo/geo_models/state.go +++ b/api/geo/geo_models/state.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -161,7 +162,6 @@ func (m *State) Validate(formats strfmt.Registry) error { } func (m *State) validateTaxInstances(formats strfmt.Registry) error { - if swag.IsZero(m.TaxInstances) { // not required return nil } @@ -185,6 +185,38 @@ func (m *State) validateTaxInstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this state based on the context it is used +func (m *State) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *State) contextValidateTaxInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxInstances); i++ { + + if m.TaxInstances[i] != nil { + if err := m.TaxInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *State) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/state_request.go b/api/geo/geo_models/state_request.go index 06f442e..ce8e8b3 100644 --- a/api/geo/geo_models/state_request.go +++ b/api/geo/geo_models/state_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *StateRequest) Validate(formats strfmt.Registry) error { } func (m *StateRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *StateRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this state request based on the context it is used +func (m *StateRequest) 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 *StateRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *StateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/state_response.go b/api/geo/geo_models/state_response.go index acc7ca7..1ed7731 100644 --- a/api/geo/geo_models/state_response.go +++ b/api/geo/geo_models/state_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *StateResponse) Validate(formats strfmt.Registry) error { } func (m *StateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *StateResponse) validateData(formats strfmt.Registry) error { } func (m *StateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *StateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this state response based on the context it is used +func (m *StateResponse) 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 *StateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *StateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/tax_instance.go b/api/geo/geo_models/tax_instance.go index fb5468d..432c48a 100644 --- a/api/geo/geo_models/tax_instance.go +++ b/api/geo/geo_models/tax_instance.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -58,6 +60,11 @@ func (m *TaxInstance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax instance based on context it is used +func (m *TaxInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/tax_rate.go b/api/geo/geo_models/tax_rate.go index 5445229..a526a87 100644 --- a/api/geo/geo_models/tax_rate.go +++ b/api/geo/geo_models/tax_rate.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -67,6 +69,11 @@ func (m *TaxRate) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax rate based on context it is used +func (m *TaxRate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxRate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/tax_rate_response.go b/api/geo/geo_models/tax_rate_response.go index 47040f8..f313e86 100644 --- a/api/geo/geo_models/tax_rate_response.go +++ b/api/geo/geo_models/tax_rate_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxRateResponse) Validate(formats strfmt.Registry) error { } func (m *TaxRateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxRateResponse) validateData(formats strfmt.Registry) error { } func (m *TaxRateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxRateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax rate response based on the context it is used +func (m *TaxRateResponse) 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 *TaxRateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxRateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxRateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/tax_type.go b/api/geo/geo_models/tax_type.go index 0ef2dd4..ebb5c60 100644 --- a/api/geo/geo_models/tax_type.go +++ b/api/geo/geo_models/tax_type.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -178,6 +180,11 @@ func (m *TaxType) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax type based on context it is used +func (m *TaxType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/tax_type_id.go b/api/geo/geo_models/tax_type_id.go index cd930d7..eca6afd 100644 --- a/api/geo/geo_models/tax_type_id.go +++ b/api/geo/geo_models/tax_type_id.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *TaxTypeID) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax type ID based on context it is used +func (m *TaxTypeID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeID) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/tax_type_request.go b/api/geo/geo_models/tax_type_request.go index 10e2428..7e787ef 100644 --- a/api/geo/geo_models/tax_type_request.go +++ b/api/geo/geo_models/tax_type_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *TaxTypeRequest) Validate(formats strfmt.Registry) error { } func (m *TaxTypeRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *TaxTypeRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax type request based on the context it is used +func (m *TaxTypeRequest) 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 *TaxTypeRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/tax_type_response.go b/api/geo/geo_models/tax_type_response.go index 83f1458..bf0a89d 100644 --- a/api/geo/geo_models/tax_type_response.go +++ b/api/geo/geo_models/tax_type_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxTypeResponse) Validate(formats strfmt.Registry) error { } func (m *TaxTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxTypeResponse) validateData(formats strfmt.Registry) error { } func (m *TaxTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax type response based on the context it is used +func (m *TaxTypeResponse) 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 *TaxTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/taxnexus_code.go b/api/geo/geo_models/taxnexus_code.go index 17edc2d..fd5250d 100644 --- a/api/geo/geo_models/taxnexus_code.go +++ b/api/geo/geo_models/taxnexus_code.go @@ -10,6 +10,8 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -91,6 +93,11 @@ func (m *TaxnexusCode) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this taxnexus code based on context it is used +func (m *TaxnexusCode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxnexusCode) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/taxnexus_code_request.go b/api/geo/geo_models/taxnexus_code_request.go index d2a0880..6b3a2f5 100644 --- a/api/geo/geo_models/taxnexus_code_request.go +++ b/api/geo/geo_models/taxnexus_code_request.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *TaxnexusCodeRequest) Validate(formats strfmt.Registry) error { } func (m *TaxnexusCodeRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *TaxnexusCodeRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this taxnexus code request based on the context it is used +func (m *TaxnexusCodeRequest) 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 *TaxnexusCodeRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxnexusCodeRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/geo/geo_models/taxnexus_code_response.go b/api/geo/geo_models/taxnexus_code_response.go index 221607b..1c6fc23 100644 --- a/api/geo/geo_models/taxnexus_code_response.go +++ b/api/geo/geo_models/taxnexus_code_response.go @@ -10,6 +10,7 @@ package geo_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxnexusCodeResponse) Validate(formats strfmt.Registry) error { } func (m *TaxnexusCodeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxnexusCodeResponse) validateData(formats strfmt.Registry) error { } func (m *TaxnexusCodeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxnexusCodeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this taxnexus code response based on the context it is used +func (m *TaxnexusCodeResponse) 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 *TaxnexusCodeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxnexusCodeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxnexusCodeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_parameters.go b/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_parameters.go index 5fbbc53..4f18a0c 100644 --- a/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_parameters.go +++ b/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCoordinatesParams creates a new GetCoordinatesParams object -// with the default values initialized. +// NewGetCoordinatesParams creates a new GetCoordinatesParams 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 NewGetCoordinatesParams() *GetCoordinatesParams { - var () return &GetCoordinatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCoordinatesParamsWithTimeout creates a new GetCoordinatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCoordinatesParamsWithTimeout(timeout time.Duration) *GetCoordinatesParams { - var () return &GetCoordinatesParams{ - timeout: timeout, } } // NewGetCoordinatesParamsWithContext creates a new GetCoordinatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCoordinatesParamsWithContext(ctx context.Context) *GetCoordinatesParams { - var () return &GetCoordinatesParams{ - Context: ctx, } } // NewGetCoordinatesParamsWithHTTPClient creates a new GetCoordinatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCoordinatesParamsWithHTTPClient(client *http.Client) *GetCoordinatesParams { - var () return &GetCoordinatesParams{ HTTPClient: client, } } -/*GetCoordinatesParams contains all the parameters to send to the API endpoint -for the get coordinates operation typically these are written to a http.Request +/* GetCoordinatesParams contains all the parameters to send to the API endpoint + for the get coordinates operation. + + Typically these are written to a http.Request. */ type GetCoordinatesParams struct { - /*Address - Postal Address URL encoded; partial addresses allowed + /* Address. + Postal Address URL encoded; partial addresses allowed */ Address *string - /*Country - The Country abbreviation (2 char) + /* Country. + + The Country abbreviation (2 char) */ Country *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int32 */ Limit *int32 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int32 */ Offset *int32 - /*Place - The City name (must be accompanied by State) + /* Place. + + The City name (must be accompanied by State) */ Place *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string @@ -101,6 +109,21 @@ type GetCoordinatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get coordinates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesParams) WithDefaults() *GetCoordinatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get coordinates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoordinatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get coordinates params func (o *GetCoordinatesParams) WithTimeout(timeout time.Duration) *GetCoordinatesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetCoordinatesParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param address var qrAddress string + if o.Address != nil { qrAddress = *o.Address } qAddress := qrAddress if qAddress != "" { + if err := r.SetQueryParam("address", qAddress); err != nil { return err } } - } if o.Country != nil { // query param country var qrCountry string + if o.Country != nil { qrCountry = *o.Country } qCountry := qrCountry if qCountry != "" { + if err := r.SetQueryParam("country", qCountry); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int32 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt32(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int32 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt32(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if o.Place != nil { // query param place var qrPlace string + if o.Place != nil { qrPlace = *o.Place } qPlace := qrPlace if qPlace != "" { + if err := r.SetQueryParam("place", qPlace); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_responses.go b/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_responses.go index d1d283d..337d293 100644 --- a/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_responses.go +++ b/api/gov-gw/gov_gw_client/tax_rates/get_coordinates_responses.go @@ -63,9 +63,8 @@ func (o *GetCoordinatesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetCoordinatesOK() *GetCoordinatesOK { return &GetCoordinatesOK{} } -/*GetCoordinatesOK handles this case with default header values. +/* GetCoordinatesOK describes a response with status code 200, with default header values. Taxnexus Response */ @@ -85,7 +84,6 @@ type GetCoordinatesOK struct { func (o *GetCoordinatesOK) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesOK %+v", 200, o.Payload) } - func (o *GetCoordinatesOK) GetPayload() *gov_gw_models.CoordinateResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetCoordinatesUnauthorized() *GetCoordinatesUnauthorized { return &GetCoordinatesUnauthorized{} } -/*GetCoordinatesUnauthorized handles this case with default header values. +/* GetCoordinatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetCoordinatesUnauthorized struct { func (o *GetCoordinatesUnauthorized) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesUnauthorized %+v", 401, o.Payload) } - func (o *GetCoordinatesUnauthorized) GetPayload() *gov_gw_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetCoordinatesForbidden() *GetCoordinatesForbidden { return &GetCoordinatesForbidden{} } -/*GetCoordinatesForbidden handles this case with default header values. +/* GetCoordinatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetCoordinatesForbidden struct { func (o *GetCoordinatesForbidden) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesForbidden %+v", 403, o.Payload) } - func (o *GetCoordinatesForbidden) GetPayload() *gov_gw_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetCoordinatesNotFound() *GetCoordinatesNotFound { return &GetCoordinatesNotFound{} } -/*GetCoordinatesNotFound handles this case with default header values. +/* GetCoordinatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetCoordinatesNotFound struct { func (o *GetCoordinatesNotFound) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesNotFound %+v", 404, o.Payload) } - func (o *GetCoordinatesNotFound) GetPayload() *gov_gw_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetCoordinatesUnprocessableEntity() *GetCoordinatesUnprocessableEntity { return &GetCoordinatesUnprocessableEntity{} } -/*GetCoordinatesUnprocessableEntity handles this case with default header values. +/* GetCoordinatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetCoordinatesUnprocessableEntity struct { func (o *GetCoordinatesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCoordinatesUnprocessableEntity) GetPayload() *gov_gw_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetCoordinatesInternalServerError() *GetCoordinatesInternalServerError { return &GetCoordinatesInternalServerError{} } -/*GetCoordinatesInternalServerError handles this case with default header values. +/* GetCoordinatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetCoordinatesInternalServerError struct { func (o *GetCoordinatesInternalServerError) Error() string { return fmt.Sprintf("[GET /coordinates][%d] getCoordinatesInternalServerError %+v", 500, o.Payload) } - func (o *GetCoordinatesInternalServerError) GetPayload() *gov_gw_models.Error { return o.Payload } diff --git a/api/gov-gw/gov_gw_client/tax_rates/tax_rates_client.go b/api/gov-gw/gov_gw_client/tax_rates/tax_rates_client.go index 585ab1e..a24b4de 100644 --- a/api/gov-gw/gov_gw_client/tax_rates/tax_rates_client.go +++ b/api/gov-gw/gov_gw_client/tax_rates/tax_rates_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinatesOK, error) + GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinatesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Returns full tax information for a specific point on the map (tax situs). Uses existing Taxnexus Situs for lookup information. */ -func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinatesOK, error) { +func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCoordinatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCoordinates", Method: "GET", PathPattern: "/coordinates", @@ -59,7 +61,12 @@ func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.C 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 } diff --git a/api/gov-gw/gov_gw_models/coordinate.go b/api/gov-gw/gov_gw_models/coordinate.go index d50c447..21296a5 100644 --- a/api/gov-gw/gov_gw_models/coordinate.go +++ b/api/gov-gw/gov_gw_models/coordinate.go @@ -10,6 +10,7 @@ package gov_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -110,7 +111,6 @@ func (m *Coordinate) Validate(formats strfmt.Registry) error { } func (m *Coordinate) validateTaxtypes(formats strfmt.Registry) error { - if swag.IsZero(m.Taxtypes) { // not required return nil } @@ -134,6 +134,38 @@ func (m *Coordinate) validateTaxtypes(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate based on the context it is used +func (m *Coordinate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxtypes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Coordinate) contextValidateTaxtypes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxtypes); i++ { + + if m.Taxtypes[i] != nil { + if err := m.Taxtypes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxtypes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Coordinate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/coordinate_request.go b/api/gov-gw/gov_gw_models/coordinate_request.go index 0bf4fbb..7ab39ef 100644 --- a/api/gov-gw/gov_gw_models/coordinate_request.go +++ b/api/gov-gw/gov_gw_models/coordinate_request.go @@ -10,6 +10,7 @@ package gov_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -93,6 +94,56 @@ func (m *CoordinateRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate request based on the context it is used +func (m *CoordinateRequest) 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 *CoordinateRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CoordinateRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CoordinateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/coordinate_request_item.go b/api/gov-gw/gov_gw_models/coordinate_request_item.go index ec2a209..7d784d2 100644 --- a/api/gov-gw/gov_gw_models/coordinate_request_item.go +++ b/api/gov-gw/gov_gw_models/coordinate_request_item.go @@ -10,6 +10,8 @@ package gov_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *CoordinateRequestItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this coordinate request item based on context it is used +func (m *CoordinateRequestItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CoordinateRequestItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/coordinate_response.go b/api/gov-gw/gov_gw_models/coordinate_response.go index 22a75b5..a75712c 100644 --- a/api/gov-gw/gov_gw_models/coordinate_response.go +++ b/api/gov-gw/gov_gw_models/coordinate_response.go @@ -10,6 +10,7 @@ package gov_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CoordinateResponse) Validate(formats strfmt.Registry) error { } func (m *CoordinateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CoordinateResponse) validateData(formats strfmt.Registry) error { } func (m *CoordinateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CoordinateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coordinate response based on the context it is used +func (m *CoordinateResponse) 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 *CoordinateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CoordinateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CoordinateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/error.go b/api/gov-gw/gov_gw_models/error.go index dc8580a..773db4f 100644 --- a/api/gov-gw/gov_gw_models/error.go +++ b/api/gov-gw/gov_gw_models/error.go @@ -10,6 +10,8 @@ package gov_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/invalid_error.go b/api/gov-gw/gov_gw_models/invalid_error.go index 031281b..f72129a 100644 --- a/api/gov-gw/gov_gw_models/invalid_error.go +++ b/api/gov-gw/gov_gw_models/invalid_error.go @@ -10,6 +10,8 @@ package gov_gw_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/pagination.go b/api/gov-gw/gov_gw_models/pagination.go index 8e21334..eaa46ec 100644 --- a/api/gov-gw/gov_gw_models/pagination.go +++ b/api/gov-gw/gov_gw_models/pagination.go @@ -10,6 +10,8 @@ package gov_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/request_meta.go b/api/gov-gw/gov_gw_models/request_meta.go index 9612686..6f8c8d0 100644 --- a/api/gov-gw/gov_gw_models/request_meta.go +++ b/api/gov-gw/gov_gw_models/request_meta.go @@ -10,6 +10,8 @@ package gov_gw_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/response_meta.go b/api/gov-gw/gov_gw_models/response_meta.go index 281b9b3..a0105a0 100644 --- a/api/gov-gw/gov_gw_models/response_meta.go +++ b/api/gov-gw/gov_gw_models/response_meta.go @@ -10,6 +10,8 @@ package gov_gw_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/gov-gw/gov_gw_models/tax_type_id.go b/api/gov-gw/gov_gw_models/tax_type_id.go index 8dc13f1..4c118e4 100644 --- a/api/gov-gw/gov_gw_models/tax_type_id.go +++ b/api/gov-gw/gov_gw_models/tax_type_id.go @@ -10,6 +10,8 @@ package gov_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *TaxTypeID) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax type ID based on context it is used +func (m *TaxTypeID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeID) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_client/accounting_rule/accounting_rule_client.go b/api/ledger/ledger_client/accounting_rule/accounting_rule_client.go index 79734bc..3914f14 100644 --- a/api/ledger/ledger_client/accounting_rule/accounting_rule_client.go +++ b/api/ledger/ledger_client/accounting_rule/accounting_rule_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesOK, error) + GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesOK, error) - PostAccountingRules(params *PostAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountingRulesOK, error) + PostAccountingRules(params *PostAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountingRulesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Return a list of Accounting Rules */ -func (a *Client) GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesOK, error) { +func (a *Client) GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountingRulesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccountingRules", Method: "GET", PathPattern: "/accountingrules", @@ -61,7 +63,12 @@ func (a *Client) GetAccountingRules(params *GetAccountingRulesParams, authInfo r 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 } @@ -80,13 +87,12 @@ func (a *Client) GetAccountingRules(params *GetAccountingRulesParams, authInfo r Create new Accounting Rules */ -func (a *Client) PostAccountingRules(params *PostAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountingRulesOK, error) { +func (a *Client) PostAccountingRules(params *PostAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountingRulesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostAccountingRulesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postAccountingRules", Method: "POST", PathPattern: "/accountingrules", @@ -98,7 +104,12 @@ func (a *Client) PostAccountingRules(params *PostAccountingRulesParams, authInfo 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 } diff --git a/api/ledger/ledger_client/accounting_rule/get_accounting_rules_parameters.go b/api/ledger/ledger_client/accounting_rule/get_accounting_rules_parameters.go index 6ddcb78..9e26b8d 100644 --- a/api/ledger/ledger_client/accounting_rule/get_accounting_rules_parameters.go +++ b/api/ledger/ledger_client/accounting_rule/get_accounting_rules_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAccountingRulesParams creates a new GetAccountingRulesParams object -// with the default values initialized. +// NewGetAccountingRulesParams creates a new GetAccountingRulesParams 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 NewGetAccountingRulesParams() *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountingRulesParamsWithTimeout creates a new GetAccountingRulesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountingRulesParamsWithTimeout(timeout time.Duration) *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ - timeout: timeout, } } // NewGetAccountingRulesParamsWithContext creates a new GetAccountingRulesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountingRulesParamsWithContext(ctx context.Context) *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ - Context: ctx, } } // NewGetAccountingRulesParamsWithHTTPClient creates a new GetAccountingRulesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountingRulesParamsWithHTTPClient(client *http.Client) *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ HTTPClient: client, } } -/*GetAccountingRulesParams contains all the parameters to send to the API endpoint -for the get accounting rules operation typically these are written to a http.Request +/* GetAccountingRulesParams contains all the parameters to send to the API endpoint + for the get accounting rules operation. + + Typically these are written to a http.Request. */ type GetAccountingRulesParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID string - /*ID - Taxnexus Record Id + /* ID. + + Taxnexus Record Id */ ID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetAccountingRulesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounting rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesParams) WithDefaults() *GetAccountingRulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounting rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounting rules params func (o *GetAccountingRulesParams) WithTimeout(timeout time.Duration) *GetAccountingRulesParams { o.SetTimeout(timeout) @@ -180,6 +201,7 @@ func (o *GetAccountingRulesParams) WriteToRequest(r runtime.ClientRequest, reg s qrAccountID := o.AccountID qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } @@ -189,48 +211,51 @@ func (o *GetAccountingRulesParams) WriteToRequest(r runtime.ClientRequest, reg s // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); 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 { diff --git a/api/ledger/ledger_client/accounting_rule/get_accounting_rules_responses.go b/api/ledger/ledger_client/accounting_rule/get_accounting_rules_responses.go index fdf9ece..e6defca 100644 --- a/api/ledger/ledger_client/accounting_rule/get_accounting_rules_responses.go +++ b/api/ledger/ledger_client/accounting_rule/get_accounting_rules_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountingRulesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetAccountingRulesOK() *GetAccountingRulesOK { return &GetAccountingRulesOK{} } -/*GetAccountingRulesOK handles this case with default header values. +/* GetAccountingRulesOK describes a response with status code 200, with default header values. Taxnexus Response with Accounting Rule objects */ @@ -85,7 +84,6 @@ type GetAccountingRulesOK struct { func (o *GetAccountingRulesOK) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesOK %+v", 200, o.Payload) } - func (o *GetAccountingRulesOK) GetPayload() *ledger_models.AccountingRuleResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetAccountingRulesUnauthorized() *GetAccountingRulesUnauthorized { return &GetAccountingRulesUnauthorized{} } -/*GetAccountingRulesUnauthorized handles this case with default header values. +/* GetAccountingRulesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetAccountingRulesUnauthorized struct { func (o *GetAccountingRulesUnauthorized) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountingRulesUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetAccountingRulesForbidden() *GetAccountingRulesForbidden { return &GetAccountingRulesForbidden{} } -/*GetAccountingRulesForbidden handles this case with default header values. +/* GetAccountingRulesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetAccountingRulesForbidden struct { func (o *GetAccountingRulesForbidden) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesForbidden %+v", 403, o.Payload) } - func (o *GetAccountingRulesForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetAccountingRulesNotFound() *GetAccountingRulesNotFound { return &GetAccountingRulesNotFound{} } -/*GetAccountingRulesNotFound handles this case with default header values. +/* GetAccountingRulesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetAccountingRulesNotFound struct { func (o *GetAccountingRulesNotFound) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesNotFound %+v", 404, o.Payload) } - func (o *GetAccountingRulesNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetAccountingRulesUnprocessableEntity() *GetAccountingRulesUnprocessable return &GetAccountingRulesUnprocessableEntity{} } -/*GetAccountingRulesUnprocessableEntity handles this case with default header values. +/* GetAccountingRulesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetAccountingRulesUnprocessableEntity struct { func (o *GetAccountingRulesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountingRulesUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetAccountingRulesInternalServerError() *GetAccountingRulesInternalServe return &GetAccountingRulesInternalServerError{} } -/*GetAccountingRulesInternalServerError handles this case with default header values. +/* GetAccountingRulesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetAccountingRulesInternalServerError struct { func (o *GetAccountingRulesInternalServerError) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountingRulesInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/accounting_rule/post_accounting_rules_parameters.go b/api/ledger/ledger_client/accounting_rule/post_accounting_rules_parameters.go index 836196b..b63612d 100644 --- a/api/ledger/ledger_client/accounting_rule/post_accounting_rules_parameters.go +++ b/api/ledger/ledger_client/accounting_rule/post_accounting_rules_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) -// NewPostAccountingRulesParams creates a new PostAccountingRulesParams object -// with the default values initialized. +// NewPostAccountingRulesParams creates a new PostAccountingRulesParams 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 NewPostAccountingRulesParams() *PostAccountingRulesParams { - var () return &PostAccountingRulesParams{ - timeout: cr.DefaultTimeout, } } // NewPostAccountingRulesParamsWithTimeout creates a new PostAccountingRulesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostAccountingRulesParamsWithTimeout(timeout time.Duration) *PostAccountingRulesParams { - var () return &PostAccountingRulesParams{ - timeout: timeout, } } // NewPostAccountingRulesParamsWithContext creates a new PostAccountingRulesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostAccountingRulesParamsWithContext(ctx context.Context) *PostAccountingRulesParams { - var () return &PostAccountingRulesParams{ - Context: ctx, } } // NewPostAccountingRulesParamsWithHTTPClient creates a new PostAccountingRulesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostAccountingRulesParamsWithHTTPClient(client *http.Client) *PostAccountingRulesParams { - var () return &PostAccountingRulesParams{ HTTPClient: client, } } -/*PostAccountingRulesParams contains all the parameters to send to the API endpoint -for the post accounting rules operation typically these are written to a http.Request +/* PostAccountingRulesParams contains all the parameters to send to the API endpoint + for the post accounting rules operation. + + Typically these are written to a http.Request. */ type PostAccountingRulesParams struct { - /*AccountingRuleRequest - An array of Accounting Rule records + /* AccountingRuleRequest. + An array of Accounting Rule records */ AccountingRuleRequest *ledger_models.AccountingRuleRequest @@ -77,6 +76,21 @@ type PostAccountingRulesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post accounting rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountingRulesParams) WithDefaults() *PostAccountingRulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post accounting rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountingRulesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post accounting rules params func (o *PostAccountingRulesParams) WithTimeout(timeout time.Duration) *PostAccountingRulesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostAccountingRulesParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.AccountingRuleRequest != nil { if err := r.SetBodyParam(o.AccountingRuleRequest); err != nil { return err diff --git a/api/ledger/ledger_client/accounting_rule/post_accounting_rules_responses.go b/api/ledger/ledger_client/accounting_rule/post_accounting_rules_responses.go index 675a98c..8b3175d 100644 --- a/api/ledger/ledger_client/accounting_rule/post_accounting_rules_responses.go +++ b/api/ledger/ledger_client/accounting_rule/post_accounting_rules_responses.go @@ -63,9 +63,8 @@ func (o *PostAccountingRulesReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostAccountingRulesOK() *PostAccountingRulesOK { return &PostAccountingRulesOK{} } -/*PostAccountingRulesOK handles this case with default header values. +/* PostAccountingRulesOK describes a response with status code 200, with default header values. Taxnexus Response with Accounting Rule objects */ @@ -85,7 +84,6 @@ type PostAccountingRulesOK struct { func (o *PostAccountingRulesOK) Error() string { return fmt.Sprintf("[POST /accountingrules][%d] postAccountingRulesOK %+v", 200, o.Payload) } - func (o *PostAccountingRulesOK) GetPayload() *ledger_models.AccountingRuleResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostAccountingRulesUnauthorized() *PostAccountingRulesUnauthorized { return &PostAccountingRulesUnauthorized{} } -/*PostAccountingRulesUnauthorized handles this case with default header values. +/* PostAccountingRulesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostAccountingRulesUnauthorized struct { func (o *PostAccountingRulesUnauthorized) Error() string { return fmt.Sprintf("[POST /accountingrules][%d] postAccountingRulesUnauthorized %+v", 401, o.Payload) } - func (o *PostAccountingRulesUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostAccountingRulesForbidden() *PostAccountingRulesForbidden { return &PostAccountingRulesForbidden{} } -/*PostAccountingRulesForbidden handles this case with default header values. +/* PostAccountingRulesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostAccountingRulesForbidden struct { func (o *PostAccountingRulesForbidden) Error() string { return fmt.Sprintf("[POST /accountingrules][%d] postAccountingRulesForbidden %+v", 403, o.Payload) } - func (o *PostAccountingRulesForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostAccountingRulesNotFound() *PostAccountingRulesNotFound { return &PostAccountingRulesNotFound{} } -/*PostAccountingRulesNotFound handles this case with default header values. +/* PostAccountingRulesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostAccountingRulesNotFound struct { func (o *PostAccountingRulesNotFound) Error() string { return fmt.Sprintf("[POST /accountingrules][%d] postAccountingRulesNotFound %+v", 404, o.Payload) } - func (o *PostAccountingRulesNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostAccountingRulesUnprocessableEntity() *PostAccountingRulesUnprocessab return &PostAccountingRulesUnprocessableEntity{} } -/*PostAccountingRulesUnprocessableEntity handles this case with default header values. +/* PostAccountingRulesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostAccountingRulesUnprocessableEntity struct { func (o *PostAccountingRulesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /accountingrules][%d] postAccountingRulesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostAccountingRulesUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostAccountingRulesInternalServerError() *PostAccountingRulesInternalSer return &PostAccountingRulesInternalServerError{} } -/*PostAccountingRulesInternalServerError handles this case with default header values. +/* PostAccountingRulesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostAccountingRulesInternalServerError struct { func (o *PostAccountingRulesInternalServerError) Error() string { return fmt.Sprintf("[POST /accountingrules][%d] postAccountingRulesInternalServerError %+v", 500, o.Payload) } - func (o *PostAccountingRulesInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/accounting_ruleset/accounting_ruleset_client.go b/api/ledger/ledger_client/accounting_ruleset/accounting_ruleset_client.go index 8096d7c..245e71d 100644 --- a/api/ledger/ledger_client/accounting_ruleset/accounting_ruleset_client.go +++ b/api/ledger/ledger_client/accounting_ruleset/accounting_ruleset_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesetsOK, error) + GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesetsOK, error) - PostAccountingRulesets(params *PostAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountingRulesetsOK, error) + PostAccountingRulesets(params *PostAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountingRulesetsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Return a list of available Accounting Rulessets */ -func (a *Client) GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesetsOK, error) { +func (a *Client) GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesetsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountingRulesetsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccountingRulesets", Method: "GET", PathPattern: "/accountingrulesets", @@ -61,7 +63,12 @@ func (a *Client) GetAccountingRulesets(params *GetAccountingRulesetsParams, auth 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 } @@ -80,13 +87,12 @@ func (a *Client) GetAccountingRulesets(params *GetAccountingRulesetsParams, auth Create new Accounting Rulessets */ -func (a *Client) PostAccountingRulesets(params *PostAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountingRulesetsOK, error) { +func (a *Client) PostAccountingRulesets(params *PostAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountingRulesetsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostAccountingRulesetsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postAccountingRulesets", Method: "POST", PathPattern: "/accountingrulesets", @@ -98,7 +104,12 @@ func (a *Client) PostAccountingRulesets(params *PostAccountingRulesetsParams, au 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 } diff --git a/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_parameters.go b/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_parameters.go index 38b5fd8..ada69d0 100644 --- a/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_parameters.go +++ b/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAccountingRulesetsParams creates a new GetAccountingRulesetsParams object -// with the default values initialized. +// NewGetAccountingRulesetsParams creates a new GetAccountingRulesetsParams 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 NewGetAccountingRulesetsParams() *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountingRulesetsParamsWithTimeout creates a new GetAccountingRulesetsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountingRulesetsParamsWithTimeout(timeout time.Duration) *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ - timeout: timeout, } } // NewGetAccountingRulesetsParamsWithContext creates a new GetAccountingRulesetsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountingRulesetsParamsWithContext(ctx context.Context) *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ - Context: ctx, } } // NewGetAccountingRulesetsParamsWithHTTPClient creates a new GetAccountingRulesetsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountingRulesetsParamsWithHTTPClient(client *http.Client) *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ HTTPClient: client, } } -/*GetAccountingRulesetsParams contains all the parameters to send to the API endpoint -for the get accounting rulesets operation typically these are written to a http.Request +/* GetAccountingRulesetsParams contains all the parameters to send to the API endpoint + for the get accounting rulesets operation. + + Typically these are written to a http.Request. */ type GetAccountingRulesetsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetAccountingRulesetsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounting rulesets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesetsParams) WithDefaults() *GetAccountingRulesetsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounting rulesets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesetsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounting rulesets params func (o *GetAccountingRulesetsParams) WithTimeout(timeout time.Duration) *GetAccountingRulesetsParams { o.SetTimeout(timeout) @@ -164,6 +184,7 @@ func (o *GetAccountingRulesetsParams) WriteToRequest(r runtime.ClientRequest, re qrAccountID := o.AccountID qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } @@ -173,32 +194,34 @@ func (o *GetAccountingRulesetsParams) WriteToRequest(r runtime.ClientRequest, re // 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 { diff --git a/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_responses.go b/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_responses.go index cdd3f29..bfcc4e1 100644 --- a/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_responses.go +++ b/api/ledger/ledger_client/accounting_ruleset/get_accounting_rulesets_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountingRulesetsReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetAccountingRulesetsOK() *GetAccountingRulesetsOK { return &GetAccountingRulesetsOK{} } -/*GetAccountingRulesetsOK handles this case with default header values. +/* GetAccountingRulesetsOK describes a response with status code 200, with default header values. Taxnexus Response with Accounting Ruleset objects */ @@ -85,7 +84,6 @@ type GetAccountingRulesetsOK struct { func (o *GetAccountingRulesetsOK) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsOK %+v", 200, o.Payload) } - func (o *GetAccountingRulesetsOK) GetPayload() *ledger_models.AccountingRulesetResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetAccountingRulesetsUnauthorized() *GetAccountingRulesetsUnauthorized { return &GetAccountingRulesetsUnauthorized{} } -/*GetAccountingRulesetsUnauthorized handles this case with default header values. +/* GetAccountingRulesetsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetAccountingRulesetsUnauthorized struct { func (o *GetAccountingRulesetsUnauthorized) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountingRulesetsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetAccountingRulesetsForbidden() *GetAccountingRulesetsForbidden { return &GetAccountingRulesetsForbidden{} } -/*GetAccountingRulesetsForbidden handles this case with default header values. +/* GetAccountingRulesetsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetAccountingRulesetsForbidden struct { func (o *GetAccountingRulesetsForbidden) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsForbidden %+v", 403, o.Payload) } - func (o *GetAccountingRulesetsForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetAccountingRulesetsNotFound() *GetAccountingRulesetsNotFound { return &GetAccountingRulesetsNotFound{} } -/*GetAccountingRulesetsNotFound handles this case with default header values. +/* GetAccountingRulesetsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetAccountingRulesetsNotFound struct { func (o *GetAccountingRulesetsNotFound) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsNotFound %+v", 404, o.Payload) } - func (o *GetAccountingRulesetsNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetAccountingRulesetsUnprocessableEntity() *GetAccountingRulesetsUnproce return &GetAccountingRulesetsUnprocessableEntity{} } -/*GetAccountingRulesetsUnprocessableEntity handles this case with default header values. +/* GetAccountingRulesetsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetAccountingRulesetsUnprocessableEntity struct { func (o *GetAccountingRulesetsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountingRulesetsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetAccountingRulesetsInternalServerError() *GetAccountingRulesetsInterna return &GetAccountingRulesetsInternalServerError{} } -/*GetAccountingRulesetsInternalServerError handles this case with default header values. +/* GetAccountingRulesetsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetAccountingRulesetsInternalServerError struct { func (o *GetAccountingRulesetsInternalServerError) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountingRulesetsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_parameters.go b/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_parameters.go index 6201f86..ed4f1e6 100644 --- a/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_parameters.go +++ b/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) -// NewPostAccountingRulesetsParams creates a new PostAccountingRulesetsParams object -// with the default values initialized. +// NewPostAccountingRulesetsParams creates a new PostAccountingRulesetsParams 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 NewPostAccountingRulesetsParams() *PostAccountingRulesetsParams { - var () return &PostAccountingRulesetsParams{ - timeout: cr.DefaultTimeout, } } // NewPostAccountingRulesetsParamsWithTimeout creates a new PostAccountingRulesetsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostAccountingRulesetsParamsWithTimeout(timeout time.Duration) *PostAccountingRulesetsParams { - var () return &PostAccountingRulesetsParams{ - timeout: timeout, } } // NewPostAccountingRulesetsParamsWithContext creates a new PostAccountingRulesetsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostAccountingRulesetsParamsWithContext(ctx context.Context) *PostAccountingRulesetsParams { - var () return &PostAccountingRulesetsParams{ - Context: ctx, } } // NewPostAccountingRulesetsParamsWithHTTPClient creates a new PostAccountingRulesetsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostAccountingRulesetsParamsWithHTTPClient(client *http.Client) *PostAccountingRulesetsParams { - var () return &PostAccountingRulesetsParams{ HTTPClient: client, } } -/*PostAccountingRulesetsParams contains all the parameters to send to the API endpoint -for the post accounting rulesets operation typically these are written to a http.Request +/* PostAccountingRulesetsParams contains all the parameters to send to the API endpoint + for the post accounting rulesets operation. + + Typically these are written to a http.Request. */ type PostAccountingRulesetsParams struct { - /*AccountingRulesetRequest - An array of Accounting Ruleset records + /* AccountingRulesetRequest. + An array of Accounting Ruleset records */ AccountingRulesetRequest *ledger_models.AccountingRulesetRequest @@ -77,6 +76,21 @@ type PostAccountingRulesetsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post accounting rulesets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountingRulesetsParams) WithDefaults() *PostAccountingRulesetsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post accounting rulesets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountingRulesetsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post accounting rulesets params func (o *PostAccountingRulesetsParams) WithTimeout(timeout time.Duration) *PostAccountingRulesetsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostAccountingRulesetsParams) WriteToRequest(r runtime.ClientRequest, r return err } var res []error - if o.AccountingRulesetRequest != nil { if err := r.SetBodyParam(o.AccountingRulesetRequest); err != nil { return err diff --git a/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_responses.go b/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_responses.go index 9b1adca..bd7cd07 100644 --- a/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_responses.go +++ b/api/ledger/ledger_client/accounting_ruleset/post_accounting_rulesets_responses.go @@ -63,9 +63,8 @@ func (o *PostAccountingRulesetsReader) ReadResponse(response runtime.ClientRespo return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostAccountingRulesetsOK() *PostAccountingRulesetsOK { return &PostAccountingRulesetsOK{} } -/*PostAccountingRulesetsOK handles this case with default header values. +/* PostAccountingRulesetsOK describes a response with status code 200, with default header values. Taxnexus Response with Accounting Ruleset objects */ @@ -85,7 +84,6 @@ type PostAccountingRulesetsOK struct { func (o *PostAccountingRulesetsOK) Error() string { return fmt.Sprintf("[POST /accountingrulesets][%d] postAccountingRulesetsOK %+v", 200, o.Payload) } - func (o *PostAccountingRulesetsOK) GetPayload() *ledger_models.AccountingRulesetResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostAccountingRulesetsUnauthorized() *PostAccountingRulesetsUnauthorized return &PostAccountingRulesetsUnauthorized{} } -/*PostAccountingRulesetsUnauthorized handles this case with default header values. +/* PostAccountingRulesetsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostAccountingRulesetsUnauthorized struct { func (o *PostAccountingRulesetsUnauthorized) Error() string { return fmt.Sprintf("[POST /accountingrulesets][%d] postAccountingRulesetsUnauthorized %+v", 401, o.Payload) } - func (o *PostAccountingRulesetsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostAccountingRulesetsForbidden() *PostAccountingRulesetsForbidden { return &PostAccountingRulesetsForbidden{} } -/*PostAccountingRulesetsForbidden handles this case with default header values. +/* PostAccountingRulesetsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostAccountingRulesetsForbidden struct { func (o *PostAccountingRulesetsForbidden) Error() string { return fmt.Sprintf("[POST /accountingrulesets][%d] postAccountingRulesetsForbidden %+v", 403, o.Payload) } - func (o *PostAccountingRulesetsForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostAccountingRulesetsNotFound() *PostAccountingRulesetsNotFound { return &PostAccountingRulesetsNotFound{} } -/*PostAccountingRulesetsNotFound handles this case with default header values. +/* PostAccountingRulesetsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostAccountingRulesetsNotFound struct { func (o *PostAccountingRulesetsNotFound) Error() string { return fmt.Sprintf("[POST /accountingrulesets][%d] postAccountingRulesetsNotFound %+v", 404, o.Payload) } - func (o *PostAccountingRulesetsNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostAccountingRulesetsUnprocessableEntity() *PostAccountingRulesetsUnpro return &PostAccountingRulesetsUnprocessableEntity{} } -/*PostAccountingRulesetsUnprocessableEntity handles this case with default header values. +/* PostAccountingRulesetsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostAccountingRulesetsUnprocessableEntity struct { func (o *PostAccountingRulesetsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /accountingrulesets][%d] postAccountingRulesetsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostAccountingRulesetsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostAccountingRulesetsInternalServerError() *PostAccountingRulesetsInter return &PostAccountingRulesetsInternalServerError{} } -/*PostAccountingRulesetsInternalServerError handles this case with default header values. +/* PostAccountingRulesetsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostAccountingRulesetsInternalServerError struct { func (o *PostAccountingRulesetsInternalServerError) Error() string { return fmt.Sprintf("[POST /accountingrulesets][%d] postAccountingRulesetsInternalServerError %+v", 500, o.Payload) } - func (o *PostAccountingRulesetsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/coa/coa_client.go b/api/ledger/ledger_client/coa/coa_client.go index 48fef12..4088953 100644 --- a/api/ledger/ledger_client/coa/coa_client.go +++ b/api/ledger/ledger_client/coa/coa_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetCoas(params *GetCoasParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoasOK, error) + GetCoas(params *GetCoasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoasOK, error) - PostCoas(params *PostCoasParams, authInfo runtime.ClientAuthInfoWriter) (*PostCoasOK, error) + PostCoas(params *PostCoasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoasOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { /* GetCoas gets chart of accounts reports */ -func (a *Client) GetCoas(params *GetCoasParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoasOK, error) { +func (a *Client) GetCoas(params *GetCoasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoasOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCoasParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCoas", Method: "GET", PathPattern: "/coas", @@ -59,7 +61,12 @@ func (a *Client) GetCoas(params *GetCoasParams, authInfo runtime.ClientAuthInfoW 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 } @@ -76,13 +83,12 @@ func (a *Client) GetCoas(params *GetCoasParams, authInfo runtime.ClientAuthInfoW /* PostCoas creates new accounting report */ -func (a *Client) PostCoas(params *PostCoasParams, authInfo runtime.ClientAuthInfoWriter) (*PostCoasOK, error) { +func (a *Client) PostCoas(params *PostCoasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCoasOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCoasParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCoas", Method: "POST", PathPattern: "/coas", @@ -94,7 +100,12 @@ func (a *Client) PostCoas(params *PostCoasParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/ledger/ledger_client/coa/get_coas_parameters.go b/api/ledger/ledger_client/coa/get_coas_parameters.go index 73acf0c..336561d 100644 --- a/api/ledger/ledger_client/coa/get_coas_parameters.go +++ b/api/ledger/ledger_client/coa/get_coas_parameters.go @@ -20,68 +20,70 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetCoasParams creates a new GetCoasParams object -// with the default values initialized. +// NewGetCoasParams creates a new GetCoasParams 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 NewGetCoasParams() *GetCoasParams { - var () return &GetCoasParams{ - timeout: cr.DefaultTimeout, } } // NewGetCoasParamsWithTimeout creates a new GetCoasParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCoasParamsWithTimeout(timeout time.Duration) *GetCoasParams { - var () return &GetCoasParams{ - timeout: timeout, } } // NewGetCoasParamsWithContext creates a new GetCoasParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCoasParamsWithContext(ctx context.Context) *GetCoasParams { - var () return &GetCoasParams{ - Context: ctx, } } // NewGetCoasParamsWithHTTPClient creates a new GetCoasParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCoasParamsWithHTTPClient(client *http.Client) *GetCoasParams { - var () return &GetCoasParams{ HTTPClient: client, } } -/*GetCoasParams contains all the parameters to send to the API endpoint -for the get coas operation typically these are written to a http.Request +/* GetCoasParams contains all the parameters to send to the API endpoint + for the get coas operation. + + Typically these are written to a http.Request. */ type GetCoasParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*CoaID - Taxnexus Id of the Chart of Accounts to be retrieved + /* CoaID. + + Taxnexus Id of the Chart of Accounts to be retrieved */ CoaID *string - /*DateFrom - The Starting Date for an object retrieval + /* DateFrom. + + The Starting Date for an object retrieval */ DateFrom *string - /*DateTo - The Ending Date for an object retrieval + /* DateTo. + + The Ending Date for an object retrieval */ DateTo *string @@ -90,6 +92,21 @@ type GetCoasParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get coas params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoasParams) WithDefaults() *GetCoasParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get coas params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCoasParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get coas params func (o *GetCoasParams) WithTimeout(timeout time.Duration) *GetCoasParams { o.SetTimeout(timeout) @@ -179,64 +196,68 @@ func (o *GetCoasParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis // 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.CoaID != nil { // query param coaId var qrCoaID string + if o.CoaID != nil { qrCoaID = *o.CoaID } qCoaID := qrCoaID if qCoaID != "" { + if err := r.SetQueryParam("coaId", qCoaID); err != nil { return err } } - } if o.DateFrom != nil { // query param dateFrom var qrDateFrom string + if o.DateFrom != nil { qrDateFrom = *o.DateFrom } qDateFrom := qrDateFrom if qDateFrom != "" { + if err := r.SetQueryParam("dateFrom", qDateFrom); err != nil { return err } } - } if o.DateTo != nil { // query param dateTo var qrDateTo string + if o.DateTo != nil { qrDateTo = *o.DateTo } qDateTo := qrDateTo if qDateTo != "" { + if err := r.SetQueryParam("dateTo", qDateTo); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ledger/ledger_client/coa/get_coas_responses.go b/api/ledger/ledger_client/coa/get_coas_responses.go index 918e4c8..b9380bc 100644 --- a/api/ledger/ledger_client/coa/get_coas_responses.go +++ b/api/ledger/ledger_client/coa/get_coas_responses.go @@ -63,9 +63,8 @@ func (o *GetCoasReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetCoasOK() *GetCoasOK { return &GetCoasOK{} } -/*GetCoasOK handles this case with default header values. +/* GetCoasOK describes a response with status code 200, with default header values. Taxnexus Response with Chart of Accounts objects */ @@ -85,7 +84,6 @@ type GetCoasOK struct { func (o *GetCoasOK) Error() string { return fmt.Sprintf("[GET /coas][%d] getCoasOK %+v", 200, o.Payload) } - func (o *GetCoasOK) GetPayload() *ledger_models.CoaResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetCoasUnauthorized() *GetCoasUnauthorized { return &GetCoasUnauthorized{} } -/*GetCoasUnauthorized handles this case with default header values. +/* GetCoasUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetCoasUnauthorized struct { func (o *GetCoasUnauthorized) Error() string { return fmt.Sprintf("[GET /coas][%d] getCoasUnauthorized %+v", 401, o.Payload) } - func (o *GetCoasUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetCoasForbidden() *GetCoasForbidden { return &GetCoasForbidden{} } -/*GetCoasForbidden handles this case with default header values. +/* GetCoasForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetCoasForbidden struct { func (o *GetCoasForbidden) Error() string { return fmt.Sprintf("[GET /coas][%d] getCoasForbidden %+v", 403, o.Payload) } - func (o *GetCoasForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetCoasNotFound() *GetCoasNotFound { return &GetCoasNotFound{} } -/*GetCoasNotFound handles this case with default header values. +/* GetCoasNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetCoasNotFound struct { func (o *GetCoasNotFound) Error() string { return fmt.Sprintf("[GET /coas][%d] getCoasNotFound %+v", 404, o.Payload) } - func (o *GetCoasNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetCoasUnprocessableEntity() *GetCoasUnprocessableEntity { return &GetCoasUnprocessableEntity{} } -/*GetCoasUnprocessableEntity handles this case with default header values. +/* GetCoasUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetCoasUnprocessableEntity struct { func (o *GetCoasUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /coas][%d] getCoasUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCoasUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetCoasInternalServerError() *GetCoasInternalServerError { return &GetCoasInternalServerError{} } -/*GetCoasInternalServerError handles this case with default header values. +/* GetCoasInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetCoasInternalServerError struct { func (o *GetCoasInternalServerError) Error() string { return fmt.Sprintf("[GET /coas][%d] getCoasInternalServerError %+v", 500, o.Payload) } - func (o *GetCoasInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/coa/post_coas_parameters.go b/api/ledger/ledger_client/coa/post_coas_parameters.go index 1a9bbca..4922644 100644 --- a/api/ledger/ledger_client/coa/post_coas_parameters.go +++ b/api/ledger/ledger_client/coa/post_coas_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) -// NewPostCoasParams creates a new PostCoasParams object -// with the default values initialized. +// NewPostCoasParams creates a new PostCoasParams 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 NewPostCoasParams() *PostCoasParams { - var () return &PostCoasParams{ - timeout: cr.DefaultTimeout, } } // NewPostCoasParamsWithTimeout creates a new PostCoasParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCoasParamsWithTimeout(timeout time.Duration) *PostCoasParams { - var () return &PostCoasParams{ - timeout: timeout, } } // NewPostCoasParamsWithContext creates a new PostCoasParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCoasParamsWithContext(ctx context.Context) *PostCoasParams { - var () return &PostCoasParams{ - Context: ctx, } } // NewPostCoasParamsWithHTTPClient creates a new PostCoasParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCoasParamsWithHTTPClient(client *http.Client) *PostCoasParams { - var () return &PostCoasParams{ HTTPClient: client, } } -/*PostCoasParams contains all the parameters to send to the API endpoint -for the post coas operation typically these are written to a http.Request +/* PostCoasParams contains all the parameters to send to the API endpoint + for the post coas operation. + + Typically these are written to a http.Request. */ type PostCoasParams struct { - /*CoaRequest - An array of Coa records + /* CoaRequest. + An array of Coa records */ CoaRequest *ledger_models.CoaRequest @@ -77,6 +76,21 @@ type PostCoasParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post coas params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCoasParams) WithDefaults() *PostCoasParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post coas params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCoasParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post coas params func (o *PostCoasParams) WithTimeout(timeout time.Duration) *PostCoasParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostCoasParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.CoaRequest != nil { if err := r.SetBodyParam(o.CoaRequest); err != nil { return err diff --git a/api/ledger/ledger_client/coa/post_coas_responses.go b/api/ledger/ledger_client/coa/post_coas_responses.go index d2d57ba..50089c3 100644 --- a/api/ledger/ledger_client/coa/post_coas_responses.go +++ b/api/ledger/ledger_client/coa/post_coas_responses.go @@ -63,9 +63,8 @@ func (o *PostCoasReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostCoasOK() *PostCoasOK { return &PostCoasOK{} } -/*PostCoasOK handles this case with default header values. +/* PostCoasOK describes a response with status code 200, with default header values. Taxnexus Response with Chart of Accounts objects */ @@ -85,7 +84,6 @@ type PostCoasOK struct { func (o *PostCoasOK) Error() string { return fmt.Sprintf("[POST /coas][%d] postCoasOK %+v", 200, o.Payload) } - func (o *PostCoasOK) GetPayload() *ledger_models.CoaResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostCoasUnauthorized() *PostCoasUnauthorized { return &PostCoasUnauthorized{} } -/*PostCoasUnauthorized handles this case with default header values. +/* PostCoasUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostCoasUnauthorized struct { func (o *PostCoasUnauthorized) Error() string { return fmt.Sprintf("[POST /coas][%d] postCoasUnauthorized %+v", 401, o.Payload) } - func (o *PostCoasUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostCoasForbidden() *PostCoasForbidden { return &PostCoasForbidden{} } -/*PostCoasForbidden handles this case with default header values. +/* PostCoasForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostCoasForbidden struct { func (o *PostCoasForbidden) Error() string { return fmt.Sprintf("[POST /coas][%d] postCoasForbidden %+v", 403, o.Payload) } - func (o *PostCoasForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostCoasNotFound() *PostCoasNotFound { return &PostCoasNotFound{} } -/*PostCoasNotFound handles this case with default header values. +/* PostCoasNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostCoasNotFound struct { func (o *PostCoasNotFound) Error() string { return fmt.Sprintf("[POST /coas][%d] postCoasNotFound %+v", 404, o.Payload) } - func (o *PostCoasNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostCoasUnprocessableEntity() *PostCoasUnprocessableEntity { return &PostCoasUnprocessableEntity{} } -/*PostCoasUnprocessableEntity handles this case with default header values. +/* PostCoasUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostCoasUnprocessableEntity struct { func (o *PostCoasUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /coas][%d] postCoasUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostCoasUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostCoasInternalServerError() *PostCoasInternalServerError { return &PostCoasInternalServerError{} } -/*PostCoasInternalServerError handles this case with default header values. +/* PostCoasInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostCoasInternalServerError struct { func (o *PostCoasInternalServerError) Error() string { return fmt.Sprintf("[POST /coas][%d] postCoasInternalServerError %+v", 500, o.Payload) } - func (o *PostCoasInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/gl_account/get_gl_accounts_parameters.go b/api/ledger/ledger_client/gl_account/get_gl_accounts_parameters.go index aaa989d..b2f6964 100644 --- a/api/ledger/ledger_client/gl_account/get_gl_accounts_parameters.go +++ b/api/ledger/ledger_client/gl_account/get_gl_accounts_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetGlAccountsParams creates a new GetGlAccountsParams object -// with the default values initialized. +// NewGetGlAccountsParams creates a new GetGlAccountsParams 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 NewGetGlAccountsParams() *GetGlAccountsParams { - var () return &GetGlAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetGlAccountsParamsWithTimeout creates a new GetGlAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetGlAccountsParamsWithTimeout(timeout time.Duration) *GetGlAccountsParams { - var () return &GetGlAccountsParams{ - timeout: timeout, } } // NewGetGlAccountsParamsWithContext creates a new GetGlAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetGlAccountsParamsWithContext(ctx context.Context) *GetGlAccountsParams { - var () return &GetGlAccountsParams{ - Context: ctx, } } // NewGetGlAccountsParamsWithHTTPClient creates a new GetGlAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetGlAccountsParamsWithHTTPClient(client *http.Client) *GetGlAccountsParams { - var () return &GetGlAccountsParams{ HTTPClient: client, } } -/*GetGlAccountsParams contains all the parameters to send to the API endpoint -for the get gl accounts operation typically these are written to a http.Request +/* GetGlAccountsParams contains all the parameters to send to the API endpoint + for the get gl accounts operation. + + Typically these are written to a http.Request. */ type GetGlAccountsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*ID - Taxnexus Record Id + /* ID. + + Taxnexus Record Id */ ID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetGlAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get gl accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlAccountsParams) WithDefaults() *GetGlAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get gl accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get gl accounts params func (o *GetGlAccountsParams) WithTimeout(timeout time.Duration) *GetGlAccountsParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetGlAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // 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.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); 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 { diff --git a/api/ledger/ledger_client/gl_account/get_gl_accounts_responses.go b/api/ledger/ledger_client/gl_account/get_gl_accounts_responses.go index 6eb795d..1b2c1f1 100644 --- a/api/ledger/ledger_client/gl_account/get_gl_accounts_responses.go +++ b/api/ledger/ledger_client/gl_account/get_gl_accounts_responses.go @@ -63,9 +63,8 @@ func (o *GetGlAccountsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetGlAccountsOK() *GetGlAccountsOK { return &GetGlAccountsOK{} } -/*GetGlAccountsOK handles this case with default header values. +/* GetGlAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with GL Account objects with Journal Items */ @@ -85,7 +84,6 @@ type GetGlAccountsOK struct { func (o *GetGlAccountsOK) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsOK %+v", 200, o.Payload) } - func (o *GetGlAccountsOK) GetPayload() *ledger_models.GlAccountResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetGlAccountsUnauthorized() *GetGlAccountsUnauthorized { return &GetGlAccountsUnauthorized{} } -/*GetGlAccountsUnauthorized handles this case with default header values. +/* GetGlAccountsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetGlAccountsUnauthorized struct { func (o *GetGlAccountsUnauthorized) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsUnauthorized %+v", 401, o.Payload) } - func (o *GetGlAccountsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetGlAccountsForbidden() *GetGlAccountsForbidden { return &GetGlAccountsForbidden{} } -/*GetGlAccountsForbidden handles this case with default header values. +/* GetGlAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetGlAccountsForbidden struct { func (o *GetGlAccountsForbidden) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsForbidden %+v", 403, o.Payload) } - func (o *GetGlAccountsForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetGlAccountsNotFound() *GetGlAccountsNotFound { return &GetGlAccountsNotFound{} } -/*GetGlAccountsNotFound handles this case with default header values. +/* GetGlAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetGlAccountsNotFound struct { func (o *GetGlAccountsNotFound) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsNotFound %+v", 404, o.Payload) } - func (o *GetGlAccountsNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetGlAccountsUnprocessableEntity() *GetGlAccountsUnprocessableEntity { return &GetGlAccountsUnprocessableEntity{} } -/*GetGlAccountsUnprocessableEntity handles this case with default header values. +/* GetGlAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetGlAccountsUnprocessableEntity struct { func (o *GetGlAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetGlAccountsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetGlAccountsInternalServerError() *GetGlAccountsInternalServerError { return &GetGlAccountsInternalServerError{} } -/*GetGlAccountsInternalServerError handles this case with default header values. +/* GetGlAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetGlAccountsInternalServerError struct { func (o *GetGlAccountsInternalServerError) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsInternalServerError %+v", 500, o.Payload) } - func (o *GetGlAccountsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/gl_account/gl_account_client.go b/api/ledger/ledger_client/gl_account/gl_account_client.go index 95e7a2e..118b7fb 100644 --- a/api/ledger/ledger_client/gl_account/gl_account_client.go +++ b/api/ledger/ledger_client/gl_account/gl_account_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlAccountsOK, error) + GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlAccountsOK, error) - PostGlAccounts(params *PostGlAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostGlAccountsOK, error) + PostGlAccounts(params *PostGlAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostGlAccountsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Return a list of available General Accounts */ -func (a *Client) GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlAccountsOK, error) { +func (a *Client) GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetGlAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getGlAccounts", Method: "GET", PathPattern: "/glaccounts", @@ -61,7 +63,12 @@ func (a *Client) GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.Cli 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 } @@ -80,13 +87,12 @@ func (a *Client) GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.Cli Create new GL Accounts */ -func (a *Client) PostGlAccounts(params *PostGlAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostGlAccountsOK, error) { +func (a *Client) PostGlAccounts(params *PostGlAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostGlAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostGlAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postGlAccounts", Method: "POST", PathPattern: "/glaccounts", @@ -98,7 +104,12 @@ func (a *Client) PostGlAccounts(params *PostGlAccountsParams, authInfo runtime.C 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 } diff --git a/api/ledger/ledger_client/gl_account/post_gl_accounts_parameters.go b/api/ledger/ledger_client/gl_account/post_gl_accounts_parameters.go index dd4044c..adb1c76 100644 --- a/api/ledger/ledger_client/gl_account/post_gl_accounts_parameters.go +++ b/api/ledger/ledger_client/gl_account/post_gl_accounts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) -// NewPostGlAccountsParams creates a new PostGlAccountsParams object -// with the default values initialized. +// NewPostGlAccountsParams creates a new PostGlAccountsParams 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 NewPostGlAccountsParams() *PostGlAccountsParams { - var () return &PostGlAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPostGlAccountsParamsWithTimeout creates a new PostGlAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostGlAccountsParamsWithTimeout(timeout time.Duration) *PostGlAccountsParams { - var () return &PostGlAccountsParams{ - timeout: timeout, } } // NewPostGlAccountsParamsWithContext creates a new PostGlAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostGlAccountsParamsWithContext(ctx context.Context) *PostGlAccountsParams { - var () return &PostGlAccountsParams{ - Context: ctx, } } // NewPostGlAccountsParamsWithHTTPClient creates a new PostGlAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostGlAccountsParamsWithHTTPClient(client *http.Client) *PostGlAccountsParams { - var () return &PostGlAccountsParams{ HTTPClient: client, } } -/*PostGlAccountsParams contains all the parameters to send to the API endpoint -for the post gl accounts operation typically these are written to a http.Request +/* PostGlAccountsParams contains all the parameters to send to the API endpoint + for the post gl accounts operation. + + Typically these are written to a http.Request. */ type PostGlAccountsParams struct { - /*GlAccountRequest - An array of new GL Account records + /* GlAccountRequest. + An array of new GL Account records */ GlAccountRequest *ledger_models.GlAccountRequest @@ -77,6 +76,21 @@ type PostGlAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post gl accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostGlAccountsParams) WithDefaults() *PostGlAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post gl accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostGlAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post gl accounts params func (o *PostGlAccountsParams) WithTimeout(timeout time.Duration) *PostGlAccountsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostGlAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.GlAccountRequest != nil { if err := r.SetBodyParam(o.GlAccountRequest); err != nil { return err diff --git a/api/ledger/ledger_client/gl_account/post_gl_accounts_responses.go b/api/ledger/ledger_client/gl_account/post_gl_accounts_responses.go index 75d34f3..2be9055 100644 --- a/api/ledger/ledger_client/gl_account/post_gl_accounts_responses.go +++ b/api/ledger/ledger_client/gl_account/post_gl_accounts_responses.go @@ -63,9 +63,8 @@ func (o *PostGlAccountsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostGlAccountsOK() *PostGlAccountsOK { return &PostGlAccountsOK{} } -/*PostGlAccountsOK handles this case with default header values. +/* PostGlAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with GL Account objects with Journal Items */ @@ -85,7 +84,6 @@ type PostGlAccountsOK struct { func (o *PostGlAccountsOK) Error() string { return fmt.Sprintf("[POST /glaccounts][%d] postGlAccountsOK %+v", 200, o.Payload) } - func (o *PostGlAccountsOK) GetPayload() *ledger_models.GlAccountResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostGlAccountsUnauthorized() *PostGlAccountsUnauthorized { return &PostGlAccountsUnauthorized{} } -/*PostGlAccountsUnauthorized handles this case with default header values. +/* PostGlAccountsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostGlAccountsUnauthorized struct { func (o *PostGlAccountsUnauthorized) Error() string { return fmt.Sprintf("[POST /glaccounts][%d] postGlAccountsUnauthorized %+v", 401, o.Payload) } - func (o *PostGlAccountsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostGlAccountsForbidden() *PostGlAccountsForbidden { return &PostGlAccountsForbidden{} } -/*PostGlAccountsForbidden handles this case with default header values. +/* PostGlAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostGlAccountsForbidden struct { func (o *PostGlAccountsForbidden) Error() string { return fmt.Sprintf("[POST /glaccounts][%d] postGlAccountsForbidden %+v", 403, o.Payload) } - func (o *PostGlAccountsForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostGlAccountsNotFound() *PostGlAccountsNotFound { return &PostGlAccountsNotFound{} } -/*PostGlAccountsNotFound handles this case with default header values. +/* PostGlAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostGlAccountsNotFound struct { func (o *PostGlAccountsNotFound) Error() string { return fmt.Sprintf("[POST /glaccounts][%d] postGlAccountsNotFound %+v", 404, o.Payload) } - func (o *PostGlAccountsNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostGlAccountsUnprocessableEntity() *PostGlAccountsUnprocessableEntity { return &PostGlAccountsUnprocessableEntity{} } -/*PostGlAccountsUnprocessableEntity handles this case with default header values. +/* PostGlAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostGlAccountsUnprocessableEntity struct { func (o *PostGlAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /glaccounts][%d] postGlAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostGlAccountsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostGlAccountsInternalServerError() *PostGlAccountsInternalServerError { return &PostGlAccountsInternalServerError{} } -/*PostGlAccountsInternalServerError handles this case with default header values. +/* PostGlAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostGlAccountsInternalServerError struct { func (o *PostGlAccountsInternalServerError) Error() string { return fmt.Sprintf("[POST /glaccounts][%d] postGlAccountsInternalServerError %+v", 500, o.Payload) } - func (o *PostGlAccountsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/gl_balance/get_gl_balances_parameters.go b/api/ledger/ledger_client/gl_balance/get_gl_balances_parameters.go index c457741..af14257 100644 --- a/api/ledger/ledger_client/gl_balance/get_gl_balances_parameters.go +++ b/api/ledger/ledger_client/gl_balance/get_gl_balances_parameters.go @@ -20,68 +20,70 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetGlBalancesParams creates a new GetGlBalancesParams object -// with the default values initialized. +// NewGetGlBalancesParams creates a new GetGlBalancesParams 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 NewGetGlBalancesParams() *GetGlBalancesParams { - var () return &GetGlBalancesParams{ - timeout: cr.DefaultTimeout, } } // NewGetGlBalancesParamsWithTimeout creates a new GetGlBalancesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetGlBalancesParamsWithTimeout(timeout time.Duration) *GetGlBalancesParams { - var () return &GetGlBalancesParams{ - timeout: timeout, } } // NewGetGlBalancesParamsWithContext creates a new GetGlBalancesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetGlBalancesParamsWithContext(ctx context.Context) *GetGlBalancesParams { - var () return &GetGlBalancesParams{ - Context: ctx, } } // NewGetGlBalancesParamsWithHTTPClient creates a new GetGlBalancesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetGlBalancesParamsWithHTTPClient(client *http.Client) *GetGlBalancesParams { - var () return &GetGlBalancesParams{ HTTPClient: client, } } -/*GetGlBalancesParams contains all the parameters to send to the API endpoint -for the get gl balances operation typically these are written to a http.Request +/* GetGlBalancesParams contains all the parameters to send to the API endpoint + for the get gl balances operation. + + Typically these are written to a http.Request. */ type GetGlBalancesParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*GlAccountID - Taxnexus Record Id of Gl Account Record + /* GlAccountID. + + Taxnexus Record Id of Gl Account Record */ GlAccountID *string - /*ID - Taxnexus Record Id + /* ID. + + Taxnexus Record Id */ ID *string - /*PeriodID - Taxnexus Record Id of a Period + /* PeriodID. + + Taxnexus Record Id of a Period */ PeriodID *string @@ -90,6 +92,21 @@ type GetGlBalancesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get gl balances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlBalancesParams) WithDefaults() *GetGlBalancesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get gl balances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlBalancesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get gl balances params func (o *GetGlBalancesParams) WithTimeout(timeout time.Duration) *GetGlBalancesParams { o.SetTimeout(timeout) @@ -179,64 +196,68 @@ func (o *GetGlBalancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // 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.GlAccountID != nil { // query param glAccountId var qrGlAccountID string + if o.GlAccountID != nil { qrGlAccountID = *o.GlAccountID } qGlAccountID := qrGlAccountID if qGlAccountID != "" { + if err := r.SetQueryParam("glAccountId", qGlAccountID); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if o.PeriodID != nil { // query param periodId var qrPeriodID string + if o.PeriodID != nil { qrPeriodID = *o.PeriodID } qPeriodID := qrPeriodID if qPeriodID != "" { + if err := r.SetQueryParam("periodId", qPeriodID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ledger/ledger_client/gl_balance/get_gl_balances_responses.go b/api/ledger/ledger_client/gl_balance/get_gl_balances_responses.go index 1e370f0..e2fa78c 100644 --- a/api/ledger/ledger_client/gl_balance/get_gl_balances_responses.go +++ b/api/ledger/ledger_client/gl_balance/get_gl_balances_responses.go @@ -63,9 +63,8 @@ func (o *GetGlBalancesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetGlBalancesOK() *GetGlBalancesOK { return &GetGlBalancesOK{} } -/*GetGlBalancesOK handles this case with default header values. +/* GetGlBalancesOK describes a response with status code 200, with default header values. Taxnexus Response with GL Account objects with Journal Items */ @@ -85,7 +84,6 @@ type GetGlBalancesOK struct { func (o *GetGlBalancesOK) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesOK %+v", 200, o.Payload) } - func (o *GetGlBalancesOK) GetPayload() *ledger_models.GlBalanceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetGlBalancesUnauthorized() *GetGlBalancesUnauthorized { return &GetGlBalancesUnauthorized{} } -/*GetGlBalancesUnauthorized handles this case with default header values. +/* GetGlBalancesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetGlBalancesUnauthorized struct { func (o *GetGlBalancesUnauthorized) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesUnauthorized %+v", 401, o.Payload) } - func (o *GetGlBalancesUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetGlBalancesForbidden() *GetGlBalancesForbidden { return &GetGlBalancesForbidden{} } -/*GetGlBalancesForbidden handles this case with default header values. +/* GetGlBalancesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetGlBalancesForbidden struct { func (o *GetGlBalancesForbidden) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesForbidden %+v", 403, o.Payload) } - func (o *GetGlBalancesForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetGlBalancesNotFound() *GetGlBalancesNotFound { return &GetGlBalancesNotFound{} } -/*GetGlBalancesNotFound handles this case with default header values. +/* GetGlBalancesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetGlBalancesNotFound struct { func (o *GetGlBalancesNotFound) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesNotFound %+v", 404, o.Payload) } - func (o *GetGlBalancesNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetGlBalancesUnprocessableEntity() *GetGlBalancesUnprocessableEntity { return &GetGlBalancesUnprocessableEntity{} } -/*GetGlBalancesUnprocessableEntity handles this case with default header values. +/* GetGlBalancesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetGlBalancesUnprocessableEntity struct { func (o *GetGlBalancesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetGlBalancesUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetGlBalancesInternalServerError() *GetGlBalancesInternalServerError { return &GetGlBalancesInternalServerError{} } -/*GetGlBalancesInternalServerError handles this case with default header values. +/* GetGlBalancesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetGlBalancesInternalServerError struct { func (o *GetGlBalancesInternalServerError) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesInternalServerError %+v", 500, o.Payload) } - func (o *GetGlBalancesInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/gl_balance/gl_balance_client.go b/api/ledger/ledger_client/gl_balance/gl_balance_client.go index a569132..800df6d 100644 --- a/api/ledger/ledger_client/gl_balance/gl_balance_client.go +++ b/api/ledger/ledger_client/gl_balance/gl_balance_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlBalancesOK, error) + GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlBalancesOK, error) - PostGlBalances(params *PostGlBalancesParams, authInfo runtime.ClientAuthInfoWriter) (*PostGlBalancesOK, error) + PostGlBalances(params *PostGlBalancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostGlBalancesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Return a list of General Account Balances for a Taxnexus Account */ -func (a *Client) GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlBalancesOK, error) { +func (a *Client) GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlBalancesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetGlBalancesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getGlBalances", Method: "GET", PathPattern: "/glbalances", @@ -61,7 +63,12 @@ func (a *Client) GetGlBalances(params *GetGlBalancesParams, authInfo runtime.Cli 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 } @@ -80,13 +87,12 @@ func (a *Client) GetGlBalances(params *GetGlBalancesParams, authInfo runtime.Cli Insert new GL Balance records */ -func (a *Client) PostGlBalances(params *PostGlBalancesParams, authInfo runtime.ClientAuthInfoWriter) (*PostGlBalancesOK, error) { +func (a *Client) PostGlBalances(params *PostGlBalancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostGlBalancesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostGlBalancesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postGlBalances", Method: "POST", PathPattern: "/glbalances", @@ -98,7 +104,12 @@ func (a *Client) PostGlBalances(params *PostGlBalancesParams, authInfo runtime.C 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 } diff --git a/api/ledger/ledger_client/gl_balance/post_gl_balances_parameters.go b/api/ledger/ledger_client/gl_balance/post_gl_balances_parameters.go index bbe041d..eab77a7 100644 --- a/api/ledger/ledger_client/gl_balance/post_gl_balances_parameters.go +++ b/api/ledger/ledger_client/gl_balance/post_gl_balances_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) -// NewPostGlBalancesParams creates a new PostGlBalancesParams object -// with the default values initialized. +// NewPostGlBalancesParams creates a new PostGlBalancesParams 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 NewPostGlBalancesParams() *PostGlBalancesParams { - var () return &PostGlBalancesParams{ - timeout: cr.DefaultTimeout, } } // NewPostGlBalancesParamsWithTimeout creates a new PostGlBalancesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostGlBalancesParamsWithTimeout(timeout time.Duration) *PostGlBalancesParams { - var () return &PostGlBalancesParams{ - timeout: timeout, } } // NewPostGlBalancesParamsWithContext creates a new PostGlBalancesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostGlBalancesParamsWithContext(ctx context.Context) *PostGlBalancesParams { - var () return &PostGlBalancesParams{ - Context: ctx, } } // NewPostGlBalancesParamsWithHTTPClient creates a new PostGlBalancesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostGlBalancesParamsWithHTTPClient(client *http.Client) *PostGlBalancesParams { - var () return &PostGlBalancesParams{ HTTPClient: client, } } -/*PostGlBalancesParams contains all the parameters to send to the API endpoint -for the post gl balances operation typically these are written to a http.Request +/* PostGlBalancesParams contains all the parameters to send to the API endpoint + for the post gl balances operation. + + Typically these are written to a http.Request. */ type PostGlBalancesParams struct { - /*GlBalanceRequest - An array of new GL Balance records + /* GlBalanceRequest. + An array of new GL Balance records */ GlBalanceRequest *ledger_models.GlBalanceRequest @@ -77,6 +76,21 @@ type PostGlBalancesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post gl balances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostGlBalancesParams) WithDefaults() *PostGlBalancesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post gl balances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostGlBalancesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post gl balances params func (o *PostGlBalancesParams) WithTimeout(timeout time.Duration) *PostGlBalancesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostGlBalancesParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.GlBalanceRequest != nil { if err := r.SetBodyParam(o.GlBalanceRequest); err != nil { return err diff --git a/api/ledger/ledger_client/gl_balance/post_gl_balances_responses.go b/api/ledger/ledger_client/gl_balance/post_gl_balances_responses.go index d476f22..ec9bba2 100644 --- a/api/ledger/ledger_client/gl_balance/post_gl_balances_responses.go +++ b/api/ledger/ledger_client/gl_balance/post_gl_balances_responses.go @@ -63,9 +63,8 @@ func (o *PostGlBalancesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostGlBalancesOK() *PostGlBalancesOK { return &PostGlBalancesOK{} } -/*PostGlBalancesOK handles this case with default header values. +/* PostGlBalancesOK describes a response with status code 200, with default header values. Taxnexus Response with GL Account objects with Journal Items */ @@ -85,7 +84,6 @@ type PostGlBalancesOK struct { func (o *PostGlBalancesOK) Error() string { return fmt.Sprintf("[POST /glbalances][%d] postGlBalancesOK %+v", 200, o.Payload) } - func (o *PostGlBalancesOK) GetPayload() *ledger_models.GlBalanceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostGlBalancesUnauthorized() *PostGlBalancesUnauthorized { return &PostGlBalancesUnauthorized{} } -/*PostGlBalancesUnauthorized handles this case with default header values. +/* PostGlBalancesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostGlBalancesUnauthorized struct { func (o *PostGlBalancesUnauthorized) Error() string { return fmt.Sprintf("[POST /glbalances][%d] postGlBalancesUnauthorized %+v", 401, o.Payload) } - func (o *PostGlBalancesUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostGlBalancesForbidden() *PostGlBalancesForbidden { return &PostGlBalancesForbidden{} } -/*PostGlBalancesForbidden handles this case with default header values. +/* PostGlBalancesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostGlBalancesForbidden struct { func (o *PostGlBalancesForbidden) Error() string { return fmt.Sprintf("[POST /glbalances][%d] postGlBalancesForbidden %+v", 403, o.Payload) } - func (o *PostGlBalancesForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostGlBalancesNotFound() *PostGlBalancesNotFound { return &PostGlBalancesNotFound{} } -/*PostGlBalancesNotFound handles this case with default header values. +/* PostGlBalancesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostGlBalancesNotFound struct { func (o *PostGlBalancesNotFound) Error() string { return fmt.Sprintf("[POST /glbalances][%d] postGlBalancesNotFound %+v", 404, o.Payload) } - func (o *PostGlBalancesNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostGlBalancesUnprocessableEntity() *PostGlBalancesUnprocessableEntity { return &PostGlBalancesUnprocessableEntity{} } -/*PostGlBalancesUnprocessableEntity handles this case with default header values. +/* PostGlBalancesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostGlBalancesUnprocessableEntity struct { func (o *PostGlBalancesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /glbalances][%d] postGlBalancesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostGlBalancesUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostGlBalancesInternalServerError() *PostGlBalancesInternalServerError { return &PostGlBalancesInternalServerError{} } -/*PostGlBalancesInternalServerError handles this case with default header values. +/* PostGlBalancesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostGlBalancesInternalServerError struct { func (o *PostGlBalancesInternalServerError) Error() string { return fmt.Sprintf("[POST /glbalances][%d] postGlBalancesInternalServerError %+v", 500, o.Payload) } - func (o *PostGlBalancesInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/journal_entry/get_journal_entries_parameters.go b/api/ledger/ledger_client/journal_entry/get_journal_entries_parameters.go index 17bf29d..53c7f32 100644 --- a/api/ledger/ledger_client/journal_entry/get_journal_entries_parameters.go +++ b/api/ledger/ledger_client/journal_entry/get_journal_entries_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetJournalEntriesParams creates a new GetJournalEntriesParams object -// with the default values initialized. +// NewGetJournalEntriesParams creates a new GetJournalEntriesParams 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 NewGetJournalEntriesParams() *GetJournalEntriesParams { - var () return &GetJournalEntriesParams{ - timeout: cr.DefaultTimeout, } } // NewGetJournalEntriesParamsWithTimeout creates a new GetJournalEntriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetJournalEntriesParamsWithTimeout(timeout time.Duration) *GetJournalEntriesParams { - var () return &GetJournalEntriesParams{ - timeout: timeout, } } // NewGetJournalEntriesParamsWithContext creates a new GetJournalEntriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetJournalEntriesParamsWithContext(ctx context.Context) *GetJournalEntriesParams { - var () return &GetJournalEntriesParams{ - Context: ctx, } } // NewGetJournalEntriesParamsWithHTTPClient creates a new GetJournalEntriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetJournalEntriesParamsWithHTTPClient(client *http.Client) *GetJournalEntriesParams { - var () return &GetJournalEntriesParams{ HTTPClient: client, } } -/*GetJournalEntriesParams contains all the parameters to send to the API endpoint -for the get journal entries operation typically these are written to a http.Request +/* GetJournalEntriesParams contains all the parameters to send to the API endpoint + for the get journal entries operation. + + Typically these are written to a http.Request. */ type GetJournalEntriesParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*DateFrom - The Starting Date for an object retrieval + /* DateFrom. + + The Starting Date for an object retrieval */ DateFrom *string - /*DateTo - The Ending Date for an object retrieval + /* DateTo. + + The Ending Date for an object retrieval */ DateTo *string - /*ID - Taxnexus Record Id + /* ID. + + Taxnexus Record Id */ ID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetJournalEntriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get journal entries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJournalEntriesParams) WithDefaults() *GetJournalEntriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get journal entries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJournalEntriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get journal entries params func (o *GetJournalEntriesParams) WithTimeout(timeout time.Duration) *GetJournalEntriesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetJournalEntriesParams) WriteToRequest(r runtime.ClientRequest, reg st // 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.DateFrom != nil { // query param dateFrom var qrDateFrom string + if o.DateFrom != nil { qrDateFrom = *o.DateFrom } qDateFrom := qrDateFrom if qDateFrom != "" { + if err := r.SetQueryParam("dateFrom", qDateFrom); err != nil { return err } } - } if o.DateTo != nil { // query param dateTo var qrDateTo string + if o.DateTo != nil { qrDateTo = *o.DateTo } qDateTo := qrDateTo if qDateTo != "" { + if err := r.SetQueryParam("dateTo", qDateTo); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); 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 { diff --git a/api/ledger/ledger_client/journal_entry/get_journal_entries_responses.go b/api/ledger/ledger_client/journal_entry/get_journal_entries_responses.go index 54b526a..6905ef9 100644 --- a/api/ledger/ledger_client/journal_entry/get_journal_entries_responses.go +++ b/api/ledger/ledger_client/journal_entry/get_journal_entries_responses.go @@ -63,9 +63,8 @@ func (o *GetJournalEntriesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetJournalEntriesOK() *GetJournalEntriesOK { return &GetJournalEntriesOK{} } -/*GetJournalEntriesOK handles this case with default header values. +/* GetJournalEntriesOK describes a response with status code 200, with default header values. Taxnexus Response with Journal Entry objects with Journal Items */ @@ -85,7 +84,6 @@ type GetJournalEntriesOK struct { func (o *GetJournalEntriesOK) Error() string { return fmt.Sprintf("[GET /journalentries][%d] getJournalEntriesOK %+v", 200, o.Payload) } - func (o *GetJournalEntriesOK) GetPayload() *ledger_models.JournalEntryResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetJournalEntriesUnauthorized() *GetJournalEntriesUnauthorized { return &GetJournalEntriesUnauthorized{} } -/*GetJournalEntriesUnauthorized handles this case with default header values. +/* GetJournalEntriesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetJournalEntriesUnauthorized struct { func (o *GetJournalEntriesUnauthorized) Error() string { return fmt.Sprintf("[GET /journalentries][%d] getJournalEntriesUnauthorized %+v", 401, o.Payload) } - func (o *GetJournalEntriesUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetJournalEntriesForbidden() *GetJournalEntriesForbidden { return &GetJournalEntriesForbidden{} } -/*GetJournalEntriesForbidden handles this case with default header values. +/* GetJournalEntriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetJournalEntriesForbidden struct { func (o *GetJournalEntriesForbidden) Error() string { return fmt.Sprintf("[GET /journalentries][%d] getJournalEntriesForbidden %+v", 403, o.Payload) } - func (o *GetJournalEntriesForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetJournalEntriesNotFound() *GetJournalEntriesNotFound { return &GetJournalEntriesNotFound{} } -/*GetJournalEntriesNotFound handles this case with default header values. +/* GetJournalEntriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetJournalEntriesNotFound struct { func (o *GetJournalEntriesNotFound) Error() string { return fmt.Sprintf("[GET /journalentries][%d] getJournalEntriesNotFound %+v", 404, o.Payload) } - func (o *GetJournalEntriesNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetJournalEntriesUnprocessableEntity() *GetJournalEntriesUnprocessableEn return &GetJournalEntriesUnprocessableEntity{} } -/*GetJournalEntriesUnprocessableEntity handles this case with default header values. +/* GetJournalEntriesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetJournalEntriesUnprocessableEntity struct { func (o *GetJournalEntriesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /journalentries][%d] getJournalEntriesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetJournalEntriesUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetJournalEntriesInternalServerError() *GetJournalEntriesInternalServerE return &GetJournalEntriesInternalServerError{} } -/*GetJournalEntriesInternalServerError handles this case with default header values. +/* GetJournalEntriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetJournalEntriesInternalServerError struct { func (o *GetJournalEntriesInternalServerError) Error() string { return fmt.Sprintf("[GET /journalentries][%d] getJournalEntriesInternalServerError %+v", 500, o.Payload) } - func (o *GetJournalEntriesInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/journal_entry/journal_entry_client.go b/api/ledger/ledger_client/journal_entry/journal_entry_client.go index 1a2dfc8..068fc5f 100644 --- a/api/ledger/ledger_client/journal_entry/journal_entry_client.go +++ b/api/ledger/ledger_client/journal_entry/journal_entry_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetJournalEntries(params *GetJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetJournalEntriesOK, error) + GetJournalEntries(params *GetJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJournalEntriesOK, error) - PostJournalEntries(params *PostJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter) (*PostJournalEntriesOK, error) + PostJournalEntries(params *PostJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostJournalEntriesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Return a list of Journal Entries by by Journal Entry ID */ -func (a *Client) GetJournalEntries(params *GetJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetJournalEntriesOK, error) { +func (a *Client) GetJournalEntries(params *GetJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJournalEntriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetJournalEntriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getJournalEntries", Method: "GET", PathPattern: "/journalentries", @@ -61,7 +63,12 @@ func (a *Client) GetJournalEntries(params *GetJournalEntriesParams, authInfo run 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 } @@ -80,13 +87,12 @@ func (a *Client) GetJournalEntries(params *GetJournalEntriesParams, authInfo run Create new Journal Entry Records */ -func (a *Client) PostJournalEntries(params *PostJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter) (*PostJournalEntriesOK, error) { +func (a *Client) PostJournalEntries(params *PostJournalEntriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostJournalEntriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostJournalEntriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postJournalEntries", Method: "POST", PathPattern: "/journalentries", @@ -98,7 +104,12 @@ func (a *Client) PostJournalEntries(params *PostJournalEntriesParams, authInfo r 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 } diff --git a/api/ledger/ledger_client/journal_entry/post_journal_entries_parameters.go b/api/ledger/ledger_client/journal_entry/post_journal_entries_parameters.go index 175b723..4feb235 100644 --- a/api/ledger/ledger_client/journal_entry/post_journal_entries_parameters.go +++ b/api/ledger/ledger_client/journal_entry/post_journal_entries_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) -// NewPostJournalEntriesParams creates a new PostJournalEntriesParams object -// with the default values initialized. +// NewPostJournalEntriesParams creates a new PostJournalEntriesParams 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 NewPostJournalEntriesParams() *PostJournalEntriesParams { - var () return &PostJournalEntriesParams{ - timeout: cr.DefaultTimeout, } } // NewPostJournalEntriesParamsWithTimeout creates a new PostJournalEntriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostJournalEntriesParamsWithTimeout(timeout time.Duration) *PostJournalEntriesParams { - var () return &PostJournalEntriesParams{ - timeout: timeout, } } // NewPostJournalEntriesParamsWithContext creates a new PostJournalEntriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostJournalEntriesParamsWithContext(ctx context.Context) *PostJournalEntriesParams { - var () return &PostJournalEntriesParams{ - Context: ctx, } } // NewPostJournalEntriesParamsWithHTTPClient creates a new PostJournalEntriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostJournalEntriesParamsWithHTTPClient(client *http.Client) *PostJournalEntriesParams { - var () return &PostJournalEntriesParams{ HTTPClient: client, } } -/*PostJournalEntriesParams contains all the parameters to send to the API endpoint -for the post journal entries operation typically these are written to a http.Request +/* PostJournalEntriesParams contains all the parameters to send to the API endpoint + for the post journal entries operation. + + Typically these are written to a http.Request. */ type PostJournalEntriesParams struct { - /*JournalEntryRequest - An array of Journal Entry records + /* JournalEntryRequest. + An array of Journal Entry records */ JournalEntryRequest *ledger_models.JournalEntryRequest @@ -77,6 +76,21 @@ type PostJournalEntriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post journal entries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostJournalEntriesParams) WithDefaults() *PostJournalEntriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post journal entries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostJournalEntriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post journal entries params func (o *PostJournalEntriesParams) WithTimeout(timeout time.Duration) *PostJournalEntriesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostJournalEntriesParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if o.JournalEntryRequest != nil { if err := r.SetBodyParam(o.JournalEntryRequest); err != nil { return err diff --git a/api/ledger/ledger_client/journal_entry/post_journal_entries_responses.go b/api/ledger/ledger_client/journal_entry/post_journal_entries_responses.go index 00388a0..6ce44f5 100644 --- a/api/ledger/ledger_client/journal_entry/post_journal_entries_responses.go +++ b/api/ledger/ledger_client/journal_entry/post_journal_entries_responses.go @@ -63,9 +63,8 @@ func (o *PostJournalEntriesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostJournalEntriesOK() *PostJournalEntriesOK { return &PostJournalEntriesOK{} } -/*PostJournalEntriesOK handles this case with default header values. +/* PostJournalEntriesOK describes a response with status code 200, with default header values. Taxnexus Response with Journal Entry objects with Journal Items */ @@ -85,7 +84,6 @@ type PostJournalEntriesOK struct { func (o *PostJournalEntriesOK) Error() string { return fmt.Sprintf("[POST /journalentries][%d] postJournalEntriesOK %+v", 200, o.Payload) } - func (o *PostJournalEntriesOK) GetPayload() *ledger_models.JournalEntryResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostJournalEntriesUnauthorized() *PostJournalEntriesUnauthorized { return &PostJournalEntriesUnauthorized{} } -/*PostJournalEntriesUnauthorized handles this case with default header values. +/* PostJournalEntriesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostJournalEntriesUnauthorized struct { func (o *PostJournalEntriesUnauthorized) Error() string { return fmt.Sprintf("[POST /journalentries][%d] postJournalEntriesUnauthorized %+v", 401, o.Payload) } - func (o *PostJournalEntriesUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostJournalEntriesForbidden() *PostJournalEntriesForbidden { return &PostJournalEntriesForbidden{} } -/*PostJournalEntriesForbidden handles this case with default header values. +/* PostJournalEntriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostJournalEntriesForbidden struct { func (o *PostJournalEntriesForbidden) Error() string { return fmt.Sprintf("[POST /journalentries][%d] postJournalEntriesForbidden %+v", 403, o.Payload) } - func (o *PostJournalEntriesForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostJournalEntriesNotFound() *PostJournalEntriesNotFound { return &PostJournalEntriesNotFound{} } -/*PostJournalEntriesNotFound handles this case with default header values. +/* PostJournalEntriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostJournalEntriesNotFound struct { func (o *PostJournalEntriesNotFound) Error() string { return fmt.Sprintf("[POST /journalentries][%d] postJournalEntriesNotFound %+v", 404, o.Payload) } - func (o *PostJournalEntriesNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostJournalEntriesUnprocessableEntity() *PostJournalEntriesUnprocessable return &PostJournalEntriesUnprocessableEntity{} } -/*PostJournalEntriesUnprocessableEntity handles this case with default header values. +/* PostJournalEntriesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostJournalEntriesUnprocessableEntity struct { func (o *PostJournalEntriesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /journalentries][%d] postJournalEntriesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostJournalEntriesUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostJournalEntriesInternalServerError() *PostJournalEntriesInternalServe return &PostJournalEntriesInternalServerError{} } -/*PostJournalEntriesInternalServerError handles this case with default header values. +/* PostJournalEntriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostJournalEntriesInternalServerError struct { func (o *PostJournalEntriesInternalServerError) Error() string { return fmt.Sprintf("[POST /journalentries][%d] postJournalEntriesInternalServerError %+v", 500, o.Payload) } - func (o *PostJournalEntriesInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/journal_item/get_journal_items_parameters.go b/api/ledger/ledger_client/journal_item/get_journal_items_parameters.go index 78a5934..2ccb6ae 100644 --- a/api/ledger/ledger_client/journal_item/get_journal_items_parameters.go +++ b/api/ledger/ledger_client/journal_item/get_journal_items_parameters.go @@ -21,68 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewGetJournalItemsParams creates a new GetJournalItemsParams object -// with the default values initialized. +// NewGetJournalItemsParams creates a new GetJournalItemsParams 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 NewGetJournalItemsParams() *GetJournalItemsParams { - var () return &GetJournalItemsParams{ - timeout: cr.DefaultTimeout, } } // NewGetJournalItemsParamsWithTimeout creates a new GetJournalItemsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetJournalItemsParamsWithTimeout(timeout time.Duration) *GetJournalItemsParams { - var () return &GetJournalItemsParams{ - timeout: timeout, } } // NewGetJournalItemsParamsWithContext creates a new GetJournalItemsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetJournalItemsParamsWithContext(ctx context.Context) *GetJournalItemsParams { - var () return &GetJournalItemsParams{ - Context: ctx, } } // NewGetJournalItemsParamsWithHTTPClient creates a new GetJournalItemsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetJournalItemsParamsWithHTTPClient(client *http.Client) *GetJournalItemsParams { - var () return &GetJournalItemsParams{ HTTPClient: client, } } -/*GetJournalItemsParams contains all the parameters to send to the API endpoint -for the get journal items operation typically these are written to a http.Request +/* GetJournalItemsParams contains all the parameters to send to the API endpoint + for the get journal items operation. + + Typically these are written to a http.Request. */ type GetJournalItemsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID string - /*Month - The Month Number (1,2, ..., 12) of the report + /* Month. + + The Month Number (1,2, ..., 12) of the report + + Format: int64 */ Month *int64 - /*Quarter - The Quarter Number (1,2,3,4) of the report + /* Quarter. + + The Quarter Number (1,2,3,4) of the report + + Format: int64 */ Quarter *int64 - /*Year - The year of the report + /* Year. + + The year of the report + + Format: int64 */ Year *int64 @@ -91,6 +99,21 @@ type GetJournalItemsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get journal items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJournalItemsParams) WithDefaults() *GetJournalItemsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get journal items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJournalItemsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get journal items params func (o *GetJournalItemsParams) WithTimeout(timeout time.Duration) *GetJournalItemsParams { o.SetTimeout(timeout) @@ -180,6 +203,7 @@ func (o *GetJournalItemsParams) WriteToRequest(r runtime.ClientRequest, reg strf qrAccountID := o.AccountID qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } @@ -189,48 +213,51 @@ func (o *GetJournalItemsParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param month var qrMonth int64 + if o.Month != nil { qrMonth = *o.Month } qMonth := swag.FormatInt64(qrMonth) if qMonth != "" { + if err := r.SetQueryParam("month", qMonth); err != nil { return err } } - } if o.Quarter != nil { // query param quarter var qrQuarter int64 + if o.Quarter != nil { qrQuarter = *o.Quarter } qQuarter := swag.FormatInt64(qrQuarter) if qQuarter != "" { + if err := r.SetQueryParam("quarter", qQuarter); err != nil { return err } } - } if o.Year != nil { // query param year var qrYear int64 + if o.Year != nil { qrYear = *o.Year } qYear := swag.FormatInt64(qrYear) if qYear != "" { + if err := r.SetQueryParam("year", qYear); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ledger/ledger_client/journal_item/get_journal_items_responses.go b/api/ledger/ledger_client/journal_item/get_journal_items_responses.go index ba2cfb8..4c04341 100644 --- a/api/ledger/ledger_client/journal_item/get_journal_items_responses.go +++ b/api/ledger/ledger_client/journal_item/get_journal_items_responses.go @@ -63,9 +63,8 @@ func (o *GetJournalItemsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetJournalItemsOK() *GetJournalItemsOK { return &GetJournalItemsOK{} } -/*GetJournalItemsOK handles this case with default header values. +/* GetJournalItemsOK describes a response with status code 200, with default header values. Taxnexus Response with Journal Item objects */ @@ -85,7 +84,6 @@ type GetJournalItemsOK struct { func (o *GetJournalItemsOK) Error() string { return fmt.Sprintf("[GET /journalitems][%d] getJournalItemsOK %+v", 200, o.Payload) } - func (o *GetJournalItemsOK) GetPayload() *ledger_models.JournalItemSummaryResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetJournalItemsUnauthorized() *GetJournalItemsUnauthorized { return &GetJournalItemsUnauthorized{} } -/*GetJournalItemsUnauthorized handles this case with default header values. +/* GetJournalItemsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetJournalItemsUnauthorized struct { func (o *GetJournalItemsUnauthorized) Error() string { return fmt.Sprintf("[GET /journalitems][%d] getJournalItemsUnauthorized %+v", 401, o.Payload) } - func (o *GetJournalItemsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetJournalItemsForbidden() *GetJournalItemsForbidden { return &GetJournalItemsForbidden{} } -/*GetJournalItemsForbidden handles this case with default header values. +/* GetJournalItemsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetJournalItemsForbidden struct { func (o *GetJournalItemsForbidden) Error() string { return fmt.Sprintf("[GET /journalitems][%d] getJournalItemsForbidden %+v", 403, o.Payload) } - func (o *GetJournalItemsForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetJournalItemsNotFound() *GetJournalItemsNotFound { return &GetJournalItemsNotFound{} } -/*GetJournalItemsNotFound handles this case with default header values. +/* GetJournalItemsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetJournalItemsNotFound struct { func (o *GetJournalItemsNotFound) Error() string { return fmt.Sprintf("[GET /journalitems][%d] getJournalItemsNotFound %+v", 404, o.Payload) } - func (o *GetJournalItemsNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetJournalItemsUnprocessableEntity() *GetJournalItemsUnprocessableEntity return &GetJournalItemsUnprocessableEntity{} } -/*GetJournalItemsUnprocessableEntity handles this case with default header values. +/* GetJournalItemsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetJournalItemsUnprocessableEntity struct { func (o *GetJournalItemsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /journalitems][%d] getJournalItemsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetJournalItemsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetJournalItemsInternalServerError() *GetJournalItemsInternalServerError return &GetJournalItemsInternalServerError{} } -/*GetJournalItemsInternalServerError handles this case with default header values. +/* GetJournalItemsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetJournalItemsInternalServerError struct { func (o *GetJournalItemsInternalServerError) Error() string { return fmt.Sprintf("[GET /journalitems][%d] getJournalItemsInternalServerError %+v", 500, o.Payload) } - func (o *GetJournalItemsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/journal_item/journal_item_client.go b/api/ledger/ledger_client/journal_item/journal_item_client.go index fd371aa..3dc0a02 100644 --- a/api/ledger/ledger_client/journal_item/journal_item_client.go +++ b/api/ledger/ledger_client/journal_item/journal_item_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetJournalItems(params *GetJournalItemsParams, authInfo runtime.ClientAuthInfoWriter) (*GetJournalItemsOK, error) + GetJournalItems(params *GetJournalItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJournalItemsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Get summaries of Journal Items by year, month and Quarter */ -func (a *Client) GetJournalItems(params *GetJournalItemsParams, authInfo runtime.ClientAuthInfoWriter) (*GetJournalItemsOK, error) { +func (a *Client) GetJournalItems(params *GetJournalItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJournalItemsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetJournalItemsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getJournalItems", Method: "GET", PathPattern: "/journalitems", @@ -59,7 +61,12 @@ func (a *Client) GetJournalItems(params *GetJournalItemsParams, authInfo runtime 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 } diff --git a/api/ledger/ledger_client/period/get_periods_parameters.go b/api/ledger/ledger_client/period/get_periods_parameters.go index a586ba8..accdfda 100644 --- a/api/ledger/ledger_client/period/get_periods_parameters.go +++ b/api/ledger/ledger_client/period/get_periods_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPeriodsParams creates a new GetPeriodsParams object -// with the default values initialized. +// NewGetPeriodsParams creates a new GetPeriodsParams 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 NewGetPeriodsParams() *GetPeriodsParams { - var () return &GetPeriodsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPeriodsParamsWithTimeout creates a new GetPeriodsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPeriodsParamsWithTimeout(timeout time.Duration) *GetPeriodsParams { - var () return &GetPeriodsParams{ - timeout: timeout, } } // NewGetPeriodsParamsWithContext creates a new GetPeriodsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPeriodsParamsWithContext(ctx context.Context) *GetPeriodsParams { - var () return &GetPeriodsParams{ - Context: ctx, } } // NewGetPeriodsParamsWithHTTPClient creates a new GetPeriodsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPeriodsParamsWithHTTPClient(client *http.Client) *GetPeriodsParams { - var () return &GetPeriodsParams{ HTTPClient: client, } } -/*GetPeriodsParams contains all the parameters to send to the API endpoint -for the get periods operation typically these are written to a http.Request +/* GetPeriodsParams contains all the parameters to send to the API endpoint + for the get periods operation. + + Typically these are written to a http.Request. */ type GetPeriodsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*Date - The Date for an object retrieval + /* Date. + + The Date for an object retrieval */ Date *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*PeriodID - Taxnexus Record Id of a Period + /* PeriodID. + + Taxnexus Record Id of a Period */ PeriodID *string @@ -96,6 +103,21 @@ type GetPeriodsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get periods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPeriodsParams) WithDefaults() *GetPeriodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get periods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPeriodsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get periods params func (o *GetPeriodsParams) WithTimeout(timeout time.Duration) *GetPeriodsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetPeriodsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // 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.Date != nil { // query param date var qrDate string + if o.Date != nil { qrDate = *o.Date } qDate := qrDate if qDate != "" { + if err := r.SetQueryParam("date", qDate); 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 o.PeriodID != nil { // query param periodId var qrPeriodID string + if o.PeriodID != nil { qrPeriodID = *o.PeriodID } qPeriodID := qrPeriodID if qPeriodID != "" { + if err := r.SetQueryParam("periodId", qPeriodID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ledger/ledger_client/period/get_periods_responses.go b/api/ledger/ledger_client/period/get_periods_responses.go index 2785d42..f3f2485 100644 --- a/api/ledger/ledger_client/period/get_periods_responses.go +++ b/api/ledger/ledger_client/period/get_periods_responses.go @@ -63,9 +63,8 @@ func (o *GetPeriodsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetPeriodsOK() *GetPeriodsOK { return &GetPeriodsOK{} } -/*GetPeriodsOK handles this case with default header values. +/* GetPeriodsOK describes a response with status code 200, with default header values. Taxnexus Response with Period objects */ @@ -85,7 +84,6 @@ type GetPeriodsOK struct { func (o *GetPeriodsOK) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsOK %+v", 200, o.Payload) } - func (o *GetPeriodsOK) GetPayload() *ledger_models.PeriodResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetPeriodsUnauthorized() *GetPeriodsUnauthorized { return &GetPeriodsUnauthorized{} } -/*GetPeriodsUnauthorized handles this case with default header values. +/* GetPeriodsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetPeriodsUnauthorized struct { func (o *GetPeriodsUnauthorized) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsUnauthorized %+v", 401, o.Payload) } - func (o *GetPeriodsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetPeriodsForbidden() *GetPeriodsForbidden { return &GetPeriodsForbidden{} } -/*GetPeriodsForbidden handles this case with default header values. +/* GetPeriodsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetPeriodsForbidden struct { func (o *GetPeriodsForbidden) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsForbidden %+v", 403, o.Payload) } - func (o *GetPeriodsForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetPeriodsNotFound() *GetPeriodsNotFound { return &GetPeriodsNotFound{} } -/*GetPeriodsNotFound handles this case with default header values. +/* GetPeriodsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetPeriodsNotFound struct { func (o *GetPeriodsNotFound) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsNotFound %+v", 404, o.Payload) } - func (o *GetPeriodsNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetPeriodsUnprocessableEntity() *GetPeriodsUnprocessableEntity { return &GetPeriodsUnprocessableEntity{} } -/*GetPeriodsUnprocessableEntity handles this case with default header values. +/* GetPeriodsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetPeriodsUnprocessableEntity struct { func (o *GetPeriodsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPeriodsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetPeriodsInternalServerError() *GetPeriodsInternalServerError { return &GetPeriodsInternalServerError{} } -/*GetPeriodsInternalServerError handles this case with default header values. +/* GetPeriodsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetPeriodsInternalServerError struct { func (o *GetPeriodsInternalServerError) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsInternalServerError %+v", 500, o.Payload) } - func (o *GetPeriodsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_client/period/period_client.go b/api/ledger/ledger_client/period/period_client.go index ce12eca..eb93fe5 100644 --- a/api/ledger/ledger_client/period/period_client.go +++ b/api/ledger/ledger_client/period/period_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPeriodsOK, error) + GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPeriodsOK, error) - PostPeriods(params *PostPeriodsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPeriodsOK, error) + PostPeriods(params *PostPeriodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPeriodsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Return a list of Periods for an Account */ -func (a *Client) GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPeriodsOK, error) { +func (a *Client) GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPeriodsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPeriodsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPeriods", Method: "GET", PathPattern: "/periods", @@ -61,7 +63,12 @@ func (a *Client) GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAut 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 } @@ -80,13 +87,12 @@ func (a *Client) GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAut Update Period records */ -func (a *Client) PostPeriods(params *PostPeriodsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPeriodsOK, error) { +func (a *Client) PostPeriods(params *PostPeriodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPeriodsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPeriodsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPeriods", Method: "POST", PathPattern: "/periods", @@ -98,7 +104,12 @@ func (a *Client) PostPeriods(params *PostPeriodsParams, authInfo runtime.ClientA 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 } diff --git a/api/ledger/ledger_client/period/post_periods_parameters.go b/api/ledger/ledger_client/period/post_periods_parameters.go index 79250de..51d6d61 100644 --- a/api/ledger/ledger_client/period/post_periods_parameters.go +++ b/api/ledger/ledger_client/period/post_periods_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) -// NewPostPeriodsParams creates a new PostPeriodsParams object -// with the default values initialized. +// NewPostPeriodsParams creates a new PostPeriodsParams 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 NewPostPeriodsParams() *PostPeriodsParams { - var () return &PostPeriodsParams{ - timeout: cr.DefaultTimeout, } } // NewPostPeriodsParamsWithTimeout creates a new PostPeriodsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPeriodsParamsWithTimeout(timeout time.Duration) *PostPeriodsParams { - var () return &PostPeriodsParams{ - timeout: timeout, } } // NewPostPeriodsParamsWithContext creates a new PostPeriodsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPeriodsParamsWithContext(ctx context.Context) *PostPeriodsParams { - var () return &PostPeriodsParams{ - Context: ctx, } } // NewPostPeriodsParamsWithHTTPClient creates a new PostPeriodsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPeriodsParamsWithHTTPClient(client *http.Client) *PostPeriodsParams { - var () return &PostPeriodsParams{ HTTPClient: client, } } -/*PostPeriodsParams contains all the parameters to send to the API endpoint -for the post periods operation typically these are written to a http.Request +/* PostPeriodsParams contains all the parameters to send to the API endpoint + for the post periods operation. + + Typically these are written to a http.Request. */ type PostPeriodsParams struct { - /*PeriodRequest - An array of Period records + /* PeriodRequest. + An array of Period records */ PeriodRequest *ledger_models.PeriodRequest @@ -77,6 +76,21 @@ type PostPeriodsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post periods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPeriodsParams) WithDefaults() *PostPeriodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post periods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPeriodsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post periods params func (o *PostPeriodsParams) WithTimeout(timeout time.Duration) *PostPeriodsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPeriodsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.PeriodRequest != nil { if err := r.SetBodyParam(o.PeriodRequest); err != nil { return err diff --git a/api/ledger/ledger_client/period/post_periods_responses.go b/api/ledger/ledger_client/period/post_periods_responses.go index 9c1e621..5e14e9a 100644 --- a/api/ledger/ledger_client/period/post_periods_responses.go +++ b/api/ledger/ledger_client/period/post_periods_responses.go @@ -63,9 +63,8 @@ func (o *PostPeriodsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostPeriodsOK() *PostPeriodsOK { return &PostPeriodsOK{} } -/*PostPeriodsOK handles this case with default header values. +/* PostPeriodsOK describes a response with status code 200, with default header values. Taxnexus Response with Period objects */ @@ -85,7 +84,6 @@ type PostPeriodsOK struct { func (o *PostPeriodsOK) Error() string { return fmt.Sprintf("[POST /periods][%d] postPeriodsOK %+v", 200, o.Payload) } - func (o *PostPeriodsOK) GetPayload() *ledger_models.PeriodResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostPeriodsUnauthorized() *PostPeriodsUnauthorized { return &PostPeriodsUnauthorized{} } -/*PostPeriodsUnauthorized handles this case with default header values. +/* PostPeriodsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostPeriodsUnauthorized struct { func (o *PostPeriodsUnauthorized) Error() string { return fmt.Sprintf("[POST /periods][%d] postPeriodsUnauthorized %+v", 401, o.Payload) } - func (o *PostPeriodsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostPeriodsForbidden() *PostPeriodsForbidden { return &PostPeriodsForbidden{} } -/*PostPeriodsForbidden handles this case with default header values. +/* PostPeriodsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostPeriodsForbidden struct { func (o *PostPeriodsForbidden) Error() string { return fmt.Sprintf("[POST /periods][%d] postPeriodsForbidden %+v", 403, o.Payload) } - func (o *PostPeriodsForbidden) GetPayload() *ledger_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostPeriodsNotFound() *PostPeriodsNotFound { return &PostPeriodsNotFound{} } -/*PostPeriodsNotFound handles this case with default header values. +/* PostPeriodsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostPeriodsNotFound struct { func (o *PostPeriodsNotFound) Error() string { return fmt.Sprintf("[POST /periods][%d] postPeriodsNotFound %+v", 404, o.Payload) } - func (o *PostPeriodsNotFound) GetPayload() *ledger_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostPeriodsUnprocessableEntity() *PostPeriodsUnprocessableEntity { return &PostPeriodsUnprocessableEntity{} } -/*PostPeriodsUnprocessableEntity handles this case with default header values. +/* PostPeriodsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostPeriodsUnprocessableEntity struct { func (o *PostPeriodsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /periods][%d] postPeriodsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostPeriodsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostPeriodsInternalServerError() *PostPeriodsInternalServerError { return &PostPeriodsInternalServerError{} } -/*PostPeriodsInternalServerError handles this case with default header values. +/* PostPeriodsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostPeriodsInternalServerError struct { func (o *PostPeriodsInternalServerError) Error() string { return fmt.Sprintf("[POST /periods][%d] postPeriodsInternalServerError %+v", 500, o.Payload) } - func (o *PostPeriodsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } diff --git a/api/ledger/ledger_models/accounting_rule.go b/api/ledger/ledger_models/accounting_rule.go index fa4d74d..4338da1 100644 --- a/api/ledger/ledger_models/accounting_rule.go +++ b/api/ledger/ledger_models/accounting_rule.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -85,6 +87,11 @@ func (m *AccountingRule) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this accounting rule based on context it is used +func (m *AccountingRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AccountingRule) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/accounting_rule_request.go b/api/ledger/ledger_models/accounting_rule_request.go index 782e308..c434665 100644 --- a/api/ledger/ledger_models/accounting_rule_request.go +++ b/api/ledger/ledger_models/accounting_rule_request.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *AccountingRuleRequest) Validate(formats strfmt.Registry) error { } func (m *AccountingRuleRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *AccountingRuleRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting rule request based on the context it is used +func (m *AccountingRuleRequest) 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 *AccountingRuleRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRuleRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/accounting_rule_response.go b/api/ledger/ledger_models/accounting_rule_response.go index 2588a98..d995e1b 100644 --- a/api/ledger/ledger_models/accounting_rule_response.go +++ b/api/ledger/ledger_models/accounting_rule_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountingRuleResponse) Validate(formats strfmt.Registry) error { } func (m *AccountingRuleResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountingRuleResponse) validateData(formats strfmt.Registry) error { } func (m *AccountingRuleResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountingRuleResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting rule response based on the context it is used +func (m *AccountingRuleResponse) 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 *AccountingRuleResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountingRuleResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRuleResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/accounting_ruleset.go b/api/ledger/ledger_models/accounting_ruleset.go index ab4484c..d2e2d16 100644 --- a/api/ledger/ledger_models/accounting_ruleset.go +++ b/api/ledger/ledger_models/accounting_ruleset.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -68,7 +69,6 @@ func (m *AccountingRuleset) Validate(formats strfmt.Registry) error { } func (m *AccountingRuleset) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -92,6 +92,38 @@ func (m *AccountingRuleset) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting ruleset based on the context it is used +func (m *AccountingRuleset) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AccountingRuleset) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRuleset) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/accounting_ruleset_item.go b/api/ledger/ledger_models/accounting_ruleset_item.go index 62f6d6b..ad9a47b 100644 --- a/api/ledger/ledger_models/accounting_ruleset_item.go +++ b/api/ledger/ledger_models/accounting_ruleset_item.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *AccountingRulesetItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this accounting ruleset item based on context it is used +func (m *AccountingRulesetItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AccountingRulesetItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/accounting_ruleset_request.go b/api/ledger/ledger_models/accounting_ruleset_request.go index 148e5a6..2efe843 100644 --- a/api/ledger/ledger_models/accounting_ruleset_request.go +++ b/api/ledger/ledger_models/accounting_ruleset_request.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *AccountingRulesetRequest) Validate(formats strfmt.Registry) error { } func (m *AccountingRulesetRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *AccountingRulesetRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting ruleset request based on the context it is used +func (m *AccountingRulesetRequest) 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 *AccountingRulesetRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRulesetRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/accounting_ruleset_response.go b/api/ledger/ledger_models/accounting_ruleset_response.go index c6ed6f4..d75f5e3 100644 --- a/api/ledger/ledger_models/accounting_ruleset_response.go +++ b/api/ledger/ledger_models/accounting_ruleset_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountingRulesetResponse) Validate(formats strfmt.Registry) error { } func (m *AccountingRulesetResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountingRulesetResponse) validateData(formats strfmt.Registry) error } func (m *AccountingRulesetResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountingRulesetResponse) validateMeta(formats strfmt.Registry) error return nil } +// ContextValidate validate this accounting ruleset response based on the context it is used +func (m *AccountingRulesetResponse) 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 *AccountingRulesetResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountingRulesetResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRulesetResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/coa.go b/api/ledger/ledger_models/coa.go index 4135333..1993638 100644 --- a/api/ledger/ledger_models/coa.go +++ b/api/ledger/ledger_models/coa.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -77,7 +78,6 @@ func (m *Coa) Validate(formats strfmt.Registry) error { } func (m *Coa) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -101,6 +101,38 @@ func (m *Coa) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coa based on the context it is used +func (m *Coa) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Coa) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Coa) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/coa_item.go b/api/ledger/ledger_models/coa_item.go index b457a56..2d8da20 100644 --- a/api/ledger/ledger_models/coa_item.go +++ b/api/ledger/ledger_models/coa_item.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -64,6 +66,11 @@ func (m *CoaItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this coa item based on context it is used +func (m *CoaItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CoaItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/coa_request.go b/api/ledger/ledger_models/coa_request.go index 162add0..6dab079 100644 --- a/api/ledger/ledger_models/coa_request.go +++ b/api/ledger/ledger_models/coa_request.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *CoaRequest) Validate(formats strfmt.Registry) error { } func (m *CoaRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *CoaRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coa request based on the context it is used +func (m *CoaRequest) 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 *CoaRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CoaRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/coa_response.go b/api/ledger/ledger_models/coa_response.go index df794d9..7a4b6f2 100644 --- a/api/ledger/ledger_models/coa_response.go +++ b/api/ledger/ledger_models/coa_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CoaResponse) Validate(formats strfmt.Registry) error { } func (m *CoaResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CoaResponse) validateData(formats strfmt.Registry) error { } func (m *CoaResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CoaResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this coa response based on the context it is used +func (m *CoaResponse) 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 *CoaResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CoaResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CoaResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/delete_response.go b/api/ledger/ledger_models/delete_response.go index 3ac750a..1a47f06 100644 --- a/api/ledger/ledger_models/delete_response.go +++ b/api/ledger/ledger_models/delete_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error { } func (m *DeleteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error { } func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this delete response based on the context it is used +func (m *DeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DeleteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DeleteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/error.go b/api/ledger/ledger_models/error.go index ff23209..6761151 100644 --- a/api/ledger/ledger_models/error.go +++ b/api/ledger/ledger_models/error.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/gl_account.go b/api/ledger/ledger_models/gl_account.go index 7393170..ca04982 100644 --- a/api/ledger/ledger_models/gl_account.go +++ b/api/ledger/ledger_models/gl_account.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -104,7 +105,6 @@ func (m *GlAccount) Validate(formats strfmt.Registry) error { } func (m *GlAccount) validateBalances(formats strfmt.Registry) error { - if swag.IsZero(m.Balances) { // not required return nil } @@ -128,6 +128,38 @@ func (m *GlAccount) validateBalances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl account based on the context it is used +func (m *GlAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBalances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GlAccount) contextValidateBalances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Balances); i++ { + + if m.Balances[i] != nil { + if err := m.Balances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Balances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *GlAccount) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/gl_account_request.go b/api/ledger/ledger_models/gl_account_request.go index 9afecb1..bff2d60 100644 --- a/api/ledger/ledger_models/gl_account_request.go +++ b/api/ledger/ledger_models/gl_account_request.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *GlAccountRequest) Validate(formats strfmt.Registry) error { } func (m *GlAccountRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *GlAccountRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl account request based on the context it is used +func (m *GlAccountRequest) 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 *GlAccountRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *GlAccountRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/gl_account_response.go b/api/ledger/ledger_models/gl_account_response.go index 72ac985..23ff3dd 100644 --- a/api/ledger/ledger_models/gl_account_response.go +++ b/api/ledger/ledger_models/gl_account_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *GlAccountResponse) Validate(formats strfmt.Registry) error { } func (m *GlAccountResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *GlAccountResponse) validateData(formats strfmt.Registry) error { } func (m *GlAccountResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *GlAccountResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl account response based on the context it is used +func (m *GlAccountResponse) 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 *GlAccountResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *GlAccountResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GlAccountResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/gl_balance.go b/api/ledger/ledger_models/gl_balance.go index 9489fd3..f4833ed 100644 --- a/api/ledger/ledger_models/gl_balance.go +++ b/api/ledger/ledger_models/gl_balance.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -82,6 +84,11 @@ func (m *GlBalance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this gl balance based on context it is used +func (m *GlBalance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GlBalance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/gl_balance_request.go b/api/ledger/ledger_models/gl_balance_request.go index 84e4236..3758139 100644 --- a/api/ledger/ledger_models/gl_balance_request.go +++ b/api/ledger/ledger_models/gl_balance_request.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *GlBalanceRequest) Validate(formats strfmt.Registry) error { } func (m *GlBalanceRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *GlBalanceRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl balance request based on the context it is used +func (m *GlBalanceRequest) 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 *GlBalanceRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *GlBalanceRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/gl_balance_response.go b/api/ledger/ledger_models/gl_balance_response.go index 641a6a3..7cdb8f5 100644 --- a/api/ledger/ledger_models/gl_balance_response.go +++ b/api/ledger/ledger_models/gl_balance_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *GlBalanceResponse) Validate(formats strfmt.Registry) error { } func (m *GlBalanceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *GlBalanceResponse) validateData(formats strfmt.Registry) error { } func (m *GlBalanceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *GlBalanceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl balance response based on the context it is used +func (m *GlBalanceResponse) 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 *GlBalanceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *GlBalanceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GlBalanceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/invalid_error.go b/api/ledger/ledger_models/invalid_error.go index 8b91526..f3eb7d3 100644 --- a/api/ledger/ledger_models/invalid_error.go +++ b/api/ledger/ledger_models/invalid_error.go @@ -10,6 +10,8 @@ package ledger_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/journal_entry.go b/api/ledger/ledger_models/journal_entry.go index f09a7df..464e01e 100644 --- a/api/ledger/ledger_models/journal_entry.go +++ b/api/ledger/ledger_models/journal_entry.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -98,7 +99,6 @@ func (m *JournalEntry) Validate(formats strfmt.Registry) error { } func (m *JournalEntry) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -122,6 +122,38 @@ func (m *JournalEntry) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this journal entry based on the context it is used +func (m *JournalEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *JournalEntry) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *JournalEntry) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/journal_entry_request.go b/api/ledger/ledger_models/journal_entry_request.go index 739f273..373039e 100644 --- a/api/ledger/ledger_models/journal_entry_request.go +++ b/api/ledger/ledger_models/journal_entry_request.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *JournalEntryRequest) Validate(formats strfmt.Registry) error { } func (m *JournalEntryRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *JournalEntryRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this journal entry request based on the context it is used +func (m *JournalEntryRequest) 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 *JournalEntryRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *JournalEntryRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/journal_entry_response.go b/api/ledger/ledger_models/journal_entry_response.go index a77d5e6..24b1710 100644 --- a/api/ledger/ledger_models/journal_entry_response.go +++ b/api/ledger/ledger_models/journal_entry_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *JournalEntryResponse) Validate(formats strfmt.Registry) error { } func (m *JournalEntryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *JournalEntryResponse) validateData(formats strfmt.Registry) error { } func (m *JournalEntryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *JournalEntryResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this journal entry response based on the context it is used +func (m *JournalEntryResponse) 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 *JournalEntryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *JournalEntryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *JournalEntryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/journal_item.go b/api/ledger/ledger_models/journal_item.go index efe4da3..b5ba0cc 100644 --- a/api/ledger/ledger_models/journal_item.go +++ b/api/ledger/ledger_models/journal_item.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -88,6 +90,11 @@ func (m *JournalItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this journal item based on context it is used +func (m *JournalItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *JournalItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/journal_item_response.go b/api/ledger/ledger_models/journal_item_response.go index 76b8d3f..e5d2a71 100644 --- a/api/ledger/ledger_models/journal_item_response.go +++ b/api/ledger/ledger_models/journal_item_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *JournalItemResponse) Validate(formats strfmt.Registry) error { } func (m *JournalItemResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *JournalItemResponse) validateData(formats strfmt.Registry) error { } func (m *JournalItemResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *JournalItemResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this journal item response based on the context it is used +func (m *JournalItemResponse) 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 *JournalItemResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *JournalItemResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *JournalItemResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/journal_item_summary.go b/api/ledger/ledger_models/journal_item_summary.go index fcb8962..57029b9 100644 --- a/api/ledger/ledger_models/journal_item_summary.go +++ b/api/ledger/ledger_models/journal_item_summary.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -49,6 +51,11 @@ func (m *JournalItemSummary) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this journal item summary based on context it is used +func (m *JournalItemSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *JournalItemSummary) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/journal_item_summary_response.go b/api/ledger/ledger_models/journal_item_summary_response.go index 8cc3194..6c10753 100644 --- a/api/ledger/ledger_models/journal_item_summary_response.go +++ b/api/ledger/ledger_models/journal_item_summary_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *JournalItemSummaryResponse) Validate(formats strfmt.Registry) error { } func (m *JournalItemSummaryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *JournalItemSummaryResponse) validateData(formats strfmt.Registry) error } func (m *JournalItemSummaryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *JournalItemSummaryResponse) validateMeta(formats strfmt.Registry) error return nil } +// ContextValidate validate this journal item summary response based on the context it is used +func (m *JournalItemSummaryResponse) 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 *JournalItemSummaryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *JournalItemSummaryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *JournalItemSummaryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/message.go b/api/ledger/ledger_models/message.go index ed1047f..434c661 100644 --- a/api/ledger/ledger_models/message.go +++ b/api/ledger/ledger_models/message.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/pagination.go b/api/ledger/ledger_models/pagination.go index abe0170..8285e35 100644 --- a/api/ledger/ledger_models/pagination.go +++ b/api/ledger/ledger_models/pagination.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/period.go b/api/ledger/ledger_models/period.go index 3bed343..c9fedb7 100644 --- a/api/ledger/ledger_models/period.go +++ b/api/ledger/ledger_models/period.go @@ -10,6 +10,8 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -79,6 +81,11 @@ func (m *Period) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this period based on context it is used +func (m *Period) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Period) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/period_request.go b/api/ledger/ledger_models/period_request.go index fbfbb65..ff6775d 100644 --- a/api/ledger/ledger_models/period_request.go +++ b/api/ledger/ledger_models/period_request.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *PeriodRequest) Validate(formats strfmt.Registry) error { } func (m *PeriodRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *PeriodRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this period request based on the context it is used +func (m *PeriodRequest) 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 *PeriodRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PeriodRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/period_response.go b/api/ledger/ledger_models/period_response.go index 7b9d1c9..190616a 100644 --- a/api/ledger/ledger_models/period_response.go +++ b/api/ledger/ledger_models/period_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PeriodResponse) Validate(formats strfmt.Registry) error { } func (m *PeriodResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PeriodResponse) validateData(formats strfmt.Registry) error { } func (m *PeriodResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PeriodResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this period response based on the context it is used +func (m *PeriodResponse) 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 *PeriodResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PeriodResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PeriodResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/put_response.go b/api/ledger/ledger_models/put_response.go index 257f584..d56f631 100644 --- a/api/ledger/ledger_models/put_response.go +++ b/api/ledger/ledger_models/put_response.go @@ -10,6 +10,7 @@ package ledger_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PutResponse) Validate(formats strfmt.Registry) error { } func (m *PutResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PutResponse) validateData(formats strfmt.Registry) error { } func (m *PutResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PutResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this put response based on the context it is used +func (m *PutResponse) 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 *PutResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PutResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PutResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/request_meta.go b/api/ledger/ledger_models/request_meta.go index 5df59d8..c717697 100644 --- a/api/ledger/ledger_models/request_meta.go +++ b/api/ledger/ledger_models/request_meta.go @@ -10,6 +10,8 @@ package ledger_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ledger/ledger_models/response_meta.go b/api/ledger/ledger_models/response_meta.go index 694b749..bb59f61 100644 --- a/api/ledger/ledger_models/response_meta.go +++ b/api/ledger/ledger_models/response_meta.go @@ -10,6 +10,8 @@ package ledger_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_client/facilities/facilities_client.go b/api/metrc-gw/metrc_gw_client/facilities/facilities_client.go index 23d92b6..a8b5dfa 100644 --- a/api/metrc-gw/metrc_gw_client/facilities/facilities_client.go +++ b/api/metrc-gw/metrc_gw_client/facilities/facilities_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetFacilities(params *GetFacilitiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetFacilitiesOK, error) + GetFacilities(params *GetFacilitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFacilitiesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -42,13 +45,12 @@ type ClientService interface { Facilities for this User */ -func (a *Client) GetFacilities(params *GetFacilitiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetFacilitiesOK, error) { +func (a *Client) GetFacilities(params *GetFacilitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFacilitiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetFacilitiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getFacilities", Method: "GET", PathPattern: "/facilities", @@ -60,7 +62,12 @@ func (a *Client) GetFacilities(params *GetFacilitiesParams, authInfo runtime.Cli 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 } diff --git a/api/metrc-gw/metrc_gw_client/facilities/get_facilities_parameters.go b/api/metrc-gw/metrc_gw_client/facilities/get_facilities_parameters.go index a7a776e..8f9a835 100644 --- a/api/metrc-gw/metrc_gw_client/facilities/get_facilities_parameters.go +++ b/api/metrc-gw/metrc_gw_client/facilities/get_facilities_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetFacilitiesParams creates a new GetFacilitiesParams object -// with the default values initialized. +// NewGetFacilitiesParams creates a new GetFacilitiesParams 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 NewGetFacilitiesParams() *GetFacilitiesParams { - var () return &GetFacilitiesParams{ - timeout: cr.DefaultTimeout, } } // NewGetFacilitiesParamsWithTimeout creates a new GetFacilitiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetFacilitiesParamsWithTimeout(timeout time.Duration) *GetFacilitiesParams { - var () return &GetFacilitiesParams{ - timeout: timeout, } } // NewGetFacilitiesParamsWithContext creates a new GetFacilitiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetFacilitiesParamsWithContext(ctx context.Context) *GetFacilitiesParams { - var () return &GetFacilitiesParams{ - Context: ctx, } } // NewGetFacilitiesParamsWithHTTPClient creates a new GetFacilitiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetFacilitiesParamsWithHTTPClient(client *http.Client) *GetFacilitiesParams { - var () return &GetFacilitiesParams{ HTTPClient: client, } } -/*GetFacilitiesParams contains all the parameters to send to the API endpoint -for the get facilities operation typically these are written to a http.Request +/* GetFacilitiesParams contains all the parameters to send to the API endpoint + for the get facilities operation. + + Typically these are written to a http.Request. */ type GetFacilitiesParams struct { - /*Production - Use Production API? + /* Production. + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -91,6 +93,21 @@ type GetFacilitiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get facilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFacilitiesParams) WithDefaults() *GetFacilitiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get facilities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFacilitiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get facilities params func (o *GetFacilitiesParams) WithTimeout(timeout time.Duration) *GetFacilitiesParams { o.SetTimeout(timeout) @@ -180,22 +197,24 @@ func (o *GetFacilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -205,6 +224,7 @@ func (o *GetFacilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -214,6 +234,7 @@ func (o *GetFacilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/facilities/get_facilities_responses.go b/api/metrc-gw/metrc_gw_client/facilities/get_facilities_responses.go index f888871..6213bc2 100644 --- a/api/metrc-gw/metrc_gw_client/facilities/get_facilities_responses.go +++ b/api/metrc-gw/metrc_gw_client/facilities/get_facilities_responses.go @@ -57,9 +57,8 @@ func (o *GetFacilitiesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetFacilitiesOK() *GetFacilitiesOK { return &GetFacilitiesOK{} } -/*GetFacilitiesOK handles this case with default header values. +/* GetFacilitiesOK describes a response with status code 200, with default header values. A list of Facilities was retrieved successfully */ @@ -79,7 +78,6 @@ type GetFacilitiesOK struct { func (o *GetFacilitiesOK) Error() string { return fmt.Sprintf("[GET /facilities][%d] getFacilitiesOK %+v", 200, o.Payload) } - func (o *GetFacilitiesOK) GetPayload() *metrc_gw_models.FacilityResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetFacilitiesUnauthorized() *GetFacilitiesUnauthorized { return &GetFacilitiesUnauthorized{} } -/*GetFacilitiesUnauthorized handles this case with default header values. +/* GetFacilitiesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetFacilitiesUnauthorized struct { func (o *GetFacilitiesUnauthorized) Error() string { return fmt.Sprintf("[GET /facilities][%d] getFacilitiesUnauthorized %+v", 401, o.Payload) } - func (o *GetFacilitiesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetFacilitiesForbidden() *GetFacilitiesForbidden { return &GetFacilitiesForbidden{} } -/*GetFacilitiesForbidden handles this case with default header values. +/* GetFacilitiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetFacilitiesForbidden struct { func (o *GetFacilitiesForbidden) Error() string { return fmt.Sprintf("[GET /facilities][%d] getFacilitiesForbidden %+v", 403, o.Payload) } - func (o *GetFacilitiesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetFacilitiesNotFound() *GetFacilitiesNotFound { return &GetFacilitiesNotFound{} } -/*GetFacilitiesNotFound handles this case with default header values. +/* GetFacilitiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetFacilitiesNotFound struct { func (o *GetFacilitiesNotFound) Error() string { return fmt.Sprintf("[GET /facilities][%d] getFacilitiesNotFound %+v", 404, o.Payload) } - func (o *GetFacilitiesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetFacilitiesInternalServerError() *GetFacilitiesInternalServerError { return &GetFacilitiesInternalServerError{} } -/*GetFacilitiesInternalServerError handles this case with default header values. +/* GetFacilitiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetFacilitiesInternalServerError struct { func (o *GetFacilitiesInternalServerError) Error() string { return fmt.Sprintf("[GET /facilities][%d] getFacilitiesInternalServerError %+v", 500, o.Payload) } - func (o *GetFacilitiesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_parameters.go b/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_parameters.go index 0d3aa79..1a6ebcc 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_parameters.go +++ b/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetHarvestWasteTypesParams creates a new GetHarvestWasteTypesParams object -// with the default values initialized. +// NewGetHarvestWasteTypesParams creates a new GetHarvestWasteTypesParams 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 NewGetHarvestWasteTypesParams() *GetHarvestWasteTypesParams { - var () return &GetHarvestWasteTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetHarvestWasteTypesParamsWithTimeout creates a new GetHarvestWasteTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetHarvestWasteTypesParamsWithTimeout(timeout time.Duration) *GetHarvestWasteTypesParams { - var () return &GetHarvestWasteTypesParams{ - timeout: timeout, } } // NewGetHarvestWasteTypesParamsWithContext creates a new GetHarvestWasteTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetHarvestWasteTypesParamsWithContext(ctx context.Context) *GetHarvestWasteTypesParams { - var () return &GetHarvestWasteTypesParams{ - Context: ctx, } } // NewGetHarvestWasteTypesParamsWithHTTPClient creates a new GetHarvestWasteTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetHarvestWasteTypesParamsWithHTTPClient(client *http.Client) *GetHarvestWasteTypesParams { - var () return &GetHarvestWasteTypesParams{ HTTPClient: client, } } -/*GetHarvestWasteTypesParams contains all the parameters to send to the API endpoint -for the get harvest waste types operation typically these are written to a http.Request +/* GetHarvestWasteTypesParams contains all the parameters to send to the API endpoint + for the get harvest waste types operation. + + Typically these are written to a http.Request. */ type GetHarvestWasteTypesParams struct { - /*Reseller - The METRC Reseller Key + /* Reseller. + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -85,6 +86,21 @@ type GetHarvestWasteTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get harvest waste types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetHarvestWasteTypesParams) WithDefaults() *GetHarvestWasteTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get harvest waste types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetHarvestWasteTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get harvest waste types params func (o *GetHarvestWasteTypesParams) WithTimeout(timeout time.Duration) *GetHarvestWasteTypesParams { o.SetTimeout(timeout) @@ -163,6 +179,7 @@ func (o *GetHarvestWasteTypesParams) WriteToRequest(r runtime.ClientRequest, reg qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -172,6 +189,7 @@ func (o *GetHarvestWasteTypesParams) WriteToRequest(r runtime.ClientRequest, reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -181,6 +199,7 @@ func (o *GetHarvestWasteTypesParams) WriteToRequest(r runtime.ClientRequest, reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_responses.go b/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_responses.go index 3ea0b68..44f7ed5 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_responses.go +++ b/api/metrc-gw/metrc_gw_client/harvests/get_harvest_waste_types_responses.go @@ -57,9 +57,8 @@ func (o *GetHarvestWasteTypesReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetHarvestWasteTypesOK() *GetHarvestWasteTypesOK { return &GetHarvestWasteTypesOK{} } -/*GetHarvestWasteTypesOK handles this case with default header values. +/* GetHarvestWasteTypesOK describes a response with status code 200, with default header values. A list of Harvest Waste Types was succefully retrieved */ @@ -79,7 +78,6 @@ type GetHarvestWasteTypesOK struct { func (o *GetHarvestWasteTypesOK) Error() string { return fmt.Sprintf("[GET /harvests/wastetypes][%d] getHarvestWasteTypesOK %+v", 200, o.Payload) } - func (o *GetHarvestWasteTypesOK) GetPayload() *metrc_gw_models.HarvestWasteTypeResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetHarvestWasteTypesUnauthorized() *GetHarvestWasteTypesUnauthorized { return &GetHarvestWasteTypesUnauthorized{} } -/*GetHarvestWasteTypesUnauthorized handles this case with default header values. +/* GetHarvestWasteTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetHarvestWasteTypesUnauthorized struct { func (o *GetHarvestWasteTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /harvests/wastetypes][%d] getHarvestWasteTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetHarvestWasteTypesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetHarvestWasteTypesForbidden() *GetHarvestWasteTypesForbidden { return &GetHarvestWasteTypesForbidden{} } -/*GetHarvestWasteTypesForbidden handles this case with default header values. +/* GetHarvestWasteTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetHarvestWasteTypesForbidden struct { func (o *GetHarvestWasteTypesForbidden) Error() string { return fmt.Sprintf("[GET /harvests/wastetypes][%d] getHarvestWasteTypesForbidden %+v", 403, o.Payload) } - func (o *GetHarvestWasteTypesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetHarvestWasteTypesNotFound() *GetHarvestWasteTypesNotFound { return &GetHarvestWasteTypesNotFound{} } -/*GetHarvestWasteTypesNotFound handles this case with default header values. +/* GetHarvestWasteTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetHarvestWasteTypesNotFound struct { func (o *GetHarvestWasteTypesNotFound) Error() string { return fmt.Sprintf("[GET /harvests/wastetypes][%d] getHarvestWasteTypesNotFound %+v", 404, o.Payload) } - func (o *GetHarvestWasteTypesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetHarvestWasteTypesInternalServerError() *GetHarvestWasteTypesInternalS return &GetHarvestWasteTypesInternalServerError{} } -/*GetHarvestWasteTypesInternalServerError handles this case with default header values. +/* GetHarvestWasteTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetHarvestWasteTypesInternalServerError struct { func (o *GetHarvestWasteTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /harvests/wastetypes][%d] getHarvestWasteTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetHarvestWasteTypesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/harvests/get_harvests_parameters.go b/api/metrc-gw/metrc_gw_client/harvests/get_harvests_parameters.go index 44b3f2b..8b8e87f 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/get_harvests_parameters.go +++ b/api/metrc-gw/metrc_gw_client/harvests/get_harvests_parameters.go @@ -21,88 +21,94 @@ import ( "github.com/go-openapi/swag" ) -// NewGetHarvestsParams creates a new GetHarvestsParams object -// with the default values initialized. +// NewGetHarvestsParams creates a new GetHarvestsParams 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 NewGetHarvestsParams() *GetHarvestsParams { - var () return &GetHarvestsParams{ - timeout: cr.DefaultTimeout, } } // NewGetHarvestsParamsWithTimeout creates a new GetHarvestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetHarvestsParamsWithTimeout(timeout time.Duration) *GetHarvestsParams { - var () return &GetHarvestsParams{ - timeout: timeout, } } // NewGetHarvestsParamsWithContext creates a new GetHarvestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetHarvestsParamsWithContext(ctx context.Context) *GetHarvestsParams { - var () return &GetHarvestsParams{ - Context: ctx, } } // NewGetHarvestsParamsWithHTTPClient creates a new GetHarvestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetHarvestsParamsWithHTTPClient(client *http.Client) *GetHarvestsParams { - var () return &GetHarvestsParams{ HTTPClient: client, } } -/*GetHarvestsParams contains all the parameters to send to the API endpoint -for the get harvests operation typically these are written to a http.Request +/* GetHarvestsParams contains all the parameters to send to the API endpoint + for the get harvests operation. + + Typically these are written to a http.Request. */ type GetHarvestsParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Onhold - Get On Hold objects? + /* Onhold. + + Get On Hold objects? */ Onhold *bool - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -111,6 +117,21 @@ type GetHarvestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get harvests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetHarvestsParams) WithDefaults() *GetHarvestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get harvests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetHarvestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get harvests params func (o *GetHarvestsParams) WithTimeout(timeout time.Duration) *GetHarvestsParams { o.SetTimeout(timeout) @@ -244,38 +265,41 @@ func (o *GetHarvestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -285,38 +309,41 @@ func (o *GetHarvestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param onhold var qrOnhold bool + if o.Onhold != nil { qrOnhold = *o.Onhold } qOnhold := swag.FormatBool(qrOnhold) if qOnhold != "" { + if err := r.SetQueryParam("onhold", qOnhold); err != nil { return err } } - } if o.Production != nil { // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -326,6 +353,7 @@ func (o *GetHarvestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -335,6 +363,7 @@ func (o *GetHarvestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/harvests/get_harvests_responses.go b/api/metrc-gw/metrc_gw_client/harvests/get_harvests_responses.go index 59ec8ca..463dd4e 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/get_harvests_responses.go +++ b/api/metrc-gw/metrc_gw_client/harvests/get_harvests_responses.go @@ -57,9 +57,8 @@ func (o *GetHarvestsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetHarvestsOK() *GetHarvestsOK { return &GetHarvestsOK{} } -/*GetHarvestsOK handles this case with default header values. +/* GetHarvestsOK describes a response with status code 200, with default header values. A Harvest was successfully retrieved */ @@ -79,7 +78,6 @@ type GetHarvestsOK struct { func (o *GetHarvestsOK) Error() string { return fmt.Sprintf("[GET /harvests][%d] getHarvestsOK %+v", 200, o.Payload) } - func (o *GetHarvestsOK) GetPayload() *metrc_gw_models.HarvestResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetHarvestsUnauthorized() *GetHarvestsUnauthorized { return &GetHarvestsUnauthorized{} } -/*GetHarvestsUnauthorized handles this case with default header values. +/* GetHarvestsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetHarvestsUnauthorized struct { func (o *GetHarvestsUnauthorized) Error() string { return fmt.Sprintf("[GET /harvests][%d] getHarvestsUnauthorized %+v", 401, o.Payload) } - func (o *GetHarvestsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetHarvestsForbidden() *GetHarvestsForbidden { return &GetHarvestsForbidden{} } -/*GetHarvestsForbidden handles this case with default header values. +/* GetHarvestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetHarvestsForbidden struct { func (o *GetHarvestsForbidden) Error() string { return fmt.Sprintf("[GET /harvests][%d] getHarvestsForbidden %+v", 403, o.Payload) } - func (o *GetHarvestsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetHarvestsNotFound() *GetHarvestsNotFound { return &GetHarvestsNotFound{} } -/*GetHarvestsNotFound handles this case with default header values. +/* GetHarvestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetHarvestsNotFound struct { func (o *GetHarvestsNotFound) Error() string { return fmt.Sprintf("[GET /harvests][%d] getHarvestsNotFound %+v", 404, o.Payload) } - func (o *GetHarvestsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetHarvestsInternalServerError() *GetHarvestsInternalServerError { return &GetHarvestsInternalServerError{} } -/*GetHarvestsInternalServerError handles this case with default header values. +/* GetHarvestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetHarvestsInternalServerError struct { func (o *GetHarvestsInternalServerError) Error() string { return fmt.Sprintf("[GET /harvests][%d] getHarvestsInternalServerError %+v", 500, o.Payload) } - func (o *GetHarvestsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/harvests/harvests_client.go b/api/metrc-gw/metrc_gw_client/harvests/harvests_client.go index 6e32cca..3681358 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/harvests_client.go +++ b/api/metrc-gw/metrc_gw_client/harvests/harvests_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - GetHarvestWasteTypes(params *GetHarvestWasteTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetHarvestWasteTypesOK, error) + GetHarvestWasteTypes(params *GetHarvestWasteTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetHarvestWasteTypesOK, error) - GetHarvests(params *GetHarvestsParams, authInfo runtime.ClientAuthInfoWriter) (*GetHarvestsOK, error) + GetHarvests(params *GetHarvestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetHarvestsOK, error) - PostHarvestPackages(params *PostHarvestPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*PostHarvestPackagesOK, error) + PostHarvestPackages(params *PostHarvestPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostHarvestPackagesOK, error) - PutHarvests(params *PutHarvestsParams, authInfo runtime.ClientAuthInfoWriter) (*PutHarvestsOK, error) + PutHarvests(params *PutHarvestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutHarvestsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -48,13 +51,12 @@ type ClientService interface { Harvest Waste Types for this User */ -func (a *Client) GetHarvestWasteTypes(params *GetHarvestWasteTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetHarvestWasteTypesOK, error) { +func (a *Client) GetHarvestWasteTypes(params *GetHarvestWasteTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetHarvestWasteTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetHarvestWasteTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getHarvestWasteTypes", Method: "GET", PathPattern: "/harvests/wastetypes", @@ -66,7 +68,12 @@ func (a *Client) GetHarvestWasteTypes(params *GetHarvestWasteTypesParams, authIn 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 } @@ -86,13 +93,12 @@ func (a *Client) GetHarvestWasteTypes(params *GetHarvestWasteTypesParams, authIn Get a Harvest for this User-License */ -func (a *Client) GetHarvests(params *GetHarvestsParams, authInfo runtime.ClientAuthInfoWriter) (*GetHarvestsOK, error) { +func (a *Client) GetHarvests(params *GetHarvestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetHarvestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetHarvestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getHarvests", Method: "GET", PathPattern: "/harvests", @@ -104,7 +110,12 @@ func (a *Client) GetHarvests(params *GetHarvestsParams, authInfo runtime.ClientA 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 } @@ -123,13 +134,12 @@ func (a *Client) GetHarvests(params *GetHarvestsParams, authInfo runtime.ClientA Create new Plants */ -func (a *Client) PostHarvestPackages(params *PostHarvestPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*PostHarvestPackagesOK, error) { +func (a *Client) PostHarvestPackages(params *PostHarvestPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostHarvestPackagesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostHarvestPackagesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postHarvestPackages", Method: "POST", PathPattern: "/harvestpackages", @@ -141,7 +151,12 @@ func (a *Client) PostHarvestPackages(params *PostHarvestPackagesParams, authInfo 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 } @@ -158,13 +173,12 @@ func (a *Client) PostHarvestPackages(params *PostHarvestPackagesParams, authInfo /* PutHarvests Update Harvest Records */ -func (a *Client) PutHarvests(params *PutHarvestsParams, authInfo runtime.ClientAuthInfoWriter) (*PutHarvestsOK, error) { +func (a *Client) PutHarvests(params *PutHarvestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutHarvestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutHarvestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putHarvests", Method: "PUT", PathPattern: "/harvests", @@ -176,7 +190,12 @@ func (a *Client) PutHarvests(params *PutHarvestsParams, authInfo runtime.ClientA 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 } diff --git a/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_parameters.go b/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_parameters.go index 00e2d97..baea344 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_parameters.go +++ b/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostHarvestPackagesParams creates a new PostHarvestPackagesParams object -// with the default values initialized. +// NewPostHarvestPackagesParams creates a new PostHarvestPackagesParams 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 NewPostHarvestPackagesParams() *PostHarvestPackagesParams { - var () return &PostHarvestPackagesParams{ - timeout: cr.DefaultTimeout, } } // NewPostHarvestPackagesParamsWithTimeout creates a new PostHarvestPackagesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostHarvestPackagesParamsWithTimeout(timeout time.Duration) *PostHarvestPackagesParams { - var () return &PostHarvestPackagesParams{ - timeout: timeout, } } // NewPostHarvestPackagesParamsWithContext creates a new PostHarvestPackagesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostHarvestPackagesParamsWithContext(ctx context.Context) *PostHarvestPackagesParams { - var () return &PostHarvestPackagesParams{ - Context: ctx, } } // NewPostHarvestPackagesParamsWithHTTPClient creates a new PostHarvestPackagesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostHarvestPackagesParamsWithHTTPClient(client *http.Client) *PostHarvestPackagesParams { - var () return &PostHarvestPackagesParams{ HTTPClient: client, } } -/*PostHarvestPackagesParams contains all the parameters to send to the API endpoint -for the post harvest packages operation typically these are written to a http.Request +/* PostHarvestPackagesParams contains all the parameters to send to the API endpoint + for the post harvest packages operation. + + Typically these are written to a http.Request. */ type PostHarvestPackagesParams struct { - /*HarvestPackageRequest - The New HarvestPackages + /* HarvestPackageRequest. + The New HarvestPackages */ HarvestPackageRequest *metrc_gw_models.HarvestPackageRequest @@ -77,6 +76,21 @@ type PostHarvestPackagesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post harvest packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostHarvestPackagesParams) WithDefaults() *PostHarvestPackagesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post harvest packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostHarvestPackagesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post harvest packages params func (o *PostHarvestPackagesParams) WithTimeout(timeout time.Duration) *PostHarvestPackagesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostHarvestPackagesParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.HarvestPackageRequest != nil { if err := r.SetBodyParam(o.HarvestPackageRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_responses.go b/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_responses.go index 1832702..68117d3 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_responses.go +++ b/api/metrc-gw/metrc_gw_client/harvests/post_harvest_packages_responses.go @@ -57,9 +57,8 @@ func (o *PostHarvestPackagesReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostHarvestPackagesOK() *PostHarvestPackagesOK { return &PostHarvestPackagesOK{} } -/*PostHarvestPackagesOK handles this case with default header values. +/* PostHarvestPackagesOK describes a response with status code 200, with default header values. An array of HarvestPackage records with the new IDs */ @@ -79,7 +78,6 @@ type PostHarvestPackagesOK struct { func (o *PostHarvestPackagesOK) Error() string { return fmt.Sprintf("[POST /harvestpackages][%d] postHarvestPackagesOK %+v", 200, o.Payload) } - func (o *PostHarvestPackagesOK) GetPayload() *metrc_gw_models.PlantResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostHarvestPackagesUnauthorized() *PostHarvestPackagesUnauthorized { return &PostHarvestPackagesUnauthorized{} } -/*PostHarvestPackagesUnauthorized handles this case with default header values. +/* PostHarvestPackagesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostHarvestPackagesUnauthorized struct { func (o *PostHarvestPackagesUnauthorized) Error() string { return fmt.Sprintf("[POST /harvestpackages][%d] postHarvestPackagesUnauthorized %+v", 401, o.Payload) } - func (o *PostHarvestPackagesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostHarvestPackagesForbidden() *PostHarvestPackagesForbidden { return &PostHarvestPackagesForbidden{} } -/*PostHarvestPackagesForbidden handles this case with default header values. +/* PostHarvestPackagesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostHarvestPackagesForbidden struct { func (o *PostHarvestPackagesForbidden) Error() string { return fmt.Sprintf("[POST /harvestpackages][%d] postHarvestPackagesForbidden %+v", 403, o.Payload) } - func (o *PostHarvestPackagesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostHarvestPackagesNotFound() *PostHarvestPackagesNotFound { return &PostHarvestPackagesNotFound{} } -/*PostHarvestPackagesNotFound handles this case with default header values. +/* PostHarvestPackagesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostHarvestPackagesNotFound struct { func (o *PostHarvestPackagesNotFound) Error() string { return fmt.Sprintf("[POST /harvestpackages][%d] postHarvestPackagesNotFound %+v", 404, o.Payload) } - func (o *PostHarvestPackagesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostHarvestPackagesInternalServerError() *PostHarvestPackagesInternalSer return &PostHarvestPackagesInternalServerError{} } -/*PostHarvestPackagesInternalServerError handles this case with default header values. +/* PostHarvestPackagesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostHarvestPackagesInternalServerError struct { func (o *PostHarvestPackagesInternalServerError) Error() string { return fmt.Sprintf("[POST /harvestpackages][%d] postHarvestPackagesInternalServerError %+v", 500, o.Payload) } - func (o *PostHarvestPackagesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/harvests/put_harvests_parameters.go b/api/metrc-gw/metrc_gw_client/harvests/put_harvests_parameters.go index 77a0fb1..4ca4c86 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/put_harvests_parameters.go +++ b/api/metrc-gw/metrc_gw_client/harvests/put_harvests_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutHarvestsParams creates a new PutHarvestsParams object -// with the default values initialized. +// NewPutHarvestsParams creates a new PutHarvestsParams 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 NewPutHarvestsParams() *PutHarvestsParams { - var () return &PutHarvestsParams{ - timeout: cr.DefaultTimeout, } } // NewPutHarvestsParamsWithTimeout creates a new PutHarvestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutHarvestsParamsWithTimeout(timeout time.Duration) *PutHarvestsParams { - var () return &PutHarvestsParams{ - timeout: timeout, } } // NewPutHarvestsParamsWithContext creates a new PutHarvestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutHarvestsParamsWithContext(ctx context.Context) *PutHarvestsParams { - var () return &PutHarvestsParams{ - Context: ctx, } } // NewPutHarvestsParamsWithHTTPClient creates a new PutHarvestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutHarvestsParamsWithHTTPClient(client *http.Client) *PutHarvestsParams { - var () return &PutHarvestsParams{ HTTPClient: client, } } -/*PutHarvestsParams contains all the parameters to send to the API endpoint -for the put harvests operation typically these are written to a http.Request +/* PutHarvestsParams contains all the parameters to send to the API endpoint + for the put harvests operation. + + Typically these are written to a http.Request. */ type PutHarvestsParams struct { - /*HarvestUpdateRequest - The Harvest Update records + /* HarvestUpdateRequest. + The Harvest Update records */ HarvestUpdateRequest *metrc_gw_models.HarvestUpdateRequest @@ -77,6 +76,21 @@ type PutHarvestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put harvests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutHarvestsParams) WithDefaults() *PutHarvestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put harvests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutHarvestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put harvests params func (o *PutHarvestsParams) WithTimeout(timeout time.Duration) *PutHarvestsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutHarvestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.HarvestUpdateRequest != nil { if err := r.SetBodyParam(o.HarvestUpdateRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/harvests/put_harvests_responses.go b/api/metrc-gw/metrc_gw_client/harvests/put_harvests_responses.go index eb0391e..7a31efe 100644 --- a/api/metrc-gw/metrc_gw_client/harvests/put_harvests_responses.go +++ b/api/metrc-gw/metrc_gw_client/harvests/put_harvests_responses.go @@ -57,9 +57,8 @@ func (o *PutHarvestsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutHarvestsOK() *PutHarvestsOK { return &PutHarvestsOK{} } -/*PutHarvestsOK handles this case with default header values. +/* PutHarvestsOK describes a response with status code 200, with default header values. An array of Harvest Update records */ @@ -79,7 +78,6 @@ type PutHarvestsOK struct { func (o *PutHarvestsOK) Error() string { return fmt.Sprintf("[PUT /harvests][%d] putHarvestsOK %+v", 200, o.Payload) } - func (o *PutHarvestsOK) GetPayload() *metrc_gw_models.HarvestUpdateResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutHarvestsUnauthorized() *PutHarvestsUnauthorized { return &PutHarvestsUnauthorized{} } -/*PutHarvestsUnauthorized handles this case with default header values. +/* PutHarvestsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutHarvestsUnauthorized struct { func (o *PutHarvestsUnauthorized) Error() string { return fmt.Sprintf("[PUT /harvests][%d] putHarvestsUnauthorized %+v", 401, o.Payload) } - func (o *PutHarvestsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutHarvestsForbidden() *PutHarvestsForbidden { return &PutHarvestsForbidden{} } -/*PutHarvestsForbidden handles this case with default header values. +/* PutHarvestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutHarvestsForbidden struct { func (o *PutHarvestsForbidden) Error() string { return fmt.Sprintf("[PUT /harvests][%d] putHarvestsForbidden %+v", 403, o.Payload) } - func (o *PutHarvestsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutHarvestsNotFound() *PutHarvestsNotFound { return &PutHarvestsNotFound{} } -/*PutHarvestsNotFound handles this case with default header values. +/* PutHarvestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutHarvestsNotFound struct { func (o *PutHarvestsNotFound) Error() string { return fmt.Sprintf("[PUT /harvests][%d] putHarvestsNotFound %+v", 404, o.Payload) } - func (o *PutHarvestsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutHarvestsInternalServerError() *PutHarvestsInternalServerError { return &PutHarvestsInternalServerError{} } -/*PutHarvestsInternalServerError handles this case with default header values. +/* PutHarvestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutHarvestsInternalServerError struct { func (o *PutHarvestsInternalServerError) Error() string { return fmt.Sprintf("[PUT /harvests][%d] putHarvestsInternalServerError %+v", 500, o.Payload) } - func (o *PutHarvestsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/items/delete_item_parameters.go b/api/metrc-gw/metrc_gw_client/items/delete_item_parameters.go index e519a3e..80647fe 100644 --- a/api/metrc-gw/metrc_gw_client/items/delete_item_parameters.go +++ b/api/metrc-gw/metrc_gw_client/items/delete_item_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewDeleteItemParams creates a new DeleteItemParams object -// with the default values initialized. +// NewDeleteItemParams creates a new DeleteItemParams 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 NewDeleteItemParams() *DeleteItemParams { - var () return &DeleteItemParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteItemParamsWithTimeout creates a new DeleteItemParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteItemParamsWithTimeout(timeout time.Duration) *DeleteItemParams { - var () return &DeleteItemParams{ - timeout: timeout, } } // NewDeleteItemParamsWithContext creates a new DeleteItemParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteItemParamsWithContext(ctx context.Context) *DeleteItemParams { - var () return &DeleteItemParams{ - Context: ctx, } } // NewDeleteItemParamsWithHTTPClient creates a new DeleteItemParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteItemParamsWithHTTPClient(client *http.Client) *DeleteItemParams { - var () return &DeleteItemParams{ HTTPClient: client, } } -/*DeleteItemParams contains all the parameters to send to the API endpoint -for the delete item operation typically these are written to a http.Request +/* DeleteItemParams contains all the parameters to send to the API endpoint + for the delete item operation. + + Typically these are written to a http.Request. */ type DeleteItemParams struct { - /*ItemID - The Item Number + /* ItemID. + The Item Number */ ItemID float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type DeleteItemParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete item params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteItemParams) WithDefaults() *DeleteItemParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete item params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteItemParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete item params func (o *DeleteItemParams) WithTimeout(timeout time.Duration) *DeleteItemParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *DeleteItemParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrItemID := o.ItemID qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } @@ -205,6 +224,7 @@ func (o *DeleteItemParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -214,6 +234,7 @@ func (o *DeleteItemParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -223,6 +244,7 @@ func (o *DeleteItemParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -232,6 +254,7 @@ func (o *DeleteItemParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/items/delete_item_responses.go b/api/metrc-gw/metrc_gw_client/items/delete_item_responses.go index 3aacebe..bb265ce 100644 --- a/api/metrc-gw/metrc_gw_client/items/delete_item_responses.go +++ b/api/metrc-gw/metrc_gw_client/items/delete_item_responses.go @@ -57,9 +57,8 @@ func (o *DeleteItemReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeleteItemOK() *DeleteItemOK { return &DeleteItemOK{} } -/*DeleteItemOK handles this case with default header values. +/* DeleteItemOK describes a response with status code 200, with default header values. Item were successfully Deleted */ @@ -79,7 +78,6 @@ type DeleteItemOK struct { func (o *DeleteItemOK) Error() string { return fmt.Sprintf("[DELETE /items][%d] deleteItemOK %+v", 200, o.Payload) } - func (o *DeleteItemOK) GetPayload() *metrc_gw_models.ItemResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewDeleteItemUnauthorized() *DeleteItemUnauthorized { return &DeleteItemUnauthorized{} } -/*DeleteItemUnauthorized handles this case with default header values. +/* DeleteItemUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type DeleteItemUnauthorized struct { func (o *DeleteItemUnauthorized) Error() string { return fmt.Sprintf("[DELETE /items][%d] deleteItemUnauthorized %+v", 401, o.Payload) } - func (o *DeleteItemUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewDeleteItemForbidden() *DeleteItemForbidden { return &DeleteItemForbidden{} } -/*DeleteItemForbidden handles this case with default header values. +/* DeleteItemForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type DeleteItemForbidden struct { func (o *DeleteItemForbidden) Error() string { return fmt.Sprintf("[DELETE /items][%d] deleteItemForbidden %+v", 403, o.Payload) } - func (o *DeleteItemForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewDeleteItemNotFound() *DeleteItemNotFound { return &DeleteItemNotFound{} } -/*DeleteItemNotFound handles this case with default header values. +/* DeleteItemNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type DeleteItemNotFound struct { func (o *DeleteItemNotFound) Error() string { return fmt.Sprintf("[DELETE /items][%d] deleteItemNotFound %+v", 404, o.Payload) } - func (o *DeleteItemNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewDeleteItemInternalServerError() *DeleteItemInternalServerError { return &DeleteItemInternalServerError{} } -/*DeleteItemInternalServerError handles this case with default header values. +/* DeleteItemInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type DeleteItemInternalServerError struct { func (o *DeleteItemInternalServerError) Error() string { return fmt.Sprintf("[DELETE /items][%d] deleteItemInternalServerError %+v", 500, o.Payload) } - func (o *DeleteItemInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/items/get_brands_parameters.go b/api/metrc-gw/metrc_gw_client/items/get_brands_parameters.go index 199f830..39a933d 100644 --- a/api/metrc-gw/metrc_gw_client/items/get_brands_parameters.go +++ b/api/metrc-gw/metrc_gw_client/items/get_brands_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetBrandsParams creates a new GetBrandsParams object -// with the default values initialized. +// NewGetBrandsParams creates a new GetBrandsParams 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 NewGetBrandsParams() *GetBrandsParams { - var () return &GetBrandsParams{ - timeout: cr.DefaultTimeout, } } // NewGetBrandsParamsWithTimeout creates a new GetBrandsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetBrandsParamsWithTimeout(timeout time.Duration) *GetBrandsParams { - var () return &GetBrandsParams{ - timeout: timeout, } } // NewGetBrandsParamsWithContext creates a new GetBrandsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetBrandsParamsWithContext(ctx context.Context) *GetBrandsParams { - var () return &GetBrandsParams{ - Context: ctx, } } // NewGetBrandsParamsWithHTTPClient creates a new GetBrandsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetBrandsParamsWithHTTPClient(client *http.Client) *GetBrandsParams { - var () return &GetBrandsParams{ HTTPClient: client, } } -/*GetBrandsParams contains all the parameters to send to the API endpoint -for the get brands operation typically these are written to a http.Request +/* GetBrandsParams contains all the parameters to send to the API endpoint + for the get brands operation. + + Typically these are written to a http.Request. */ type GetBrandsParams struct { - /*Reseller - The METRC Reseller Key + /* Reseller. + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -85,6 +86,21 @@ type GetBrandsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get brands params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBrandsParams) WithDefaults() *GetBrandsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get brands params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBrandsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get brands params func (o *GetBrandsParams) WithTimeout(timeout time.Duration) *GetBrandsParams { o.SetTimeout(timeout) @@ -163,6 +179,7 @@ func (o *GetBrandsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -172,6 +189,7 @@ func (o *GetBrandsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -181,6 +199,7 @@ func (o *GetBrandsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/items/get_brands_responses.go b/api/metrc-gw/metrc_gw_client/items/get_brands_responses.go index f6f2491..217fd81 100644 --- a/api/metrc-gw/metrc_gw_client/items/get_brands_responses.go +++ b/api/metrc-gw/metrc_gw_client/items/get_brands_responses.go @@ -51,9 +51,8 @@ func (o *GetBrandsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -62,7 +61,7 @@ func NewGetBrandsUnauthorized() *GetBrandsUnauthorized { return &GetBrandsUnauthorized{} } -/*GetBrandsUnauthorized handles this case with default header values. +/* GetBrandsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -73,7 +72,6 @@ type GetBrandsUnauthorized struct { func (o *GetBrandsUnauthorized) Error() string { return fmt.Sprintf("[GET /items/brands][%d] getBrandsUnauthorized %+v", 401, o.Payload) } - func (o *GetBrandsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -95,7 +93,7 @@ func NewGetBrandsForbidden() *GetBrandsForbidden { return &GetBrandsForbidden{} } -/*GetBrandsForbidden handles this case with default header values. +/* GetBrandsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -106,7 +104,6 @@ type GetBrandsForbidden struct { func (o *GetBrandsForbidden) Error() string { return fmt.Sprintf("[GET /items/brands][%d] getBrandsForbidden %+v", 403, o.Payload) } - func (o *GetBrandsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -128,7 +125,7 @@ func NewGetBrandsNotFound() *GetBrandsNotFound { return &GetBrandsNotFound{} } -/*GetBrandsNotFound handles this case with default header values. +/* GetBrandsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -139,7 +136,6 @@ type GetBrandsNotFound struct { func (o *GetBrandsNotFound) Error() string { return fmt.Sprintf("[GET /items/brands][%d] getBrandsNotFound %+v", 404, o.Payload) } - func (o *GetBrandsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -161,7 +157,7 @@ func NewGetBrandsInternalServerError() *GetBrandsInternalServerError { return &GetBrandsInternalServerError{} } -/*GetBrandsInternalServerError handles this case with default header values. +/* GetBrandsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -172,7 +168,6 @@ type GetBrandsInternalServerError struct { func (o *GetBrandsInternalServerError) Error() string { return fmt.Sprintf("[GET /items/brands][%d] getBrandsInternalServerError %+v", 500, o.Payload) } - func (o *GetBrandsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_parameters.go b/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_parameters.go index 6c20380..1298978 100644 --- a/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_parameters.go +++ b/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetItemProductCategoriesParams creates a new GetItemProductCategoriesParams object -// with the default values initialized. +// NewGetItemProductCategoriesParams creates a new GetItemProductCategoriesParams 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 NewGetItemProductCategoriesParams() *GetItemProductCategoriesParams { - var () return &GetItemProductCategoriesParams{ - timeout: cr.DefaultTimeout, } } // NewGetItemProductCategoriesParamsWithTimeout creates a new GetItemProductCategoriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetItemProductCategoriesParamsWithTimeout(timeout time.Duration) *GetItemProductCategoriesParams { - var () return &GetItemProductCategoriesParams{ - timeout: timeout, } } // NewGetItemProductCategoriesParamsWithContext creates a new GetItemProductCategoriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetItemProductCategoriesParamsWithContext(ctx context.Context) *GetItemProductCategoriesParams { - var () return &GetItemProductCategoriesParams{ - Context: ctx, } } // NewGetItemProductCategoriesParamsWithHTTPClient creates a new GetItemProductCategoriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetItemProductCategoriesParamsWithHTTPClient(client *http.Client) *GetItemProductCategoriesParams { - var () return &GetItemProductCategoriesParams{ HTTPClient: client, } } -/*GetItemProductCategoriesParams contains all the parameters to send to the API endpoint -for the get item product categories operation typically these are written to a http.Request +/* GetItemProductCategoriesParams contains all the parameters to send to the API endpoint + for the get item product categories operation. + + Typically these are written to a http.Request. */ type GetItemProductCategoriesParams struct { - /*Reseller - The METRC Reseller Key + /* Reseller. + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -85,6 +86,21 @@ type GetItemProductCategoriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get item product categories params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetItemProductCategoriesParams) WithDefaults() *GetItemProductCategoriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get item product categories params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetItemProductCategoriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get item product categories params func (o *GetItemProductCategoriesParams) WithTimeout(timeout time.Duration) *GetItemProductCategoriesParams { o.SetTimeout(timeout) @@ -163,6 +179,7 @@ func (o *GetItemProductCategoriesParams) WriteToRequest(r runtime.ClientRequest, qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -172,6 +189,7 @@ func (o *GetItemProductCategoriesParams) WriteToRequest(r runtime.ClientRequest, qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -181,6 +199,7 @@ func (o *GetItemProductCategoriesParams) WriteToRequest(r runtime.ClientRequest, qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_responses.go b/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_responses.go index 0bfab86..5dbdbc9 100644 --- a/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_responses.go +++ b/api/metrc-gw/metrc_gw_client/items/get_item_product_categories_responses.go @@ -57,9 +57,8 @@ func (o *GetItemProductCategoriesReader) ReadResponse(response runtime.ClientRes return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetItemProductCategoriesOK() *GetItemProductCategoriesOK { return &GetItemProductCategoriesOK{} } -/*GetItemProductCategoriesOK handles this case with default header values. +/* GetItemProductCategoriesOK describes a response with status code 200, with default header values. A list of Item Product Categories was succefully retrieved */ @@ -79,7 +78,6 @@ type GetItemProductCategoriesOK struct { func (o *GetItemProductCategoriesOK) Error() string { return fmt.Sprintf("[GET /items/productcategories][%d] getItemProductCategoriesOK %+v", 200, o.Payload) } - func (o *GetItemProductCategoriesOK) GetPayload() *metrc_gw_models.ProductCategoryResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetItemProductCategoriesUnauthorized() *GetItemProductCategoriesUnauthor return &GetItemProductCategoriesUnauthorized{} } -/*GetItemProductCategoriesUnauthorized handles this case with default header values. +/* GetItemProductCategoriesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetItemProductCategoriesUnauthorized struct { func (o *GetItemProductCategoriesUnauthorized) Error() string { return fmt.Sprintf("[GET /items/productcategories][%d] getItemProductCategoriesUnauthorized %+v", 401, o.Payload) } - func (o *GetItemProductCategoriesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetItemProductCategoriesForbidden() *GetItemProductCategoriesForbidden { return &GetItemProductCategoriesForbidden{} } -/*GetItemProductCategoriesForbidden handles this case with default header values. +/* GetItemProductCategoriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetItemProductCategoriesForbidden struct { func (o *GetItemProductCategoriesForbidden) Error() string { return fmt.Sprintf("[GET /items/productcategories][%d] getItemProductCategoriesForbidden %+v", 403, o.Payload) } - func (o *GetItemProductCategoriesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetItemProductCategoriesNotFound() *GetItemProductCategoriesNotFound { return &GetItemProductCategoriesNotFound{} } -/*GetItemProductCategoriesNotFound handles this case with default header values. +/* GetItemProductCategoriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetItemProductCategoriesNotFound struct { func (o *GetItemProductCategoriesNotFound) Error() string { return fmt.Sprintf("[GET /items/productcategories][%d] getItemProductCategoriesNotFound %+v", 404, o.Payload) } - func (o *GetItemProductCategoriesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetItemProductCategoriesInternalServerError() *GetItemProductCategoriesI return &GetItemProductCategoriesInternalServerError{} } -/*GetItemProductCategoriesInternalServerError handles this case with default header values. +/* GetItemProductCategoriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetItemProductCategoriesInternalServerError struct { func (o *GetItemProductCategoriesInternalServerError) Error() string { return fmt.Sprintf("[GET /items/productcategories][%d] getItemProductCategoriesInternalServerError %+v", 500, o.Payload) } - func (o *GetItemProductCategoriesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/items/get_items_parameters.go b/api/metrc-gw/metrc_gw_client/items/get_items_parameters.go index 4a5d734..7a47dcc 100644 --- a/api/metrc-gw/metrc_gw_client/items/get_items_parameters.go +++ b/api/metrc-gw/metrc_gw_client/items/get_items_parameters.go @@ -21,98 +21,106 @@ import ( "github.com/go-openapi/swag" ) -// NewGetItemsParams creates a new GetItemsParams object -// with the default values initialized. +// NewGetItemsParams creates a new GetItemsParams 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 NewGetItemsParams() *GetItemsParams { - var () return &GetItemsParams{ - timeout: cr.DefaultTimeout, } } // NewGetItemsParamsWithTimeout creates a new GetItemsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetItemsParamsWithTimeout(timeout time.Duration) *GetItemsParams { - var () return &GetItemsParams{ - timeout: timeout, } } // NewGetItemsParamsWithContext creates a new GetItemsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetItemsParamsWithContext(ctx context.Context) *GetItemsParams { - var () return &GetItemsParams{ - Context: ctx, } } // NewGetItemsParamsWithHTTPClient creates a new GetItemsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetItemsParamsWithHTTPClient(client *http.Client) *GetItemsParams { - var () return &GetItemsParams{ HTTPClient: client, } } -/*GetItemsParams contains all the parameters to send to the API endpoint -for the get items operation typically these are written to a http.Request +/* GetItemsParams contains all the parameters to send to the API endpoint + for the get items operation. + + Typically these are written to a http.Request. */ type GetItemsParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*LastModifiedEnd - The last modified end timestamp + /* LastModifiedEnd. + + The last modified end timestamp */ LastModifiedEnd *string - /*LastModifiedStart - The last modified start timestamp + /* LastModifiedStart. + + The last modified start timestamp */ LastModifiedStart *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Onhold - Get On Hold objects? + /* Onhold. + + Get On Hold objects? */ Onhold *bool - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -121,6 +129,21 @@ type GetItemsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetItemsParams) WithDefaults() *GetItemsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetItemsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get items params func (o *GetItemsParams) WithTimeout(timeout time.Duration) *GetItemsParams { o.SetTimeout(timeout) @@ -276,70 +299,75 @@ func (o *GetItemsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } if o.LastModifiedEnd != nil { // query param lastModifiedEnd var qrLastModifiedEnd string + if o.LastModifiedEnd != nil { qrLastModifiedEnd = *o.LastModifiedEnd } qLastModifiedEnd := qrLastModifiedEnd if qLastModifiedEnd != "" { + if err := r.SetQueryParam("lastModifiedEnd", qLastModifiedEnd); err != nil { return err } } - } if o.LastModifiedStart != nil { // query param lastModifiedStart var qrLastModifiedStart string + if o.LastModifiedStart != nil { qrLastModifiedStart = *o.LastModifiedStart } qLastModifiedStart := qrLastModifiedStart if qLastModifiedStart != "" { + if err := r.SetQueryParam("lastModifiedStart", qLastModifiedStart); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -349,38 +377,41 @@ func (o *GetItemsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param onhold var qrOnhold bool + if o.Onhold != nil { qrOnhold = *o.Onhold } qOnhold := swag.FormatBool(qrOnhold) if qOnhold != "" { + if err := r.SetQueryParam("onhold", qOnhold); err != nil { return err } } - } if o.Production != nil { // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -390,6 +421,7 @@ func (o *GetItemsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -399,6 +431,7 @@ func (o *GetItemsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/items/get_items_responses.go b/api/metrc-gw/metrc_gw_client/items/get_items_responses.go index 7396104..2086eb4 100644 --- a/api/metrc-gw/metrc_gw_client/items/get_items_responses.go +++ b/api/metrc-gw/metrc_gw_client/items/get_items_responses.go @@ -57,9 +57,8 @@ func (o *GetItemsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetItemsOK() *GetItemsOK { return &GetItemsOK{} } -/*GetItemsOK handles this case with default header values. +/* GetItemsOK describes a response with status code 200, with default header values. An item was successfully retrieved */ @@ -79,7 +78,6 @@ type GetItemsOK struct { func (o *GetItemsOK) Error() string { return fmt.Sprintf("[GET /items][%d] getItemsOK %+v", 200, o.Payload) } - func (o *GetItemsOK) GetPayload() *metrc_gw_models.ItemResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetItemsUnauthorized() *GetItemsUnauthorized { return &GetItemsUnauthorized{} } -/*GetItemsUnauthorized handles this case with default header values. +/* GetItemsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetItemsUnauthorized struct { func (o *GetItemsUnauthorized) Error() string { return fmt.Sprintf("[GET /items][%d] getItemsUnauthorized %+v", 401, o.Payload) } - func (o *GetItemsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetItemsForbidden() *GetItemsForbidden { return &GetItemsForbidden{} } -/*GetItemsForbidden handles this case with default header values. +/* GetItemsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetItemsForbidden struct { func (o *GetItemsForbidden) Error() string { return fmt.Sprintf("[GET /items][%d] getItemsForbidden %+v", 403, o.Payload) } - func (o *GetItemsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetItemsNotFound() *GetItemsNotFound { return &GetItemsNotFound{} } -/*GetItemsNotFound handles this case with default header values. +/* GetItemsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetItemsNotFound struct { func (o *GetItemsNotFound) Error() string { return fmt.Sprintf("[GET /items][%d] getItemsNotFound %+v", 404, o.Payload) } - func (o *GetItemsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetItemsInternalServerError() *GetItemsInternalServerError { return &GetItemsInternalServerError{} } -/*GetItemsInternalServerError handles this case with default header values. +/* GetItemsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetItemsInternalServerError struct { func (o *GetItemsInternalServerError) Error() string { return fmt.Sprintf("[GET /items][%d] getItemsInternalServerError %+v", 500, o.Payload) } - func (o *GetItemsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/items/items_client.go b/api/metrc-gw/metrc_gw_client/items/items_client.go index 7d2bf26..c68b18c 100644 --- a/api/metrc-gw/metrc_gw_client/items/items_client.go +++ b/api/metrc-gw/metrc_gw_client/items/items_client.go @@ -29,19 +29,22 @@ type Client struct { 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 { - DeleteItem(params *DeleteItemParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteItemOK, error) + DeleteItem(params *DeleteItemParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteItemOK, error) - GetBrands(params *GetBrandsParams, authInfo runtime.ClientAuthInfoWriter) error + GetBrands(params *GetBrandsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error - GetItemProductCategories(params *GetItemProductCategoriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetItemProductCategoriesOK, error) + GetItemProductCategories(params *GetItemProductCategoriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetItemProductCategoriesOK, error) - GetItems(params *GetItemsParams, authInfo runtime.ClientAuthInfoWriter) (*GetItemsOK, error) + GetItems(params *GetItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetItemsOK, error) - PostItems(params *PostItemsParams, authInfo runtime.ClientAuthInfoWriter) (*PostItemsOK, error) + PostItems(params *PostItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostItemsOK, error) - PutItems(params *PutItemsParams, authInfo runtime.ClientAuthInfoWriter) (*PutItemsOK, error) + PutItems(params *PutItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutItemsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -52,13 +55,12 @@ type ClientService interface { Delete a Item for this User-License */ -func (a *Client) DeleteItem(params *DeleteItemParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteItemOK, error) { +func (a *Client) DeleteItem(params *DeleteItemParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteItemOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteItemParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "Delete Item", Method: "DELETE", PathPattern: "/items", @@ -70,7 +72,12 @@ func (a *Client) DeleteItem(params *DeleteItemParams, authInfo runtime.ClientAut 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 } @@ -90,13 +97,12 @@ func (a *Client) DeleteItem(params *DeleteItemParams, authInfo runtime.ClientAut Get Item Brands for this User */ -func (a *Client) GetBrands(params *GetBrandsParams, authInfo runtime.ClientAuthInfoWriter) error { +func (a *Client) GetBrands(params *GetBrandsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error { // TODO: Validate the params before sending if params == nil { params = NewGetBrandsParams() } - - _, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getBrands", Method: "GET", PathPattern: "/items/brands", @@ -108,7 +114,12 @@ func (a *Client) GetBrands(params *GetBrandsParams, authInfo runtime.ClientAuthI AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) if err != nil { return err } @@ -121,13 +132,12 @@ func (a *Client) GetBrands(params *GetBrandsParams, authInfo runtime.ClientAuthI Item Product Categories for this User */ -func (a *Client) GetItemProductCategories(params *GetItemProductCategoriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetItemProductCategoriesOK, error) { +func (a *Client) GetItemProductCategories(params *GetItemProductCategoriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetItemProductCategoriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetItemProductCategoriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getItemProductCategories", Method: "GET", PathPattern: "/items/productcategories", @@ -139,7 +149,12 @@ func (a *Client) GetItemProductCategories(params *GetItemProductCategoriesParams 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 } @@ -159,13 +174,12 @@ func (a *Client) GetItemProductCategories(params *GetItemProductCategoriesParams Get one or more Items for this User-License */ -func (a *Client) GetItems(params *GetItemsParams, authInfo runtime.ClientAuthInfoWriter) (*GetItemsOK, error) { +func (a *Client) GetItems(params *GetItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetItemsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetItemsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getItems", Method: "GET", PathPattern: "/items", @@ -177,7 +191,12 @@ func (a *Client) GetItems(params *GetItemsParams, authInfo runtime.ClientAuthInf 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 } @@ -196,13 +215,12 @@ func (a *Client) GetItems(params *GetItemsParams, authInfo runtime.ClientAuthInf Create new Items */ -func (a *Client) PostItems(params *PostItemsParams, authInfo runtime.ClientAuthInfoWriter) (*PostItemsOK, error) { +func (a *Client) PostItems(params *PostItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostItemsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostItemsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postItems", Method: "POST", PathPattern: "/items", @@ -214,7 +232,12 @@ func (a *Client) PostItems(params *PostItemsParams, authInfo runtime.ClientAuthI 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 } @@ -233,13 +256,12 @@ func (a *Client) PostItems(params *PostItemsParams, authInfo runtime.ClientAuthI Update existing Items */ -func (a *Client) PutItems(params *PutItemsParams, authInfo runtime.ClientAuthInfoWriter) (*PutItemsOK, error) { +func (a *Client) PutItems(params *PutItemsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutItemsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutItemsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putItems", Method: "PUT", PathPattern: "/items", @@ -251,7 +273,12 @@ func (a *Client) PutItems(params *PutItemsParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/metrc-gw/metrc_gw_client/items/post_items_parameters.go b/api/metrc-gw/metrc_gw_client/items/post_items_parameters.go index b0a9642..a352640 100644 --- a/api/metrc-gw/metrc_gw_client/items/post_items_parameters.go +++ b/api/metrc-gw/metrc_gw_client/items/post_items_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostItemsParams creates a new PostItemsParams object -// with the default values initialized. +// NewPostItemsParams creates a new PostItemsParams 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 NewPostItemsParams() *PostItemsParams { - var () return &PostItemsParams{ - timeout: cr.DefaultTimeout, } } // NewPostItemsParamsWithTimeout creates a new PostItemsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostItemsParamsWithTimeout(timeout time.Duration) *PostItemsParams { - var () return &PostItemsParams{ - timeout: timeout, } } // NewPostItemsParamsWithContext creates a new PostItemsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostItemsParamsWithContext(ctx context.Context) *PostItemsParams { - var () return &PostItemsParams{ - Context: ctx, } } // NewPostItemsParamsWithHTTPClient creates a new PostItemsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostItemsParamsWithHTTPClient(client *http.Client) *PostItemsParams { - var () return &PostItemsParams{ HTTPClient: client, } } -/*PostItemsParams contains all the parameters to send to the API endpoint -for the post items operation typically these are written to a http.Request +/* PostItemsParams contains all the parameters to send to the API endpoint + for the post items operation. + + Typically these are written to a http.Request. */ type PostItemsParams struct { - /*ItemRequest - The New Items + /* ItemRequest. + The New Items */ ItemRequest *metrc_gw_models.ItemRequest @@ -77,6 +76,21 @@ type PostItemsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostItemsParams) WithDefaults() *PostItemsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostItemsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post items params func (o *PostItemsParams) WithTimeout(timeout time.Duration) *PostItemsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostItemsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.ItemRequest != nil { if err := r.SetBodyParam(o.ItemRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/items/post_items_responses.go b/api/metrc-gw/metrc_gw_client/items/post_items_responses.go index 4c8ec35..59856b6 100644 --- a/api/metrc-gw/metrc_gw_client/items/post_items_responses.go +++ b/api/metrc-gw/metrc_gw_client/items/post_items_responses.go @@ -57,9 +57,8 @@ func (o *PostItemsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostItemsOK() *PostItemsOK { return &PostItemsOK{} } -/*PostItemsOK handles this case with default header values. +/* PostItemsOK describes a response with status code 200, with default header values. An array of Items records with the new IDs */ @@ -79,7 +78,6 @@ type PostItemsOK struct { func (o *PostItemsOK) Error() string { return fmt.Sprintf("[POST /items][%d] postItemsOK %+v", 200, o.Payload) } - func (o *PostItemsOK) GetPayload() *metrc_gw_models.ItemResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostItemsUnauthorized() *PostItemsUnauthorized { return &PostItemsUnauthorized{} } -/*PostItemsUnauthorized handles this case with default header values. +/* PostItemsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostItemsUnauthorized struct { func (o *PostItemsUnauthorized) Error() string { return fmt.Sprintf("[POST /items][%d] postItemsUnauthorized %+v", 401, o.Payload) } - func (o *PostItemsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostItemsForbidden() *PostItemsForbidden { return &PostItemsForbidden{} } -/*PostItemsForbidden handles this case with default header values. +/* PostItemsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostItemsForbidden struct { func (o *PostItemsForbidden) Error() string { return fmt.Sprintf("[POST /items][%d] postItemsForbidden %+v", 403, o.Payload) } - func (o *PostItemsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostItemsNotFound() *PostItemsNotFound { return &PostItemsNotFound{} } -/*PostItemsNotFound handles this case with default header values. +/* PostItemsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostItemsNotFound struct { func (o *PostItemsNotFound) Error() string { return fmt.Sprintf("[POST /items][%d] postItemsNotFound %+v", 404, o.Payload) } - func (o *PostItemsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostItemsInternalServerError() *PostItemsInternalServerError { return &PostItemsInternalServerError{} } -/*PostItemsInternalServerError handles this case with default header values. +/* PostItemsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostItemsInternalServerError struct { func (o *PostItemsInternalServerError) Error() string { return fmt.Sprintf("[POST /items][%d] postItemsInternalServerError %+v", 500, o.Payload) } - func (o *PostItemsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/items/put_items_parameters.go b/api/metrc-gw/metrc_gw_client/items/put_items_parameters.go index a49d078..6c74561 100644 --- a/api/metrc-gw/metrc_gw_client/items/put_items_parameters.go +++ b/api/metrc-gw/metrc_gw_client/items/put_items_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutItemsParams creates a new PutItemsParams object -// with the default values initialized. +// NewPutItemsParams creates a new PutItemsParams 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 NewPutItemsParams() *PutItemsParams { - var () return &PutItemsParams{ - timeout: cr.DefaultTimeout, } } // NewPutItemsParamsWithTimeout creates a new PutItemsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutItemsParamsWithTimeout(timeout time.Duration) *PutItemsParams { - var () return &PutItemsParams{ - timeout: timeout, } } // NewPutItemsParamsWithContext creates a new PutItemsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutItemsParamsWithContext(ctx context.Context) *PutItemsParams { - var () return &PutItemsParams{ - Context: ctx, } } // NewPutItemsParamsWithHTTPClient creates a new PutItemsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutItemsParamsWithHTTPClient(client *http.Client) *PutItemsParams { - var () return &PutItemsParams{ HTTPClient: client, } } -/*PutItemsParams contains all the parameters to send to the API endpoint -for the put items operation typically these are written to a http.Request +/* PutItemsParams contains all the parameters to send to the API endpoint + for the put items operation. + + Typically these are written to a http.Request. */ type PutItemsParams struct { - /*ItemRequest - The Existing Items with Ids + /* ItemRequest. + The Existing Items with Ids */ ItemRequest *metrc_gw_models.ItemRequest @@ -77,6 +76,21 @@ type PutItemsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutItemsParams) WithDefaults() *PutItemsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put items params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutItemsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put items params func (o *PutItemsParams) WithTimeout(timeout time.Duration) *PutItemsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutItemsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.ItemRequest != nil { if err := r.SetBodyParam(o.ItemRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/items/put_items_responses.go b/api/metrc-gw/metrc_gw_client/items/put_items_responses.go index 29919da..8461f8b 100644 --- a/api/metrc-gw/metrc_gw_client/items/put_items_responses.go +++ b/api/metrc-gw/metrc_gw_client/items/put_items_responses.go @@ -57,9 +57,8 @@ func (o *PutItemsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutItemsOK() *PutItemsOK { return &PutItemsOK{} } -/*PutItemsOK handles this case with default header values. +/* PutItemsOK describes a response with status code 200, with default header values. An array of Items records */ @@ -79,7 +78,6 @@ type PutItemsOK struct { func (o *PutItemsOK) Error() string { return fmt.Sprintf("[PUT /items][%d] putItemsOK %+v", 200, o.Payload) } - func (o *PutItemsOK) GetPayload() *metrc_gw_models.ItemResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutItemsUnauthorized() *PutItemsUnauthorized { return &PutItemsUnauthorized{} } -/*PutItemsUnauthorized handles this case with default header values. +/* PutItemsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutItemsUnauthorized struct { func (o *PutItemsUnauthorized) Error() string { return fmt.Sprintf("[PUT /items][%d] putItemsUnauthorized %+v", 401, o.Payload) } - func (o *PutItemsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutItemsForbidden() *PutItemsForbidden { return &PutItemsForbidden{} } -/*PutItemsForbidden handles this case with default header values. +/* PutItemsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutItemsForbidden struct { func (o *PutItemsForbidden) Error() string { return fmt.Sprintf("[PUT /items][%d] putItemsForbidden %+v", 403, o.Payload) } - func (o *PutItemsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutItemsNotFound() *PutItemsNotFound { return &PutItemsNotFound{} } -/*PutItemsNotFound handles this case with default header values. +/* PutItemsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutItemsNotFound struct { func (o *PutItemsNotFound) Error() string { return fmt.Sprintf("[PUT /items][%d] putItemsNotFound %+v", 404, o.Payload) } - func (o *PutItemsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutItemsInternalServerError() *PutItemsInternalServerError { return &PutItemsInternalServerError{} } -/*PutItemsInternalServerError handles this case with default header values. +/* PutItemsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutItemsInternalServerError struct { func (o *PutItemsInternalServerError) Error() string { return fmt.Sprintf("[PUT /items][%d] putItemsInternalServerError %+v", 500, o.Payload) } - func (o *PutItemsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_parameters.go b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_parameters.go index 647b4c3..f9814ab 100644 --- a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_parameters.go +++ b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetLabtestStatesParams creates a new GetLabtestStatesParams object -// with the default values initialized. +// NewGetLabtestStatesParams creates a new GetLabtestStatesParams 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 NewGetLabtestStatesParams() *GetLabtestStatesParams { - var () return &GetLabtestStatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetLabtestStatesParamsWithTimeout creates a new GetLabtestStatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLabtestStatesParamsWithTimeout(timeout time.Duration) *GetLabtestStatesParams { - var () return &GetLabtestStatesParams{ - timeout: timeout, } } // NewGetLabtestStatesParamsWithContext creates a new GetLabtestStatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLabtestStatesParamsWithContext(ctx context.Context) *GetLabtestStatesParams { - var () return &GetLabtestStatesParams{ - Context: ctx, } } // NewGetLabtestStatesParamsWithHTTPClient creates a new GetLabtestStatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLabtestStatesParamsWithHTTPClient(client *http.Client) *GetLabtestStatesParams { - var () return &GetLabtestStatesParams{ HTTPClient: client, } } -/*GetLabtestStatesParams contains all the parameters to send to the API endpoint -for the get labtest states operation typically these are written to a http.Request +/* GetLabtestStatesParams contains all the parameters to send to the API endpoint + for the get labtest states operation. + + Typically these are written to a http.Request. */ type GetLabtestStatesParams struct { - /*Production - Use Production API? + /* Production. + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -91,6 +93,21 @@ type GetLabtestStatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get labtest states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLabtestStatesParams) WithDefaults() *GetLabtestStatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get labtest states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLabtestStatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get labtest states params func (o *GetLabtestStatesParams) WithTimeout(timeout time.Duration) *GetLabtestStatesParams { o.SetTimeout(timeout) @@ -180,22 +197,24 @@ func (o *GetLabtestStatesParams) WriteToRequest(r runtime.ClientRequest, reg str // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -205,6 +224,7 @@ func (o *GetLabtestStatesParams) WriteToRequest(r runtime.ClientRequest, reg str qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -214,6 +234,7 @@ func (o *GetLabtestStatesParams) WriteToRequest(r runtime.ClientRequest, reg str qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_responses.go b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_responses.go index 30a66a5..e0548e8 100644 --- a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_responses.go +++ b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_states_responses.go @@ -57,9 +57,8 @@ func (o *GetLabtestStatesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetLabtestStatesOK() *GetLabtestStatesOK { return &GetLabtestStatesOK{} } -/*GetLabtestStatesOK handles this case with default header values. +/* GetLabtestStatesOK describes a response with status code 200, with default header values. A list of Item Product Categories was succefully retrieved */ @@ -79,7 +78,6 @@ type GetLabtestStatesOK struct { func (o *GetLabtestStatesOK) Error() string { return fmt.Sprintf("[GET /labtests/states][%d] getLabtestStatesOK %+v", 200, o.Payload) } - func (o *GetLabtestStatesOK) GetPayload() *metrc_gw_models.LabTestStateResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetLabtestStatesUnauthorized() *GetLabtestStatesUnauthorized { return &GetLabtestStatesUnauthorized{} } -/*GetLabtestStatesUnauthorized handles this case with default header values. +/* GetLabtestStatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetLabtestStatesUnauthorized struct { func (o *GetLabtestStatesUnauthorized) Error() string { return fmt.Sprintf("[GET /labtests/states][%d] getLabtestStatesUnauthorized %+v", 401, o.Payload) } - func (o *GetLabtestStatesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetLabtestStatesForbidden() *GetLabtestStatesForbidden { return &GetLabtestStatesForbidden{} } -/*GetLabtestStatesForbidden handles this case with default header values. +/* GetLabtestStatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetLabtestStatesForbidden struct { func (o *GetLabtestStatesForbidden) Error() string { return fmt.Sprintf("[GET /labtests/states][%d] getLabtestStatesForbidden %+v", 403, o.Payload) } - func (o *GetLabtestStatesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetLabtestStatesNotFound() *GetLabtestStatesNotFound { return &GetLabtestStatesNotFound{} } -/*GetLabtestStatesNotFound handles this case with default header values. +/* GetLabtestStatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetLabtestStatesNotFound struct { func (o *GetLabtestStatesNotFound) Error() string { return fmt.Sprintf("[GET /labtests/states][%d] getLabtestStatesNotFound %+v", 404, o.Payload) } - func (o *GetLabtestStatesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetLabtestStatesInternalServerError() *GetLabtestStatesInternalServerErr return &GetLabtestStatesInternalServerError{} } -/*GetLabtestStatesInternalServerError handles this case with default header values. +/* GetLabtestStatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetLabtestStatesInternalServerError struct { func (o *GetLabtestStatesInternalServerError) Error() string { return fmt.Sprintf("[GET /labtests/states][%d] getLabtestStatesInternalServerError %+v", 500, o.Payload) } - func (o *GetLabtestStatesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_parameters.go b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_parameters.go index 29541ca..3d8f2a4 100644 --- a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_parameters.go +++ b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetLabtestTypesParams creates a new GetLabtestTypesParams object -// with the default values initialized. +// NewGetLabtestTypesParams creates a new GetLabtestTypesParams 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 NewGetLabtestTypesParams() *GetLabtestTypesParams { - var () return &GetLabtestTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetLabtestTypesParamsWithTimeout creates a new GetLabtestTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLabtestTypesParamsWithTimeout(timeout time.Duration) *GetLabtestTypesParams { - var () return &GetLabtestTypesParams{ - timeout: timeout, } } // NewGetLabtestTypesParamsWithContext creates a new GetLabtestTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLabtestTypesParamsWithContext(ctx context.Context) *GetLabtestTypesParams { - var () return &GetLabtestTypesParams{ - Context: ctx, } } // NewGetLabtestTypesParamsWithHTTPClient creates a new GetLabtestTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLabtestTypesParamsWithHTTPClient(client *http.Client) *GetLabtestTypesParams { - var () return &GetLabtestTypesParams{ HTTPClient: client, } } -/*GetLabtestTypesParams contains all the parameters to send to the API endpoint -for the get labtest types operation typically these are written to a http.Request +/* GetLabtestTypesParams contains all the parameters to send to the API endpoint + for the get labtest types operation. + + Typically these are written to a http.Request. */ type GetLabtestTypesParams struct { - /*Production - Use Production API? + /* Production. + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -91,6 +93,21 @@ type GetLabtestTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get labtest types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLabtestTypesParams) WithDefaults() *GetLabtestTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get labtest types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLabtestTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get labtest types params func (o *GetLabtestTypesParams) WithTimeout(timeout time.Duration) *GetLabtestTypesParams { o.SetTimeout(timeout) @@ -180,22 +197,24 @@ func (o *GetLabtestTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -205,6 +224,7 @@ func (o *GetLabtestTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -214,6 +234,7 @@ func (o *GetLabtestTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_responses.go b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_responses.go index ca76e1e..0754f63 100644 --- a/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_responses.go +++ b/api/metrc-gw/metrc_gw_client/lab_tests/get_labtest_types_responses.go @@ -57,9 +57,8 @@ func (o *GetLabtestTypesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetLabtestTypesOK() *GetLabtestTypesOK { return &GetLabtestTypesOK{} } -/*GetLabtestTypesOK handles this case with default header values. +/* GetLabtestTypesOK describes a response with status code 200, with default header values. A list of Item Product Categories was succefully retrieved */ @@ -79,7 +78,6 @@ type GetLabtestTypesOK struct { func (o *GetLabtestTypesOK) Error() string { return fmt.Sprintf("[GET /labtests/types][%d] getLabtestTypesOK %+v", 200, o.Payload) } - func (o *GetLabtestTypesOK) GetPayload() *metrc_gw_models.LabTestTypeResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetLabtestTypesUnauthorized() *GetLabtestTypesUnauthorized { return &GetLabtestTypesUnauthorized{} } -/*GetLabtestTypesUnauthorized handles this case with default header values. +/* GetLabtestTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetLabtestTypesUnauthorized struct { func (o *GetLabtestTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /labtests/types][%d] getLabtestTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetLabtestTypesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetLabtestTypesForbidden() *GetLabtestTypesForbidden { return &GetLabtestTypesForbidden{} } -/*GetLabtestTypesForbidden handles this case with default header values. +/* GetLabtestTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetLabtestTypesForbidden struct { func (o *GetLabtestTypesForbidden) Error() string { return fmt.Sprintf("[GET /labtests/types][%d] getLabtestTypesForbidden %+v", 403, o.Payload) } - func (o *GetLabtestTypesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetLabtestTypesNotFound() *GetLabtestTypesNotFound { return &GetLabtestTypesNotFound{} } -/*GetLabtestTypesNotFound handles this case with default header values. +/* GetLabtestTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetLabtestTypesNotFound struct { func (o *GetLabtestTypesNotFound) Error() string { return fmt.Sprintf("[GET /labtests/types][%d] getLabtestTypesNotFound %+v", 404, o.Payload) } - func (o *GetLabtestTypesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetLabtestTypesInternalServerError() *GetLabtestTypesInternalServerError return &GetLabtestTypesInternalServerError{} } -/*GetLabtestTypesInternalServerError handles this case with default header values. +/* GetLabtestTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetLabtestTypesInternalServerError struct { func (o *GetLabtestTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /labtests/types][%d] getLabtestTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetLabtestTypesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/lab_tests/lab_tests_client.go b/api/metrc-gw/metrc_gw_client/lab_tests/lab_tests_client.go index 61cdcec..254c1dc 100644 --- a/api/metrc-gw/metrc_gw_client/lab_tests/lab_tests_client.go +++ b/api/metrc-gw/metrc_gw_client/lab_tests/lab_tests_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetLabtestStates(params *GetLabtestStatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLabtestStatesOK, error) + GetLabtestStates(params *GetLabtestStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLabtestStatesOK, error) - GetLabtestTypes(params *GetLabtestTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLabtestTypesOK, error) + GetLabtestTypes(params *GetLabtestTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLabtestTypesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -44,13 +47,12 @@ type ClientService interface { Get The Lab Test States */ -func (a *Client) GetLabtestStates(params *GetLabtestStatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLabtestStatesOK, error) { +func (a *Client) GetLabtestStates(params *GetLabtestStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLabtestStatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLabtestStatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLabtestStates", Method: "GET", PathPattern: "/labtests/states", @@ -62,7 +64,12 @@ func (a *Client) GetLabtestStates(params *GetLabtestStatesParams, authInfo runti 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 } @@ -82,13 +89,12 @@ func (a *Client) GetLabtestStates(params *GetLabtestStatesParams, authInfo runti Get The Lab Test States */ -func (a *Client) GetLabtestTypes(params *GetLabtestTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLabtestTypesOK, error) { +func (a *Client) GetLabtestTypes(params *GetLabtestTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLabtestTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLabtestTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLabtestTypes", Method: "GET", PathPattern: "/labtests/types", @@ -100,7 +106,12 @@ func (a *Client) GetLabtestTypes(params *GetLabtestTypesParams, authInfo runtime 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 } diff --git a/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_parameters.go b/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_parameters.go index 66e3c1a..1eea413 100644 --- a/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_parameters.go +++ b/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPackageAdjustmentReasonsParams creates a new GetPackageAdjustmentReasonsParams object -// with the default values initialized. +// NewGetPackageAdjustmentReasonsParams creates a new GetPackageAdjustmentReasonsParams 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 NewGetPackageAdjustmentReasonsParams() *GetPackageAdjustmentReasonsParams { - var () return &GetPackageAdjustmentReasonsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPackageAdjustmentReasonsParamsWithTimeout creates a new GetPackageAdjustmentReasonsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPackageAdjustmentReasonsParamsWithTimeout(timeout time.Duration) *GetPackageAdjustmentReasonsParams { - var () return &GetPackageAdjustmentReasonsParams{ - timeout: timeout, } } // NewGetPackageAdjustmentReasonsParamsWithContext creates a new GetPackageAdjustmentReasonsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPackageAdjustmentReasonsParamsWithContext(ctx context.Context) *GetPackageAdjustmentReasonsParams { - var () return &GetPackageAdjustmentReasonsParams{ - Context: ctx, } } // NewGetPackageAdjustmentReasonsParamsWithHTTPClient creates a new GetPackageAdjustmentReasonsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPackageAdjustmentReasonsParamsWithHTTPClient(client *http.Client) *GetPackageAdjustmentReasonsParams { - var () return &GetPackageAdjustmentReasonsParams{ HTTPClient: client, } } -/*GetPackageAdjustmentReasonsParams contains all the parameters to send to the API endpoint -for the get package adjustment reasons operation typically these are written to a http.Request +/* GetPackageAdjustmentReasonsParams contains all the parameters to send to the API endpoint + for the get package adjustment reasons operation. + + Typically these are written to a http.Request. */ type GetPackageAdjustmentReasonsParams struct { - /*Reseller - The METRC Reseller Key + /* Reseller. + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -85,6 +86,21 @@ type GetPackageAdjustmentReasonsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get package adjustment reasons params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPackageAdjustmentReasonsParams) WithDefaults() *GetPackageAdjustmentReasonsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get package adjustment reasons params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPackageAdjustmentReasonsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get package adjustment reasons params func (o *GetPackageAdjustmentReasonsParams) WithTimeout(timeout time.Duration) *GetPackageAdjustmentReasonsParams { o.SetTimeout(timeout) @@ -163,6 +179,7 @@ func (o *GetPackageAdjustmentReasonsParams) WriteToRequest(r runtime.ClientReque qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -172,6 +189,7 @@ func (o *GetPackageAdjustmentReasonsParams) WriteToRequest(r runtime.ClientReque qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -181,6 +199,7 @@ func (o *GetPackageAdjustmentReasonsParams) WriteToRequest(r runtime.ClientReque qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_responses.go b/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_responses.go index a105fb1..25f3c3a 100644 --- a/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_responses.go +++ b/api/metrc-gw/metrc_gw_client/packages/get_package_adjustment_reasons_responses.go @@ -57,9 +57,8 @@ func (o *GetPackageAdjustmentReasonsReader) ReadResponse(response runtime.Client return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPackageAdjustmentReasonsOK() *GetPackageAdjustmentReasonsOK { return &GetPackageAdjustmentReasonsOK{} } -/*GetPackageAdjustmentReasonsOK handles this case with default header values. +/* GetPackageAdjustmentReasonsOK describes a response with status code 200, with default header values. A list of Package Types was succefully retrieved */ @@ -79,7 +78,6 @@ type GetPackageAdjustmentReasonsOK struct { func (o *GetPackageAdjustmentReasonsOK) Error() string { return fmt.Sprintf("[GET /packages/adjustmentreasons][%d] getPackageAdjustmentReasonsOK %+v", 200, o.Payload) } - func (o *GetPackageAdjustmentReasonsOK) GetPayload() *metrc_gw_models.PackageAdjustmentReasonResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPackageAdjustmentReasonsUnauthorized() *GetPackageAdjustmentReasonsUn return &GetPackageAdjustmentReasonsUnauthorized{} } -/*GetPackageAdjustmentReasonsUnauthorized handles this case with default header values. +/* GetPackageAdjustmentReasonsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPackageAdjustmentReasonsUnauthorized struct { func (o *GetPackageAdjustmentReasonsUnauthorized) Error() string { return fmt.Sprintf("[GET /packages/adjustmentreasons][%d] getPackageAdjustmentReasonsUnauthorized %+v", 401, o.Payload) } - func (o *GetPackageAdjustmentReasonsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPackageAdjustmentReasonsForbidden() *GetPackageAdjustmentReasonsForbi return &GetPackageAdjustmentReasonsForbidden{} } -/*GetPackageAdjustmentReasonsForbidden handles this case with default header values. +/* GetPackageAdjustmentReasonsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPackageAdjustmentReasonsForbidden struct { func (o *GetPackageAdjustmentReasonsForbidden) Error() string { return fmt.Sprintf("[GET /packages/adjustmentreasons][%d] getPackageAdjustmentReasonsForbidden %+v", 403, o.Payload) } - func (o *GetPackageAdjustmentReasonsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPackageAdjustmentReasonsNotFound() *GetPackageAdjustmentReasonsNotFou return &GetPackageAdjustmentReasonsNotFound{} } -/*GetPackageAdjustmentReasonsNotFound handles this case with default header values. +/* GetPackageAdjustmentReasonsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPackageAdjustmentReasonsNotFound struct { func (o *GetPackageAdjustmentReasonsNotFound) Error() string { return fmt.Sprintf("[GET /packages/adjustmentreasons][%d] getPackageAdjustmentReasonsNotFound %+v", 404, o.Payload) } - func (o *GetPackageAdjustmentReasonsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPackageAdjustmentReasonsInternalServerError() *GetPackageAdjustmentRe return &GetPackageAdjustmentReasonsInternalServerError{} } -/*GetPackageAdjustmentReasonsInternalServerError handles this case with default header values. +/* GetPackageAdjustmentReasonsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPackageAdjustmentReasonsInternalServerError struct { func (o *GetPackageAdjustmentReasonsInternalServerError) Error() string { return fmt.Sprintf("[GET /packages/adjustmentreasons][%d] getPackageAdjustmentReasonsInternalServerError %+v", 500, o.Payload) } - func (o *GetPackageAdjustmentReasonsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/packages/get_package_types_parameters.go b/api/metrc-gw/metrc_gw_client/packages/get_package_types_parameters.go index ad2cccd..e006897 100644 --- a/api/metrc-gw/metrc_gw_client/packages/get_package_types_parameters.go +++ b/api/metrc-gw/metrc_gw_client/packages/get_package_types_parameters.go @@ -20,63 +20,64 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPackageTypesParams creates a new GetPackageTypesParams object -// with the default values initialized. +// NewGetPackageTypesParams creates a new GetPackageTypesParams 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 NewGetPackageTypesParams() *GetPackageTypesParams { - var () return &GetPackageTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetPackageTypesParamsWithTimeout creates a new GetPackageTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPackageTypesParamsWithTimeout(timeout time.Duration) *GetPackageTypesParams { - var () return &GetPackageTypesParams{ - timeout: timeout, } } // NewGetPackageTypesParamsWithContext creates a new GetPackageTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPackageTypesParamsWithContext(ctx context.Context) *GetPackageTypesParams { - var () return &GetPackageTypesParams{ - Context: ctx, } } // NewGetPackageTypesParamsWithHTTPClient creates a new GetPackageTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPackageTypesParamsWithHTTPClient(client *http.Client) *GetPackageTypesParams { - var () return &GetPackageTypesParams{ HTTPClient: client, } } -/*GetPackageTypesParams contains all the parameters to send to the API endpoint -for the get package types operation typically these are written to a http.Request +/* GetPackageTypesParams contains all the parameters to send to the API endpoint + for the get package types operation. + + Typically these are written to a http.Request. */ type GetPackageTypesParams struct { - /*Reseller - The METRC Reseller Key + /* Reseller. + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -85,6 +86,21 @@ type GetPackageTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get package types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPackageTypesParams) WithDefaults() *GetPackageTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get package types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPackageTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get package types params func (o *GetPackageTypesParams) WithTimeout(timeout time.Duration) *GetPackageTypesParams { o.SetTimeout(timeout) @@ -163,6 +179,7 @@ func (o *GetPackageTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -172,6 +189,7 @@ func (o *GetPackageTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -181,6 +199,7 @@ func (o *GetPackageTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/packages/get_package_types_responses.go b/api/metrc-gw/metrc_gw_client/packages/get_package_types_responses.go index 12cbfb5..73b6138 100644 --- a/api/metrc-gw/metrc_gw_client/packages/get_package_types_responses.go +++ b/api/metrc-gw/metrc_gw_client/packages/get_package_types_responses.go @@ -57,9 +57,8 @@ func (o *GetPackageTypesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPackageTypesOK() *GetPackageTypesOK { return &GetPackageTypesOK{} } -/*GetPackageTypesOK handles this case with default header values. +/* GetPackageTypesOK describes a response with status code 200, with default header values. A list of Package Types was succefully retrieved */ @@ -79,7 +78,6 @@ type GetPackageTypesOK struct { func (o *GetPackageTypesOK) Error() string { return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesOK %+v", 200, o.Payload) } - func (o *GetPackageTypesOK) GetPayload() *metrc_gw_models.PackageTypeResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPackageTypesUnauthorized() *GetPackageTypesUnauthorized { return &GetPackageTypesUnauthorized{} } -/*GetPackageTypesUnauthorized handles this case with default header values. +/* GetPackageTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPackageTypesUnauthorized struct { func (o *GetPackageTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetPackageTypesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPackageTypesForbidden() *GetPackageTypesForbidden { return &GetPackageTypesForbidden{} } -/*GetPackageTypesForbidden handles this case with default header values. +/* GetPackageTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPackageTypesForbidden struct { func (o *GetPackageTypesForbidden) Error() string { return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesForbidden %+v", 403, o.Payload) } - func (o *GetPackageTypesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPackageTypesNotFound() *GetPackageTypesNotFound { return &GetPackageTypesNotFound{} } -/*GetPackageTypesNotFound handles this case with default header values. +/* GetPackageTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPackageTypesNotFound struct { func (o *GetPackageTypesNotFound) Error() string { return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesNotFound %+v", 404, o.Payload) } - func (o *GetPackageTypesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPackageTypesInternalServerError() *GetPackageTypesInternalServerError return &GetPackageTypesInternalServerError{} } -/*GetPackageTypesInternalServerError handles this case with default header values. +/* GetPackageTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPackageTypesInternalServerError struct { func (o *GetPackageTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetPackageTypesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/packages/get_packages_parameters.go b/api/metrc-gw/metrc_gw_client/packages/get_packages_parameters.go index ca94cfa..b8980f5 100644 --- a/api/metrc-gw/metrc_gw_client/packages/get_packages_parameters.go +++ b/api/metrc-gw/metrc_gw_client/packages/get_packages_parameters.go @@ -21,93 +21,100 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPackagesParams creates a new GetPackagesParams object -// with the default values initialized. +// NewGetPackagesParams creates a new GetPackagesParams 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 NewGetPackagesParams() *GetPackagesParams { - var () return &GetPackagesParams{ - timeout: cr.DefaultTimeout, } } // NewGetPackagesParamsWithTimeout creates a new GetPackagesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPackagesParamsWithTimeout(timeout time.Duration) *GetPackagesParams { - var () return &GetPackagesParams{ - timeout: timeout, } } // NewGetPackagesParamsWithContext creates a new GetPackagesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPackagesParamsWithContext(ctx context.Context) *GetPackagesParams { - var () return &GetPackagesParams{ - Context: ctx, } } // NewGetPackagesParamsWithHTTPClient creates a new GetPackagesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPackagesParamsWithHTTPClient(client *http.Client) *GetPackagesParams { - var () return &GetPackagesParams{ HTTPClient: client, } } -/*GetPackagesParams contains all the parameters to send to the API endpoint -for the get packages operation typically these are written to a http.Request +/* GetPackagesParams contains all the parameters to send to the API endpoint + for the get packages operation. + + Typically these are written to a http.Request. */ type GetPackagesParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*Label - The METRC Package Label + /* Label. + + The METRC Package Label */ Label *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Onhold - Get On Hold objects? + /* Onhold. + + Get On Hold objects? */ Onhold *bool - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -116,6 +123,21 @@ type GetPackagesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPackagesParams) WithDefaults() *GetPackagesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPackagesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get packages params func (o *GetPackagesParams) WithTimeout(timeout time.Duration) *GetPackagesParams { o.SetTimeout(timeout) @@ -260,54 +282,58 @@ func (o *GetPackagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } if o.Label != nil { // query param label var qrLabel string + if o.Label != nil { qrLabel = *o.Label } qLabel := qrLabel if qLabel != "" { + if err := r.SetQueryParam("label", qLabel); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -317,38 +343,41 @@ func (o *GetPackagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param onhold var qrOnhold bool + if o.Onhold != nil { qrOnhold = *o.Onhold } qOnhold := swag.FormatBool(qrOnhold) if qOnhold != "" { + if err := r.SetQueryParam("onhold", qOnhold); err != nil { return err } } - } if o.Production != nil { // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -358,6 +387,7 @@ func (o *GetPackagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -367,6 +397,7 @@ func (o *GetPackagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/packages/get_packages_responses.go b/api/metrc-gw/metrc_gw_client/packages/get_packages_responses.go index 2b603e8..ca3be20 100644 --- a/api/metrc-gw/metrc_gw_client/packages/get_packages_responses.go +++ b/api/metrc-gw/metrc_gw_client/packages/get_packages_responses.go @@ -57,9 +57,8 @@ func (o *GetPackagesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPackagesOK() *GetPackagesOK { return &GetPackagesOK{} } -/*GetPackagesOK handles this case with default header values. +/* GetPackagesOK describes a response with status code 200, with default header values. A list of Packages was retrieved */ @@ -79,7 +78,6 @@ type GetPackagesOK struct { func (o *GetPackagesOK) Error() string { return fmt.Sprintf("[GET /packages][%d] getPackagesOK %+v", 200, o.Payload) } - func (o *GetPackagesOK) GetPayload() *metrc_gw_models.PackageResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPackagesUnauthorized() *GetPackagesUnauthorized { return &GetPackagesUnauthorized{} } -/*GetPackagesUnauthorized handles this case with default header values. +/* GetPackagesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPackagesUnauthorized struct { func (o *GetPackagesUnauthorized) Error() string { return fmt.Sprintf("[GET /packages][%d] getPackagesUnauthorized %+v", 401, o.Payload) } - func (o *GetPackagesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPackagesForbidden() *GetPackagesForbidden { return &GetPackagesForbidden{} } -/*GetPackagesForbidden handles this case with default header values. +/* GetPackagesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPackagesForbidden struct { func (o *GetPackagesForbidden) Error() string { return fmt.Sprintf("[GET /packages][%d] getPackagesForbidden %+v", 403, o.Payload) } - func (o *GetPackagesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPackagesNotFound() *GetPackagesNotFound { return &GetPackagesNotFound{} } -/*GetPackagesNotFound handles this case with default header values. +/* GetPackagesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPackagesNotFound struct { func (o *GetPackagesNotFound) Error() string { return fmt.Sprintf("[GET /packages][%d] getPackagesNotFound %+v", 404, o.Payload) } - func (o *GetPackagesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPackagesInternalServerError() *GetPackagesInternalServerError { return &GetPackagesInternalServerError{} } -/*GetPackagesInternalServerError handles this case with default header values. +/* GetPackagesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPackagesInternalServerError struct { func (o *GetPackagesInternalServerError) Error() string { return fmt.Sprintf("[GET /packages][%d] getPackagesInternalServerError %+v", 500, o.Payload) } - func (o *GetPackagesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/packages/packages_client.go b/api/metrc-gw/metrc_gw_client/packages/packages_client.go index da3c28f..e3bb620 100644 --- a/api/metrc-gw/metrc_gw_client/packages/packages_client.go +++ b/api/metrc-gw/metrc_gw_client/packages/packages_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - GetPackageAdjustmentReasons(params *GetPackageAdjustmentReasonsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPackageAdjustmentReasonsOK, error) + GetPackageAdjustmentReasons(params *GetPackageAdjustmentReasonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPackageAdjustmentReasonsOK, error) - GetPackageTypes(params *GetPackageTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPackageTypesOK, error) + GetPackageTypes(params *GetPackageTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPackageTypesOK, error) - GetPackages(params *GetPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPackagesOK, error) + GetPackages(params *GetPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPackagesOK, error) - PostPackages(params *PostPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPackagesOK, error) + PostPackages(params *PostPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPackagesOK, error) - PutPackages(params *PutPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*PutPackagesOK, error) + PutPackages(params *PutPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPackagesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -50,13 +53,12 @@ type ClientService interface { Get Package Types */ -func (a *Client) GetPackageAdjustmentReasons(params *GetPackageAdjustmentReasonsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPackageAdjustmentReasonsOK, error) { +func (a *Client) GetPackageAdjustmentReasons(params *GetPackageAdjustmentReasonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPackageAdjustmentReasonsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPackageAdjustmentReasonsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPackageAdjustmentReasons", Method: "GET", PathPattern: "/packages/adjustmentreasons", @@ -68,7 +70,12 @@ func (a *Client) GetPackageAdjustmentReasons(params *GetPackageAdjustmentReasons 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 } @@ -88,13 +95,12 @@ func (a *Client) GetPackageAdjustmentReasons(params *GetPackageAdjustmentReasons Get Package Types */ -func (a *Client) GetPackageTypes(params *GetPackageTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPackageTypesOK, error) { +func (a *Client) GetPackageTypes(params *GetPackageTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPackageTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPackageTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPackageTypes", Method: "GET", PathPattern: "/packages/types", @@ -106,7 +112,12 @@ func (a *Client) GetPackageTypes(params *GetPackageTypesParams, authInfo runtime 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 } @@ -126,13 +137,12 @@ func (a *Client) GetPackageTypes(params *GetPackageTypesParams, authInfo runtime Get a single Item for this User-License */ -func (a *Client) GetPackages(params *GetPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPackagesOK, error) { +func (a *Client) GetPackages(params *GetPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPackagesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPackagesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPackages", Method: "GET", PathPattern: "/packages", @@ -144,7 +154,12 @@ func (a *Client) GetPackages(params *GetPackagesParams, authInfo runtime.ClientA 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 } @@ -163,13 +178,12 @@ func (a *Client) GetPackages(params *GetPackagesParams, authInfo runtime.ClientA Create new Packages */ -func (a *Client) PostPackages(params *PostPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPackagesOK, error) { +func (a *Client) PostPackages(params *PostPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPackagesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPackagesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPackages", Method: "POST", PathPattern: "/packages", @@ -181,7 +195,12 @@ func (a *Client) PostPackages(params *PostPackagesParams, authInfo runtime.Clien 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 } @@ -200,13 +219,12 @@ func (a *Client) PostPackages(params *PostPackagesParams, authInfo runtime.Clien Update existing Packages */ -func (a *Client) PutPackages(params *PutPackagesParams, authInfo runtime.ClientAuthInfoWriter) (*PutPackagesOK, error) { +func (a *Client) PutPackages(params *PutPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPackagesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutPackagesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putPackages", Method: "PUT", PathPattern: "/packages", @@ -218,7 +236,12 @@ func (a *Client) PutPackages(params *PutPackagesParams, authInfo runtime.ClientA 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 } diff --git a/api/metrc-gw/metrc_gw_client/packages/post_packages_parameters.go b/api/metrc-gw/metrc_gw_client/packages/post_packages_parameters.go index 723b054..a2a0b71 100644 --- a/api/metrc-gw/metrc_gw_client/packages/post_packages_parameters.go +++ b/api/metrc-gw/metrc_gw_client/packages/post_packages_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostPackagesParams creates a new PostPackagesParams object -// with the default values initialized. +// NewPostPackagesParams creates a new PostPackagesParams 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 NewPostPackagesParams() *PostPackagesParams { - var () return &PostPackagesParams{ - timeout: cr.DefaultTimeout, } } // NewPostPackagesParamsWithTimeout creates a new PostPackagesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPackagesParamsWithTimeout(timeout time.Duration) *PostPackagesParams { - var () return &PostPackagesParams{ - timeout: timeout, } } // NewPostPackagesParamsWithContext creates a new PostPackagesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPackagesParamsWithContext(ctx context.Context) *PostPackagesParams { - var () return &PostPackagesParams{ - Context: ctx, } } // NewPostPackagesParamsWithHTTPClient creates a new PostPackagesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPackagesParamsWithHTTPClient(client *http.Client) *PostPackagesParams { - var () return &PostPackagesParams{ HTTPClient: client, } } -/*PostPackagesParams contains all the parameters to send to the API endpoint -for the post packages operation typically these are written to a http.Request +/* PostPackagesParams contains all the parameters to send to the API endpoint + for the post packages operation. + + Typically these are written to a http.Request. */ type PostPackagesParams struct { - /*PackageRequest - The New Packages + /* PackageRequest. + The New Packages */ PackageRequest *metrc_gw_models.PackageRequest @@ -77,6 +76,21 @@ type PostPackagesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPackagesParams) WithDefaults() *PostPackagesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPackagesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post packages params func (o *PostPackagesParams) WithTimeout(timeout time.Duration) *PostPackagesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPackagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.PackageRequest != nil { if err := r.SetBodyParam(o.PackageRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/packages/post_packages_responses.go b/api/metrc-gw/metrc_gw_client/packages/post_packages_responses.go index 1d93b40..d389cab 100644 --- a/api/metrc-gw/metrc_gw_client/packages/post_packages_responses.go +++ b/api/metrc-gw/metrc_gw_client/packages/post_packages_responses.go @@ -57,9 +57,8 @@ func (o *PostPackagesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostPackagesOK() *PostPackagesOK { return &PostPackagesOK{} } -/*PostPackagesOK handles this case with default header values. +/* PostPackagesOK describes a response with status code 200, with default header values. An array of Items records with the new IDs */ @@ -79,7 +78,6 @@ type PostPackagesOK struct { func (o *PostPackagesOK) Error() string { return fmt.Sprintf("[POST /packages][%d] postPackagesOK %+v", 200, o.Payload) } - func (o *PostPackagesOK) GetPayload() *metrc_gw_models.PackageResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostPackagesUnauthorized() *PostPackagesUnauthorized { return &PostPackagesUnauthorized{} } -/*PostPackagesUnauthorized handles this case with default header values. +/* PostPackagesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostPackagesUnauthorized struct { func (o *PostPackagesUnauthorized) Error() string { return fmt.Sprintf("[POST /packages][%d] postPackagesUnauthorized %+v", 401, o.Payload) } - func (o *PostPackagesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostPackagesForbidden() *PostPackagesForbidden { return &PostPackagesForbidden{} } -/*PostPackagesForbidden handles this case with default header values. +/* PostPackagesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostPackagesForbidden struct { func (o *PostPackagesForbidden) Error() string { return fmt.Sprintf("[POST /packages][%d] postPackagesForbidden %+v", 403, o.Payload) } - func (o *PostPackagesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostPackagesNotFound() *PostPackagesNotFound { return &PostPackagesNotFound{} } -/*PostPackagesNotFound handles this case with default header values. +/* PostPackagesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostPackagesNotFound struct { func (o *PostPackagesNotFound) Error() string { return fmt.Sprintf("[POST /packages][%d] postPackagesNotFound %+v", 404, o.Payload) } - func (o *PostPackagesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostPackagesInternalServerError() *PostPackagesInternalServerError { return &PostPackagesInternalServerError{} } -/*PostPackagesInternalServerError handles this case with default header values. +/* PostPackagesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostPackagesInternalServerError struct { func (o *PostPackagesInternalServerError) Error() string { return fmt.Sprintf("[POST /packages][%d] postPackagesInternalServerError %+v", 500, o.Payload) } - func (o *PostPackagesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/packages/put_packages_parameters.go b/api/metrc-gw/metrc_gw_client/packages/put_packages_parameters.go index 9a714e7..c4446c0 100644 --- a/api/metrc-gw/metrc_gw_client/packages/put_packages_parameters.go +++ b/api/metrc-gw/metrc_gw_client/packages/put_packages_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutPackagesParams creates a new PutPackagesParams object -// with the default values initialized. +// NewPutPackagesParams creates a new PutPackagesParams 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 NewPutPackagesParams() *PutPackagesParams { - var () return &PutPackagesParams{ - timeout: cr.DefaultTimeout, } } // NewPutPackagesParamsWithTimeout creates a new PutPackagesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutPackagesParamsWithTimeout(timeout time.Duration) *PutPackagesParams { - var () return &PutPackagesParams{ - timeout: timeout, } } // NewPutPackagesParamsWithContext creates a new PutPackagesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutPackagesParamsWithContext(ctx context.Context) *PutPackagesParams { - var () return &PutPackagesParams{ - Context: ctx, } } // NewPutPackagesParamsWithHTTPClient creates a new PutPackagesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutPackagesParamsWithHTTPClient(client *http.Client) *PutPackagesParams { - var () return &PutPackagesParams{ HTTPClient: client, } } -/*PutPackagesParams contains all the parameters to send to the API endpoint -for the put packages operation typically these are written to a http.Request +/* PutPackagesParams contains all the parameters to send to the API endpoint + for the put packages operation. + + Typically these are written to a http.Request. */ type PutPackagesParams struct { - /*PackageRequest - The Existing Items with Ids + /* PackageRequest. + The Existing Items with Ids */ PackageRequest *metrc_gw_models.PackageRequest @@ -77,6 +76,21 @@ type PutPackagesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPackagesParams) WithDefaults() *PutPackagesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put packages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPackagesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put packages params func (o *PutPackagesParams) WithTimeout(timeout time.Duration) *PutPackagesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutPackagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.PackageRequest != nil { if err := r.SetBodyParam(o.PackageRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/packages/put_packages_responses.go b/api/metrc-gw/metrc_gw_client/packages/put_packages_responses.go index c4d48c5..6ce8db9 100644 --- a/api/metrc-gw/metrc_gw_client/packages/put_packages_responses.go +++ b/api/metrc-gw/metrc_gw_client/packages/put_packages_responses.go @@ -57,9 +57,8 @@ func (o *PutPackagesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutPackagesOK() *PutPackagesOK { return &PutPackagesOK{} } -/*PutPackagesOK handles this case with default header values. +/* PutPackagesOK describes a response with status code 200, with default header values. An array of Package records */ @@ -79,7 +78,6 @@ type PutPackagesOK struct { func (o *PutPackagesOK) Error() string { return fmt.Sprintf("[PUT /packages][%d] putPackagesOK %+v", 200, o.Payload) } - func (o *PutPackagesOK) GetPayload() *metrc_gw_models.PackageResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutPackagesUnauthorized() *PutPackagesUnauthorized { return &PutPackagesUnauthorized{} } -/*PutPackagesUnauthorized handles this case with default header values. +/* PutPackagesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutPackagesUnauthorized struct { func (o *PutPackagesUnauthorized) Error() string { return fmt.Sprintf("[PUT /packages][%d] putPackagesUnauthorized %+v", 401, o.Payload) } - func (o *PutPackagesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutPackagesForbidden() *PutPackagesForbidden { return &PutPackagesForbidden{} } -/*PutPackagesForbidden handles this case with default header values. +/* PutPackagesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutPackagesForbidden struct { func (o *PutPackagesForbidden) Error() string { return fmt.Sprintf("[PUT /packages][%d] putPackagesForbidden %+v", 403, o.Payload) } - func (o *PutPackagesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutPackagesNotFound() *PutPackagesNotFound { return &PutPackagesNotFound{} } -/*PutPackagesNotFound handles this case with default header values. +/* PutPackagesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutPackagesNotFound struct { func (o *PutPackagesNotFound) Error() string { return fmt.Sprintf("[PUT /packages][%d] putPackagesNotFound %+v", 404, o.Payload) } - func (o *PutPackagesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutPackagesInternalServerError() *PutPackagesInternalServerError { return &PutPackagesInternalServerError{} } -/*PutPackagesInternalServerError handles this case with default header values. +/* PutPackagesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutPackagesInternalServerError struct { func (o *PutPackagesInternalServerError) Error() string { return fmt.Sprintf("[PUT /packages][%d] putPackagesInternalServerError %+v", 500, o.Payload) } - func (o *PutPackagesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_parameters.go b/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_parameters.go index 52e32bc..1974033 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewDeletePlantBatchParams creates a new DeletePlantBatchParams object -// with the default values initialized. +// NewDeletePlantBatchParams creates a new DeletePlantBatchParams 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 NewDeletePlantBatchParams() *DeletePlantBatchParams { - var () return &DeletePlantBatchParams{ - timeout: cr.DefaultTimeout, } } // NewDeletePlantBatchParamsWithTimeout creates a new DeletePlantBatchParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeletePlantBatchParamsWithTimeout(timeout time.Duration) *DeletePlantBatchParams { - var () return &DeletePlantBatchParams{ - timeout: timeout, } } // NewDeletePlantBatchParamsWithContext creates a new DeletePlantBatchParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeletePlantBatchParamsWithContext(ctx context.Context) *DeletePlantBatchParams { - var () return &DeletePlantBatchParams{ - Context: ctx, } } // NewDeletePlantBatchParamsWithHTTPClient creates a new DeletePlantBatchParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeletePlantBatchParamsWithHTTPClient(client *http.Client) *DeletePlantBatchParams { - var () return &DeletePlantBatchParams{ HTTPClient: client, } } -/*DeletePlantBatchParams contains all the parameters to send to the API endpoint -for the delete plant batch operation typically these are written to a http.Request +/* DeletePlantBatchParams contains all the parameters to send to the API endpoint + for the delete plant batch operation. + + Typically these are written to a http.Request. */ type DeletePlantBatchParams struct { - /*ItemID - The Item Number + /* ItemID. + The Item Number */ ItemID float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type DeletePlantBatchParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete plant batch params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePlantBatchParams) WithDefaults() *DeletePlantBatchParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete plant batch params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePlantBatchParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete plant batch params func (o *DeletePlantBatchParams) WithTimeout(timeout time.Duration) *DeletePlantBatchParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *DeletePlantBatchParams) WriteToRequest(r runtime.ClientRequest, reg str qrItemID := o.ItemID qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } @@ -205,6 +224,7 @@ func (o *DeletePlantBatchParams) WriteToRequest(r runtime.ClientRequest, reg str qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -214,6 +234,7 @@ func (o *DeletePlantBatchParams) WriteToRequest(r runtime.ClientRequest, reg str qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -223,6 +244,7 @@ func (o *DeletePlantBatchParams) WriteToRequest(r runtime.ClientRequest, reg str qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -232,6 +254,7 @@ func (o *DeletePlantBatchParams) WriteToRequest(r runtime.ClientRequest, reg str qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_responses.go b/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_responses.go index 1c54b14..f87536a 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_responses.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/delete_plant_batch_responses.go @@ -57,9 +57,8 @@ func (o *DeletePlantBatchReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeletePlantBatchOK() *DeletePlantBatchOK { return &DeletePlantBatchOK{} } -/*DeletePlantBatchOK handles this case with default header values. +/* DeletePlantBatchOK describes a response with status code 200, with default header values. Plants were successfully Deleted */ @@ -79,7 +78,6 @@ type DeletePlantBatchOK struct { func (o *DeletePlantBatchOK) Error() string { return fmt.Sprintf("[DELETE /plantbatches][%d] deletePlantBatchOK %+v", 200, o.Payload) } - func (o *DeletePlantBatchOK) GetPayload() *metrc_gw_models.PlantBatchResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewDeletePlantBatchUnauthorized() *DeletePlantBatchUnauthorized { return &DeletePlantBatchUnauthorized{} } -/*DeletePlantBatchUnauthorized handles this case with default header values. +/* DeletePlantBatchUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type DeletePlantBatchUnauthorized struct { func (o *DeletePlantBatchUnauthorized) Error() string { return fmt.Sprintf("[DELETE /plantbatches][%d] deletePlantBatchUnauthorized %+v", 401, o.Payload) } - func (o *DeletePlantBatchUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewDeletePlantBatchForbidden() *DeletePlantBatchForbidden { return &DeletePlantBatchForbidden{} } -/*DeletePlantBatchForbidden handles this case with default header values. +/* DeletePlantBatchForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type DeletePlantBatchForbidden struct { func (o *DeletePlantBatchForbidden) Error() string { return fmt.Sprintf("[DELETE /plantbatches][%d] deletePlantBatchForbidden %+v", 403, o.Payload) } - func (o *DeletePlantBatchForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewDeletePlantBatchNotFound() *DeletePlantBatchNotFound { return &DeletePlantBatchNotFound{} } -/*DeletePlantBatchNotFound handles this case with default header values. +/* DeletePlantBatchNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type DeletePlantBatchNotFound struct { func (o *DeletePlantBatchNotFound) Error() string { return fmt.Sprintf("[DELETE /plantbatches][%d] deletePlantBatchNotFound %+v", 404, o.Payload) } - func (o *DeletePlantBatchNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewDeletePlantBatchInternalServerError() *DeletePlantBatchInternalServerErr return &DeletePlantBatchInternalServerError{} } -/*DeletePlantBatchInternalServerError handles this case with default header values. +/* DeletePlantBatchInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type DeletePlantBatchInternalServerError struct { func (o *DeletePlantBatchInternalServerError) Error() string { return fmt.Sprintf("[DELETE /plantbatches][%d] deletePlantBatchInternalServerError %+v", 500, o.Payload) } - func (o *DeletePlantBatchInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_parameters.go b/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_parameters.go index d60a1ff..54635d8 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_parameters.go @@ -21,83 +21,88 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPlantBatchesParams creates a new GetPlantBatchesParams object -// with the default values initialized. +// NewGetPlantBatchesParams creates a new GetPlantBatchesParams 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 NewGetPlantBatchesParams() *GetPlantBatchesParams { - var () return &GetPlantBatchesParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlantBatchesParamsWithTimeout creates a new GetPlantBatchesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlantBatchesParamsWithTimeout(timeout time.Duration) *GetPlantBatchesParams { - var () return &GetPlantBatchesParams{ - timeout: timeout, } } // NewGetPlantBatchesParamsWithContext creates a new GetPlantBatchesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlantBatchesParamsWithContext(ctx context.Context) *GetPlantBatchesParams { - var () return &GetPlantBatchesParams{ - Context: ctx, } } // NewGetPlantBatchesParamsWithHTTPClient creates a new GetPlantBatchesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlantBatchesParamsWithHTTPClient(client *http.Client) *GetPlantBatchesParams { - var () return &GetPlantBatchesParams{ HTTPClient: client, } } -/*GetPlantBatchesParams contains all the parameters to send to the API endpoint -for the get plant batches operation typically these are written to a http.Request +/* GetPlantBatchesParams contains all the parameters to send to the API endpoint + for the get plant batches operation. + + Typically these are written to a http.Request. */ type GetPlantBatchesParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -106,6 +111,21 @@ type GetPlantBatchesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get plant batches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantBatchesParams) WithDefaults() *GetPlantBatchesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get plant batches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantBatchesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get plant batches params func (o *GetPlantBatchesParams) WithTimeout(timeout time.Duration) *GetPlantBatchesParams { o.SetTimeout(timeout) @@ -228,38 +248,41 @@ func (o *GetPlantBatchesParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -269,22 +292,24 @@ func (o *GetPlantBatchesParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -294,6 +319,7 @@ func (o *GetPlantBatchesParams) WriteToRequest(r runtime.ClientRequest, reg strf qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -303,6 +329,7 @@ func (o *GetPlantBatchesParams) WriteToRequest(r runtime.ClientRequest, reg strf qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_responses.go b/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_responses.go index e83900d..aec2944 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_responses.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/get_plant_batches_responses.go @@ -57,9 +57,8 @@ func (o *GetPlantBatchesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPlantBatchesOK() *GetPlantBatchesOK { return &GetPlantBatchesOK{} } -/*GetPlantBatchesOK handles this case with default header values. +/* GetPlantBatchesOK describes a response with status code 200, with default header values. Plant Batches were successfully retrieved */ @@ -79,7 +78,6 @@ type GetPlantBatchesOK struct { func (o *GetPlantBatchesOK) Error() string { return fmt.Sprintf("[GET /plantbatches][%d] getPlantBatchesOK %+v", 200, o.Payload) } - func (o *GetPlantBatchesOK) GetPayload() *metrc_gw_models.PlantBatchResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPlantBatchesUnauthorized() *GetPlantBatchesUnauthorized { return &GetPlantBatchesUnauthorized{} } -/*GetPlantBatchesUnauthorized handles this case with default header values. +/* GetPlantBatchesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPlantBatchesUnauthorized struct { func (o *GetPlantBatchesUnauthorized) Error() string { return fmt.Sprintf("[GET /plantbatches][%d] getPlantBatchesUnauthorized %+v", 401, o.Payload) } - func (o *GetPlantBatchesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPlantBatchesForbidden() *GetPlantBatchesForbidden { return &GetPlantBatchesForbidden{} } -/*GetPlantBatchesForbidden handles this case with default header values. +/* GetPlantBatchesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPlantBatchesForbidden struct { func (o *GetPlantBatchesForbidden) Error() string { return fmt.Sprintf("[GET /plantbatches][%d] getPlantBatchesForbidden %+v", 403, o.Payload) } - func (o *GetPlantBatchesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPlantBatchesNotFound() *GetPlantBatchesNotFound { return &GetPlantBatchesNotFound{} } -/*GetPlantBatchesNotFound handles this case with default header values. +/* GetPlantBatchesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPlantBatchesNotFound struct { func (o *GetPlantBatchesNotFound) Error() string { return fmt.Sprintf("[GET /plantbatches][%d] getPlantBatchesNotFound %+v", 404, o.Payload) } - func (o *GetPlantBatchesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPlantBatchesInternalServerError() *GetPlantBatchesInternalServerError return &GetPlantBatchesInternalServerError{} } -/*GetPlantBatchesInternalServerError handles this case with default header values. +/* GetPlantBatchesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPlantBatchesInternalServerError struct { func (o *GetPlantBatchesInternalServerError) Error() string { return fmt.Sprintf("[GET /plantbatches][%d] getPlantBatchesInternalServerError %+v", 500, o.Payload) } - func (o *GetPlantBatchesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/plant_batches_client.go b/api/metrc-gw/metrc_gw_client/plant_batches/plant_batches_client.go index 8412316..ed8968e 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/plant_batches_client.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/plant_batches_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeletePlantBatch(params *DeletePlantBatchParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePlantBatchOK, error) + DeletePlantBatch(params *DeletePlantBatchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePlantBatchOK, error) - GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantBatchesOK, error) + GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantBatchesOK, error) - PostPlantBatches(params *PostPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlantBatchesOK, error) + PostPlantBatches(params *PostPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPlantBatchesOK, error) - PutPlantBatches(params *PutPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PutPlantBatchesOK, error) + PutPlantBatches(params *PutPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPlantBatchesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -48,13 +51,12 @@ type ClientService interface { Delete a plant for this User-License */ -func (a *Client) DeletePlantBatch(params *DeletePlantBatchParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePlantBatchOK, error) { +func (a *Client) DeletePlantBatch(params *DeletePlantBatchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePlantBatchOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeletePlantBatchParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deletePlantBatch", Method: "DELETE", PathPattern: "/plantbatches", @@ -66,7 +68,12 @@ func (a *Client) DeletePlantBatch(params *DeletePlantBatchParams, authInfo runti 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 } @@ -86,13 +93,12 @@ func (a *Client) DeletePlantBatch(params *DeletePlantBatchParams, authInfo runti Get Plant Batches for this User-License */ -func (a *Client) GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantBatchesOK, error) { +func (a *Client) GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantBatchesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlantBatchesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlantBatches", Method: "GET", PathPattern: "/plantbatches", @@ -104,7 +110,12 @@ func (a *Client) GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime 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 } @@ -123,13 +134,12 @@ func (a *Client) GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime Create new Plant Batches */ -func (a *Client) PostPlantBatches(params *PostPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlantBatchesOK, error) { +func (a *Client) PostPlantBatches(params *PostPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPlantBatchesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPlantBatchesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPlantBatches", Method: "POST", PathPattern: "/plantbatches", @@ -141,7 +151,12 @@ func (a *Client) PostPlantBatches(params *PostPlantBatchesParams, authInfo runti 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 } @@ -160,13 +175,12 @@ func (a *Client) PostPlantBatches(params *PostPlantBatchesParams, authInfo runti Update existing Plant Batches */ -func (a *Client) PutPlantBatches(params *PutPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PutPlantBatchesOK, error) { +func (a *Client) PutPlantBatches(params *PutPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPlantBatchesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutPlantBatchesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putPlantBatches", Method: "PUT", PathPattern: "/plantbatches", @@ -178,7 +192,12 @@ func (a *Client) PutPlantBatches(params *PutPlantBatchesParams, authInfo runtime 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 } diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_parameters.go b/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_parameters.go index 75ccc9c..9c60ba9 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostPlantBatchesParams creates a new PostPlantBatchesParams object -// with the default values initialized. +// NewPostPlantBatchesParams creates a new PostPlantBatchesParams 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 NewPostPlantBatchesParams() *PostPlantBatchesParams { - var () return &PostPlantBatchesParams{ - timeout: cr.DefaultTimeout, } } // NewPostPlantBatchesParamsWithTimeout creates a new PostPlantBatchesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPlantBatchesParamsWithTimeout(timeout time.Duration) *PostPlantBatchesParams { - var () return &PostPlantBatchesParams{ - timeout: timeout, } } // NewPostPlantBatchesParamsWithContext creates a new PostPlantBatchesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPlantBatchesParamsWithContext(ctx context.Context) *PostPlantBatchesParams { - var () return &PostPlantBatchesParams{ - Context: ctx, } } // NewPostPlantBatchesParamsWithHTTPClient creates a new PostPlantBatchesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPlantBatchesParamsWithHTTPClient(client *http.Client) *PostPlantBatchesParams { - var () return &PostPlantBatchesParams{ HTTPClient: client, } } -/*PostPlantBatchesParams contains all the parameters to send to the API endpoint -for the post plant batches operation typically these are written to a http.Request +/* PostPlantBatchesParams contains all the parameters to send to the API endpoint + for the post plant batches operation. + + Typically these are written to a http.Request. */ type PostPlantBatchesParams struct { - /*PlantBatchRequest - The New Plant Batches + /* PlantBatchRequest. + The New Plant Batches */ PlantBatchRequest *metrc_gw_models.PlantBatchRequest @@ -77,6 +76,21 @@ type PostPlantBatchesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post plant batches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPlantBatchesParams) WithDefaults() *PostPlantBatchesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post plant batches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPlantBatchesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post plant batches params func (o *PostPlantBatchesParams) WithTimeout(timeout time.Duration) *PostPlantBatchesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPlantBatchesParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.PlantBatchRequest != nil { if err := r.SetBodyParam(o.PlantBatchRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_responses.go b/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_responses.go index de8b148..ebf5c53 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_responses.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/post_plant_batches_responses.go @@ -57,9 +57,8 @@ func (o *PostPlantBatchesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostPlantBatchesOK() *PostPlantBatchesOK { return &PostPlantBatchesOK{} } -/*PostPlantBatchesOK handles this case with default header values. +/* PostPlantBatchesOK describes a response with status code 200, with default header values. An array of Plant Batches records with the new IDs */ @@ -79,7 +78,6 @@ type PostPlantBatchesOK struct { func (o *PostPlantBatchesOK) Error() string { return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesOK %+v", 200, o.Payload) } - func (o *PostPlantBatchesOK) GetPayload() *metrc_gw_models.PlantBatchResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostPlantBatchesUnauthorized() *PostPlantBatchesUnauthorized { return &PostPlantBatchesUnauthorized{} } -/*PostPlantBatchesUnauthorized handles this case with default header values. +/* PostPlantBatchesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostPlantBatchesUnauthorized struct { func (o *PostPlantBatchesUnauthorized) Error() string { return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesUnauthorized %+v", 401, o.Payload) } - func (o *PostPlantBatchesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostPlantBatchesForbidden() *PostPlantBatchesForbidden { return &PostPlantBatchesForbidden{} } -/*PostPlantBatchesForbidden handles this case with default header values. +/* PostPlantBatchesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostPlantBatchesForbidden struct { func (o *PostPlantBatchesForbidden) Error() string { return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesForbidden %+v", 403, o.Payload) } - func (o *PostPlantBatchesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostPlantBatchesNotFound() *PostPlantBatchesNotFound { return &PostPlantBatchesNotFound{} } -/*PostPlantBatchesNotFound handles this case with default header values. +/* PostPlantBatchesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostPlantBatchesNotFound struct { func (o *PostPlantBatchesNotFound) Error() string { return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesNotFound %+v", 404, o.Payload) } - func (o *PostPlantBatchesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostPlantBatchesInternalServerError() *PostPlantBatchesInternalServerErr return &PostPlantBatchesInternalServerError{} } -/*PostPlantBatchesInternalServerError handles this case with default header values. +/* PostPlantBatchesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostPlantBatchesInternalServerError struct { func (o *PostPlantBatchesInternalServerError) Error() string { return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesInternalServerError %+v", 500, o.Payload) } - func (o *PostPlantBatchesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_parameters.go b/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_parameters.go index e0b6f3e..0756ed5 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutPlantBatchesParams creates a new PutPlantBatchesParams object -// with the default values initialized. +// NewPutPlantBatchesParams creates a new PutPlantBatchesParams 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 NewPutPlantBatchesParams() *PutPlantBatchesParams { - var () return &PutPlantBatchesParams{ - timeout: cr.DefaultTimeout, } } // NewPutPlantBatchesParamsWithTimeout creates a new PutPlantBatchesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutPlantBatchesParamsWithTimeout(timeout time.Duration) *PutPlantBatchesParams { - var () return &PutPlantBatchesParams{ - timeout: timeout, } } // NewPutPlantBatchesParamsWithContext creates a new PutPlantBatchesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutPlantBatchesParamsWithContext(ctx context.Context) *PutPlantBatchesParams { - var () return &PutPlantBatchesParams{ - Context: ctx, } } // NewPutPlantBatchesParamsWithHTTPClient creates a new PutPlantBatchesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutPlantBatchesParamsWithHTTPClient(client *http.Client) *PutPlantBatchesParams { - var () return &PutPlantBatchesParams{ HTTPClient: client, } } -/*PutPlantBatchesParams contains all the parameters to send to the API endpoint -for the put plant batches operation typically these are written to a http.Request +/* PutPlantBatchesParams contains all the parameters to send to the API endpoint + for the put plant batches operation. + + Typically these are written to a http.Request. */ type PutPlantBatchesParams struct { - /*PlantBatchRequest - The Existing Plant Batches with Ids + /* PlantBatchRequest. + The Existing Plant Batches with Ids */ PlantBatchRequest *metrc_gw_models.PlantBatchRequest @@ -77,6 +76,21 @@ type PutPlantBatchesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put plant batches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPlantBatchesParams) WithDefaults() *PutPlantBatchesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put plant batches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPlantBatchesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put plant batches params func (o *PutPlantBatchesParams) WithTimeout(timeout time.Duration) *PutPlantBatchesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutPlantBatchesParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.PlantBatchRequest != nil { if err := r.SetBodyParam(o.PlantBatchRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_responses.go b/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_responses.go index 94ed160..d75a3fc 100644 --- a/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_responses.go +++ b/api/metrc-gw/metrc_gw_client/plant_batches/put_plant_batches_responses.go @@ -57,9 +57,8 @@ func (o *PutPlantBatchesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutPlantBatchesOK() *PutPlantBatchesOK { return &PutPlantBatchesOK{} } -/*PutPlantBatchesOK handles this case with default header values. +/* PutPlantBatchesOK describes a response with status code 200, with default header values. An array of Plant Batches records */ @@ -79,7 +78,6 @@ type PutPlantBatchesOK struct { func (o *PutPlantBatchesOK) Error() string { return fmt.Sprintf("[PUT /plantbatches][%d] putPlantBatchesOK %+v", 200, o.Payload) } - func (o *PutPlantBatchesOK) GetPayload() *metrc_gw_models.PlantBatchResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutPlantBatchesUnauthorized() *PutPlantBatchesUnauthorized { return &PutPlantBatchesUnauthorized{} } -/*PutPlantBatchesUnauthorized handles this case with default header values. +/* PutPlantBatchesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutPlantBatchesUnauthorized struct { func (o *PutPlantBatchesUnauthorized) Error() string { return fmt.Sprintf("[PUT /plantbatches][%d] putPlantBatchesUnauthorized %+v", 401, o.Payload) } - func (o *PutPlantBatchesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutPlantBatchesForbidden() *PutPlantBatchesForbidden { return &PutPlantBatchesForbidden{} } -/*PutPlantBatchesForbidden handles this case with default header values. +/* PutPlantBatchesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutPlantBatchesForbidden struct { func (o *PutPlantBatchesForbidden) Error() string { return fmt.Sprintf("[PUT /plantbatches][%d] putPlantBatchesForbidden %+v", 403, o.Payload) } - func (o *PutPlantBatchesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutPlantBatchesNotFound() *PutPlantBatchesNotFound { return &PutPlantBatchesNotFound{} } -/*PutPlantBatchesNotFound handles this case with default header values. +/* PutPlantBatchesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutPlantBatchesNotFound struct { func (o *PutPlantBatchesNotFound) Error() string { return fmt.Sprintf("[PUT /plantbatches][%d] putPlantBatchesNotFound %+v", 404, o.Payload) } - func (o *PutPlantBatchesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutPlantBatchesInternalServerError() *PutPlantBatchesInternalServerError return &PutPlantBatchesInternalServerError{} } -/*PutPlantBatchesInternalServerError handles this case with default header values. +/* PutPlantBatchesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutPlantBatchesInternalServerError struct { func (o *PutPlantBatchesInternalServerError) Error() string { return fmt.Sprintf("[PUT /plantbatches][%d] putPlantBatchesInternalServerError %+v", 500, o.Payload) } - func (o *PutPlantBatchesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plants/delete_plant_parameters.go b/api/metrc-gw/metrc_gw_client/plants/delete_plant_parameters.go index cc52e4d..937a328 100644 --- a/api/metrc-gw/metrc_gw_client/plants/delete_plant_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plants/delete_plant_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewDeletePlantParams creates a new DeletePlantParams object -// with the default values initialized. +// NewDeletePlantParams creates a new DeletePlantParams 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 NewDeletePlantParams() *DeletePlantParams { - var () return &DeletePlantParams{ - timeout: cr.DefaultTimeout, } } // NewDeletePlantParamsWithTimeout creates a new DeletePlantParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeletePlantParamsWithTimeout(timeout time.Duration) *DeletePlantParams { - var () return &DeletePlantParams{ - timeout: timeout, } } // NewDeletePlantParamsWithContext creates a new DeletePlantParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeletePlantParamsWithContext(ctx context.Context) *DeletePlantParams { - var () return &DeletePlantParams{ - Context: ctx, } } // NewDeletePlantParamsWithHTTPClient creates a new DeletePlantParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeletePlantParamsWithHTTPClient(client *http.Client) *DeletePlantParams { - var () return &DeletePlantParams{ HTTPClient: client, } } -/*DeletePlantParams contains all the parameters to send to the API endpoint -for the delete plant operation typically these are written to a http.Request +/* DeletePlantParams contains all the parameters to send to the API endpoint + for the delete plant operation. + + Typically these are written to a http.Request. */ type DeletePlantParams struct { - /*ItemID - The Item Number + /* ItemID. + The Item Number */ ItemID float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type DeletePlantParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete plant params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePlantParams) WithDefaults() *DeletePlantParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete plant params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePlantParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete plant params func (o *DeletePlantParams) WithTimeout(timeout time.Duration) *DeletePlantParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *DeletePlantParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrItemID := o.ItemID qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } @@ -205,6 +224,7 @@ func (o *DeletePlantParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -214,6 +234,7 @@ func (o *DeletePlantParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -223,6 +244,7 @@ func (o *DeletePlantParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -232,6 +254,7 @@ func (o *DeletePlantParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/plants/delete_plant_responses.go b/api/metrc-gw/metrc_gw_client/plants/delete_plant_responses.go index 02808ef..fa673a6 100644 --- a/api/metrc-gw/metrc_gw_client/plants/delete_plant_responses.go +++ b/api/metrc-gw/metrc_gw_client/plants/delete_plant_responses.go @@ -57,9 +57,8 @@ func (o *DeletePlantReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeletePlantOK() *DeletePlantOK { return &DeletePlantOK{} } -/*DeletePlantOK handles this case with default header values. +/* DeletePlantOK describes a response with status code 200, with default header values. Plants were successfully Deleted */ @@ -79,7 +78,6 @@ type DeletePlantOK struct { func (o *DeletePlantOK) Error() string { return fmt.Sprintf("[DELETE /plants][%d] deletePlantOK %+v", 200, o.Payload) } - func (o *DeletePlantOK) GetPayload() *metrc_gw_models.PlantResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewDeletePlantUnauthorized() *DeletePlantUnauthorized { return &DeletePlantUnauthorized{} } -/*DeletePlantUnauthorized handles this case with default header values. +/* DeletePlantUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type DeletePlantUnauthorized struct { func (o *DeletePlantUnauthorized) Error() string { return fmt.Sprintf("[DELETE /plants][%d] deletePlantUnauthorized %+v", 401, o.Payload) } - func (o *DeletePlantUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewDeletePlantForbidden() *DeletePlantForbidden { return &DeletePlantForbidden{} } -/*DeletePlantForbidden handles this case with default header values. +/* DeletePlantForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type DeletePlantForbidden struct { func (o *DeletePlantForbidden) Error() string { return fmt.Sprintf("[DELETE /plants][%d] deletePlantForbidden %+v", 403, o.Payload) } - func (o *DeletePlantForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewDeletePlantNotFound() *DeletePlantNotFound { return &DeletePlantNotFound{} } -/*DeletePlantNotFound handles this case with default header values. +/* DeletePlantNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type DeletePlantNotFound struct { func (o *DeletePlantNotFound) Error() string { return fmt.Sprintf("[DELETE /plants][%d] deletePlantNotFound %+v", 404, o.Payload) } - func (o *DeletePlantNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewDeletePlantInternalServerError() *DeletePlantInternalServerError { return &DeletePlantInternalServerError{} } -/*DeletePlantInternalServerError handles this case with default header values. +/* DeletePlantInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type DeletePlantInternalServerError struct { func (o *DeletePlantInternalServerError) Error() string { return fmt.Sprintf("[DELETE /plants][%d] deletePlantInternalServerError %+v", 500, o.Payload) } - func (o *DeletePlantInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_parameters.go b/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_parameters.go index 4570c7d..8cac33e 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPlantGrowthPhasesParams creates a new GetPlantGrowthPhasesParams object -// with the default values initialized. +// NewGetPlantGrowthPhasesParams creates a new GetPlantGrowthPhasesParams 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 NewGetPlantGrowthPhasesParams() *GetPlantGrowthPhasesParams { - var () return &GetPlantGrowthPhasesParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlantGrowthPhasesParamsWithTimeout creates a new GetPlantGrowthPhasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlantGrowthPhasesParamsWithTimeout(timeout time.Duration) *GetPlantGrowthPhasesParams { - var () return &GetPlantGrowthPhasesParams{ - timeout: timeout, } } // NewGetPlantGrowthPhasesParamsWithContext creates a new GetPlantGrowthPhasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlantGrowthPhasesParamsWithContext(ctx context.Context) *GetPlantGrowthPhasesParams { - var () return &GetPlantGrowthPhasesParams{ - Context: ctx, } } // NewGetPlantGrowthPhasesParamsWithHTTPClient creates a new GetPlantGrowthPhasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlantGrowthPhasesParamsWithHTTPClient(client *http.Client) *GetPlantGrowthPhasesParams { - var () return &GetPlantGrowthPhasesParams{ HTTPClient: client, } } -/*GetPlantGrowthPhasesParams contains all the parameters to send to the API endpoint -for the get plant growth phases operation typically these are written to a http.Request +/* GetPlantGrowthPhasesParams contains all the parameters to send to the API endpoint + for the get plant growth phases operation. + + Typically these are written to a http.Request. */ type GetPlantGrowthPhasesParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type GetPlantGrowthPhasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get plant growth phases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantGrowthPhasesParams) WithDefaults() *GetPlantGrowthPhasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get plant growth phases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantGrowthPhasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get plant growth phases params func (o *GetPlantGrowthPhasesParams) WithTimeout(timeout time.Duration) *GetPlantGrowthPhasesParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *GetPlantGrowthPhasesParams) WriteToRequest(r runtime.ClientRequest, reg qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -205,22 +224,24 @@ func (o *GetPlantGrowthPhasesParams) WriteToRequest(r runtime.ClientRequest, reg // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -230,6 +251,7 @@ func (o *GetPlantGrowthPhasesParams) WriteToRequest(r runtime.ClientRequest, reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -239,6 +261,7 @@ func (o *GetPlantGrowthPhasesParams) WriteToRequest(r runtime.ClientRequest, reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_responses.go b/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_responses.go index 0e5167c..b4ea820 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_responses.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plant_growth_phases_responses.go @@ -57,9 +57,8 @@ func (o *GetPlantGrowthPhasesReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPlantGrowthPhasesOK() *GetPlantGrowthPhasesOK { return &GetPlantGrowthPhasesOK{} } -/*GetPlantGrowthPhasesOK handles this case with default header values. +/* GetPlantGrowthPhasesOK describes a response with status code 200, with default header values. Plant Growth Phases were successfully retrieved */ @@ -79,7 +78,6 @@ type GetPlantGrowthPhasesOK struct { func (o *GetPlantGrowthPhasesOK) Error() string { return fmt.Sprintf("[GET /plants/growthphases][%d] getPlantGrowthPhasesOK %+v", 200, o.Payload) } - func (o *GetPlantGrowthPhasesOK) GetPayload() *metrc_gw_models.PlantGrowthPhaseResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPlantGrowthPhasesUnauthorized() *GetPlantGrowthPhasesUnauthorized { return &GetPlantGrowthPhasesUnauthorized{} } -/*GetPlantGrowthPhasesUnauthorized handles this case with default header values. +/* GetPlantGrowthPhasesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPlantGrowthPhasesUnauthorized struct { func (o *GetPlantGrowthPhasesUnauthorized) Error() string { return fmt.Sprintf("[GET /plants/growthphases][%d] getPlantGrowthPhasesUnauthorized %+v", 401, o.Payload) } - func (o *GetPlantGrowthPhasesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPlantGrowthPhasesForbidden() *GetPlantGrowthPhasesForbidden { return &GetPlantGrowthPhasesForbidden{} } -/*GetPlantGrowthPhasesForbidden handles this case with default header values. +/* GetPlantGrowthPhasesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPlantGrowthPhasesForbidden struct { func (o *GetPlantGrowthPhasesForbidden) Error() string { return fmt.Sprintf("[GET /plants/growthphases][%d] getPlantGrowthPhasesForbidden %+v", 403, o.Payload) } - func (o *GetPlantGrowthPhasesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPlantGrowthPhasesNotFound() *GetPlantGrowthPhasesNotFound { return &GetPlantGrowthPhasesNotFound{} } -/*GetPlantGrowthPhasesNotFound handles this case with default header values. +/* GetPlantGrowthPhasesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPlantGrowthPhasesNotFound struct { func (o *GetPlantGrowthPhasesNotFound) Error() string { return fmt.Sprintf("[GET /plants/growthphases][%d] getPlantGrowthPhasesNotFound %+v", 404, o.Payload) } - func (o *GetPlantGrowthPhasesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPlantGrowthPhasesInternalServerError() *GetPlantGrowthPhasesInternalS return &GetPlantGrowthPhasesInternalServerError{} } -/*GetPlantGrowthPhasesInternalServerError handles this case with default header values. +/* GetPlantGrowthPhasesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPlantGrowthPhasesInternalServerError struct { func (o *GetPlantGrowthPhasesInternalServerError) Error() string { return fmt.Sprintf("[GET /plants/growthphases][%d] getPlantGrowthPhasesInternalServerError %+v", 500, o.Payload) } - func (o *GetPlantGrowthPhasesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_parameters.go b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_parameters.go index a6ec13a..fc044fc 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_parameters.go @@ -20,68 +20,70 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPlantWasteMethodsParams creates a new GetPlantWasteMethodsParams object -// with the default values initialized. +// NewGetPlantWasteMethodsParams creates a new GetPlantWasteMethodsParams 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 NewGetPlantWasteMethodsParams() *GetPlantWasteMethodsParams { - var () return &GetPlantWasteMethodsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlantWasteMethodsParamsWithTimeout creates a new GetPlantWasteMethodsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlantWasteMethodsParamsWithTimeout(timeout time.Duration) *GetPlantWasteMethodsParams { - var () return &GetPlantWasteMethodsParams{ - timeout: timeout, } } // NewGetPlantWasteMethodsParamsWithContext creates a new GetPlantWasteMethodsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlantWasteMethodsParamsWithContext(ctx context.Context) *GetPlantWasteMethodsParams { - var () return &GetPlantWasteMethodsParams{ - Context: ctx, } } // NewGetPlantWasteMethodsParamsWithHTTPClient creates a new GetPlantWasteMethodsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlantWasteMethodsParamsWithHTTPClient(client *http.Client) *GetPlantWasteMethodsParams { - var () return &GetPlantWasteMethodsParams{ HTTPClient: client, } } -/*GetPlantWasteMethodsParams contains all the parameters to send to the API endpoint -for the get plant waste methods operation typically these are written to a http.Request +/* GetPlantWasteMethodsParams contains all the parameters to send to the API endpoint + for the get plant waste methods operation. + + Typically these are written to a http.Request. */ type GetPlantWasteMethodsParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -90,6 +92,21 @@ type GetPlantWasteMethodsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get plant waste methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantWasteMethodsParams) WithDefaults() *GetPlantWasteMethodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get plant waste methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantWasteMethodsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get plant waste methods params func (o *GetPlantWasteMethodsParams) WithTimeout(timeout time.Duration) *GetPlantWasteMethodsParams { o.SetTimeout(timeout) @@ -179,6 +196,7 @@ func (o *GetPlantWasteMethodsParams) WriteToRequest(r runtime.ClientRequest, reg qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -188,6 +206,7 @@ func (o *GetPlantWasteMethodsParams) WriteToRequest(r runtime.ClientRequest, reg qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -197,6 +216,7 @@ func (o *GetPlantWasteMethodsParams) WriteToRequest(r runtime.ClientRequest, reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -206,6 +226,7 @@ func (o *GetPlantWasteMethodsParams) WriteToRequest(r runtime.ClientRequest, reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_responses.go b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_responses.go index a18524a..2569ab8 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_responses.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_methods_responses.go @@ -57,9 +57,8 @@ func (o *GetPlantWasteMethodsReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPlantWasteMethodsOK() *GetPlantWasteMethodsOK { return &GetPlantWasteMethodsOK{} } -/*GetPlantWasteMethodsOK handles this case with default header values. +/* GetPlantWasteMethodsOK describes a response with status code 200, with default header values. Plant Waste Methods were successfully retrieved */ @@ -79,7 +78,6 @@ type GetPlantWasteMethodsOK struct { func (o *GetPlantWasteMethodsOK) Error() string { return fmt.Sprintf("[GET /plants/wastemethods][%d] getPlantWasteMethodsOK %+v", 200, o.Payload) } - func (o *GetPlantWasteMethodsOK) GetPayload() *metrc_gw_models.PlantWasteMethodResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPlantWasteMethodsUnauthorized() *GetPlantWasteMethodsUnauthorized { return &GetPlantWasteMethodsUnauthorized{} } -/*GetPlantWasteMethodsUnauthorized handles this case with default header values. +/* GetPlantWasteMethodsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPlantWasteMethodsUnauthorized struct { func (o *GetPlantWasteMethodsUnauthorized) Error() string { return fmt.Sprintf("[GET /plants/wastemethods][%d] getPlantWasteMethodsUnauthorized %+v", 401, o.Payload) } - func (o *GetPlantWasteMethodsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPlantWasteMethodsForbidden() *GetPlantWasteMethodsForbidden { return &GetPlantWasteMethodsForbidden{} } -/*GetPlantWasteMethodsForbidden handles this case with default header values. +/* GetPlantWasteMethodsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPlantWasteMethodsForbidden struct { func (o *GetPlantWasteMethodsForbidden) Error() string { return fmt.Sprintf("[GET /plants/wastemethods][%d] getPlantWasteMethodsForbidden %+v", 403, o.Payload) } - func (o *GetPlantWasteMethodsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPlantWasteMethodsNotFound() *GetPlantWasteMethodsNotFound { return &GetPlantWasteMethodsNotFound{} } -/*GetPlantWasteMethodsNotFound handles this case with default header values. +/* GetPlantWasteMethodsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPlantWasteMethodsNotFound struct { func (o *GetPlantWasteMethodsNotFound) Error() string { return fmt.Sprintf("[GET /plants/wastemethods][%d] getPlantWasteMethodsNotFound %+v", 404, o.Payload) } - func (o *GetPlantWasteMethodsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPlantWasteMethodsInternalServerError() *GetPlantWasteMethodsInternalS return &GetPlantWasteMethodsInternalServerError{} } -/*GetPlantWasteMethodsInternalServerError handles this case with default header values. +/* GetPlantWasteMethodsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPlantWasteMethodsInternalServerError struct { func (o *GetPlantWasteMethodsInternalServerError) Error() string { return fmt.Sprintf("[GET /plants/wastemethods][%d] getPlantWasteMethodsInternalServerError %+v", 500, o.Payload) } - func (o *GetPlantWasteMethodsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_parameters.go b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_parameters.go index e76deb2..ff74c66 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_parameters.go @@ -20,68 +20,70 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPlantWasteReasonsParams creates a new GetPlantWasteReasonsParams object -// with the default values initialized. +// NewGetPlantWasteReasonsParams creates a new GetPlantWasteReasonsParams 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 NewGetPlantWasteReasonsParams() *GetPlantWasteReasonsParams { - var () return &GetPlantWasteReasonsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlantWasteReasonsParamsWithTimeout creates a new GetPlantWasteReasonsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlantWasteReasonsParamsWithTimeout(timeout time.Duration) *GetPlantWasteReasonsParams { - var () return &GetPlantWasteReasonsParams{ - timeout: timeout, } } // NewGetPlantWasteReasonsParamsWithContext creates a new GetPlantWasteReasonsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlantWasteReasonsParamsWithContext(ctx context.Context) *GetPlantWasteReasonsParams { - var () return &GetPlantWasteReasonsParams{ - Context: ctx, } } // NewGetPlantWasteReasonsParamsWithHTTPClient creates a new GetPlantWasteReasonsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlantWasteReasonsParamsWithHTTPClient(client *http.Client) *GetPlantWasteReasonsParams { - var () return &GetPlantWasteReasonsParams{ HTTPClient: client, } } -/*GetPlantWasteReasonsParams contains all the parameters to send to the API endpoint -for the get plant waste reasons operation typically these are written to a http.Request +/* GetPlantWasteReasonsParams contains all the parameters to send to the API endpoint + for the get plant waste reasons operation. + + Typically these are written to a http.Request. */ type GetPlantWasteReasonsParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -90,6 +92,21 @@ type GetPlantWasteReasonsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get plant waste reasons params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantWasteReasonsParams) WithDefaults() *GetPlantWasteReasonsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get plant waste reasons params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantWasteReasonsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get plant waste reasons params func (o *GetPlantWasteReasonsParams) WithTimeout(timeout time.Duration) *GetPlantWasteReasonsParams { o.SetTimeout(timeout) @@ -179,6 +196,7 @@ func (o *GetPlantWasteReasonsParams) WriteToRequest(r runtime.ClientRequest, reg qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -188,6 +206,7 @@ func (o *GetPlantWasteReasonsParams) WriteToRequest(r runtime.ClientRequest, reg qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -197,6 +216,7 @@ func (o *GetPlantWasteReasonsParams) WriteToRequest(r runtime.ClientRequest, reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -206,6 +226,7 @@ func (o *GetPlantWasteReasonsParams) WriteToRequest(r runtime.ClientRequest, reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_responses.go b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_responses.go index 6912069..81da588 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_responses.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plant_waste_reasons_responses.go @@ -57,9 +57,8 @@ func (o *GetPlantWasteReasonsReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPlantWasteReasonsOK() *GetPlantWasteReasonsOK { return &GetPlantWasteReasonsOK{} } -/*GetPlantWasteReasonsOK handles this case with default header values. +/* GetPlantWasteReasonsOK describes a response with status code 200, with default header values. Plant Waste Reasons were successfully retrieved */ @@ -79,7 +78,6 @@ type GetPlantWasteReasonsOK struct { func (o *GetPlantWasteReasonsOK) Error() string { return fmt.Sprintf("[GET /plants/wastereasons][%d] getPlantWasteReasonsOK %+v", 200, o.Payload) } - func (o *GetPlantWasteReasonsOK) GetPayload() *metrc_gw_models.PlantWasteReasonResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPlantWasteReasonsUnauthorized() *GetPlantWasteReasonsUnauthorized { return &GetPlantWasteReasonsUnauthorized{} } -/*GetPlantWasteReasonsUnauthorized handles this case with default header values. +/* GetPlantWasteReasonsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPlantWasteReasonsUnauthorized struct { func (o *GetPlantWasteReasonsUnauthorized) Error() string { return fmt.Sprintf("[GET /plants/wastereasons][%d] getPlantWasteReasonsUnauthorized %+v", 401, o.Payload) } - func (o *GetPlantWasteReasonsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPlantWasteReasonsForbidden() *GetPlantWasteReasonsForbidden { return &GetPlantWasteReasonsForbidden{} } -/*GetPlantWasteReasonsForbidden handles this case with default header values. +/* GetPlantWasteReasonsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPlantWasteReasonsForbidden struct { func (o *GetPlantWasteReasonsForbidden) Error() string { return fmt.Sprintf("[GET /plants/wastereasons][%d] getPlantWasteReasonsForbidden %+v", 403, o.Payload) } - func (o *GetPlantWasteReasonsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPlantWasteReasonsNotFound() *GetPlantWasteReasonsNotFound { return &GetPlantWasteReasonsNotFound{} } -/*GetPlantWasteReasonsNotFound handles this case with default header values. +/* GetPlantWasteReasonsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPlantWasteReasonsNotFound struct { func (o *GetPlantWasteReasonsNotFound) Error() string { return fmt.Sprintf("[GET /plants/wastereasons][%d] getPlantWasteReasonsNotFound %+v", 404, o.Payload) } - func (o *GetPlantWasteReasonsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPlantWasteReasonsInternalServerError() *GetPlantWasteReasonsInternalS return &GetPlantWasteReasonsInternalServerError{} } -/*GetPlantWasteReasonsInternalServerError handles this case with default header values. +/* GetPlantWasteReasonsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPlantWasteReasonsInternalServerError struct { func (o *GetPlantWasteReasonsInternalServerError) Error() string { return fmt.Sprintf("[GET /plants/wastereasons][%d] getPlantWasteReasonsInternalServerError %+v", 500, o.Payload) } - func (o *GetPlantWasteReasonsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plants_parameters.go b/api/metrc-gw/metrc_gw_client/plants/get_plants_parameters.go index 07417c0..387aaf3 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plants_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plants_parameters.go @@ -21,83 +21,88 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPlantsParams creates a new GetPlantsParams object -// with the default values initialized. +// NewGetPlantsParams creates a new GetPlantsParams 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 NewGetPlantsParams() *GetPlantsParams { - var () return &GetPlantsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlantsParamsWithTimeout creates a new GetPlantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlantsParamsWithTimeout(timeout time.Duration) *GetPlantsParams { - var () return &GetPlantsParams{ - timeout: timeout, } } // NewGetPlantsParamsWithContext creates a new GetPlantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlantsParamsWithContext(ctx context.Context) *GetPlantsParams { - var () return &GetPlantsParams{ - Context: ctx, } } // NewGetPlantsParamsWithHTTPClient creates a new GetPlantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlantsParamsWithHTTPClient(client *http.Client) *GetPlantsParams { - var () return &GetPlantsParams{ HTTPClient: client, } } -/*GetPlantsParams contains all the parameters to send to the API endpoint -for the get plants operation typically these are written to a http.Request +/* GetPlantsParams contains all the parameters to send to the API endpoint + for the get plants operation. + + Typically these are written to a http.Request. */ type GetPlantsParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -106,6 +111,21 @@ type GetPlantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get plants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantsParams) WithDefaults() *GetPlantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get plants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get plants params func (o *GetPlantsParams) WithTimeout(timeout time.Duration) *GetPlantsParams { o.SetTimeout(timeout) @@ -228,38 +248,41 @@ func (o *GetPlantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -269,22 +292,24 @@ func (o *GetPlantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -294,6 +319,7 @@ func (o *GetPlantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -303,6 +329,7 @@ func (o *GetPlantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/plants/get_plants_responses.go b/api/metrc-gw/metrc_gw_client/plants/get_plants_responses.go index 305231b..ac9a197 100644 --- a/api/metrc-gw/metrc_gw_client/plants/get_plants_responses.go +++ b/api/metrc-gw/metrc_gw_client/plants/get_plants_responses.go @@ -57,9 +57,8 @@ func (o *GetPlantsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetPlantsOK() *GetPlantsOK { return &GetPlantsOK{} } -/*GetPlantsOK handles this case with default header values. +/* GetPlantsOK describes a response with status code 200, with default header values. Plants were successfully retrieved */ @@ -79,7 +78,6 @@ type GetPlantsOK struct { func (o *GetPlantsOK) Error() string { return fmt.Sprintf("[GET /plants][%d] getPlantsOK %+v", 200, o.Payload) } - func (o *GetPlantsOK) GetPayload() *metrc_gw_models.PlantResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetPlantsUnauthorized() *GetPlantsUnauthorized { return &GetPlantsUnauthorized{} } -/*GetPlantsUnauthorized handles this case with default header values. +/* GetPlantsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetPlantsUnauthorized struct { func (o *GetPlantsUnauthorized) Error() string { return fmt.Sprintf("[GET /plants][%d] getPlantsUnauthorized %+v", 401, o.Payload) } - func (o *GetPlantsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetPlantsForbidden() *GetPlantsForbidden { return &GetPlantsForbidden{} } -/*GetPlantsForbidden handles this case with default header values. +/* GetPlantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetPlantsForbidden struct { func (o *GetPlantsForbidden) Error() string { return fmt.Sprintf("[GET /plants][%d] getPlantsForbidden %+v", 403, o.Payload) } - func (o *GetPlantsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetPlantsNotFound() *GetPlantsNotFound { return &GetPlantsNotFound{} } -/*GetPlantsNotFound handles this case with default header values. +/* GetPlantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetPlantsNotFound struct { func (o *GetPlantsNotFound) Error() string { return fmt.Sprintf("[GET /plants][%d] getPlantsNotFound %+v", 404, o.Payload) } - func (o *GetPlantsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetPlantsInternalServerError() *GetPlantsInternalServerError { return &GetPlantsInternalServerError{} } -/*GetPlantsInternalServerError handles this case with default header values. +/* GetPlantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetPlantsInternalServerError struct { func (o *GetPlantsInternalServerError) Error() string { return fmt.Sprintf("[GET /plants][%d] getPlantsInternalServerError %+v", 500, o.Payload) } - func (o *GetPlantsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plants/plants_client.go b/api/metrc-gw/metrc_gw_client/plants/plants_client.go index 5de0d06..7f7d9a6 100644 --- a/api/metrc-gw/metrc_gw_client/plants/plants_client.go +++ b/api/metrc-gw/metrc_gw_client/plants/plants_client.go @@ -29,21 +29,24 @@ type Client struct { 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 { - DeletePlant(params *DeletePlantParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePlantOK, error) + DeletePlant(params *DeletePlantParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePlantOK, error) - GetPlantGrowthPhases(params *GetPlantGrowthPhasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantGrowthPhasesOK, error) + GetPlantGrowthPhases(params *GetPlantGrowthPhasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantGrowthPhasesOK, error) - GetPlantWasteMethods(params *GetPlantWasteMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantWasteMethodsOK, error) + GetPlantWasteMethods(params *GetPlantWasteMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantWasteMethodsOK, error) - GetPlantWasteReasons(params *GetPlantWasteReasonsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantWasteReasonsOK, error) + GetPlantWasteReasons(params *GetPlantWasteReasonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantWasteReasonsOK, error) - GetPlants(params *GetPlantsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantsOK, error) + GetPlants(params *GetPlantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantsOK, error) - PostPlants(params *PostPlantsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlantsOK, error) + PostPlants(params *PostPlantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPlantsOK, error) - PutPlants(params *PutPlantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutPlantsOK, error) + PutPlants(params *PutPlantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPlantsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -54,13 +57,12 @@ type ClientService interface { Delete a plant for this User-License */ -func (a *Client) DeletePlant(params *DeletePlantParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePlantOK, error) { +func (a *Client) DeletePlant(params *DeletePlantParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePlantOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeletePlantParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deletePlant", Method: "DELETE", PathPattern: "/plants", @@ -72,7 +74,12 @@ func (a *Client) DeletePlant(params *DeletePlantParams, authInfo runtime.ClientA 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 } @@ -91,13 +98,12 @@ func (a *Client) DeletePlant(params *DeletePlantParams, authInfo runtime.ClientA Get available Plant Growth Phases for this User-License */ -func (a *Client) GetPlantGrowthPhases(params *GetPlantGrowthPhasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantGrowthPhasesOK, error) { +func (a *Client) GetPlantGrowthPhases(params *GetPlantGrowthPhasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantGrowthPhasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlantGrowthPhasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlantGrowthPhases", Method: "GET", PathPattern: "/plants/growthphases", @@ -109,7 +115,12 @@ func (a *Client) GetPlantGrowthPhases(params *GetPlantGrowthPhasesParams, authIn 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 } @@ -128,13 +139,12 @@ func (a *Client) GetPlantGrowthPhases(params *GetPlantGrowthPhasesParams, authIn Get available Plant Waste Methods for this User-License */ -func (a *Client) GetPlantWasteMethods(params *GetPlantWasteMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantWasteMethodsOK, error) { +func (a *Client) GetPlantWasteMethods(params *GetPlantWasteMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantWasteMethodsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlantWasteMethodsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlantWasteMethods", Method: "GET", PathPattern: "/plants/wastemethods", @@ -146,7 +156,12 @@ func (a *Client) GetPlantWasteMethods(params *GetPlantWasteMethodsParams, authIn 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 } @@ -165,13 +180,12 @@ func (a *Client) GetPlantWasteMethods(params *GetPlantWasteMethodsParams, authIn Get available Plant Waste Reasons for this User-License */ -func (a *Client) GetPlantWasteReasons(params *GetPlantWasteReasonsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantWasteReasonsOK, error) { +func (a *Client) GetPlantWasteReasons(params *GetPlantWasteReasonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantWasteReasonsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlantWasteReasonsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlantWasteReasons", Method: "GET", PathPattern: "/plants/wastereasons", @@ -183,7 +197,12 @@ func (a *Client) GetPlantWasteReasons(params *GetPlantWasteReasonsParams, authIn 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 } @@ -203,13 +222,12 @@ func (a *Client) GetPlantWasteReasons(params *GetPlantWasteReasonsParams, authIn Get Plants for this User-License */ -func (a *Client) GetPlants(params *GetPlantsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantsOK, error) { +func (a *Client) GetPlants(params *GetPlantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlants", Method: "GET", PathPattern: "/plants", @@ -221,7 +239,12 @@ func (a *Client) GetPlants(params *GetPlantsParams, authInfo runtime.ClientAuthI 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 } @@ -240,13 +263,12 @@ func (a *Client) GetPlants(params *GetPlantsParams, authInfo runtime.ClientAuthI Create new Plants */ -func (a *Client) PostPlants(params *PostPlantsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlantsOK, error) { +func (a *Client) PostPlants(params *PostPlantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPlantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPlantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPlants", Method: "POST", PathPattern: "/plants", @@ -258,7 +280,12 @@ func (a *Client) PostPlants(params *PostPlantsParams, authInfo runtime.ClientAut 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 } @@ -277,13 +304,12 @@ func (a *Client) PostPlants(params *PostPlantsParams, authInfo runtime.ClientAut Update existing Plants */ -func (a *Client) PutPlants(params *PutPlantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutPlantsOK, error) { +func (a *Client) PutPlants(params *PutPlantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPlantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutPlantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putPlants", Method: "PUT", PathPattern: "/plants", @@ -295,7 +321,12 @@ func (a *Client) PutPlants(params *PutPlantsParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/metrc-gw/metrc_gw_client/plants/post_plants_parameters.go b/api/metrc-gw/metrc_gw_client/plants/post_plants_parameters.go index 72d0baf..b71d539 100644 --- a/api/metrc-gw/metrc_gw_client/plants/post_plants_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plants/post_plants_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostPlantsParams creates a new PostPlantsParams object -// with the default values initialized. +// NewPostPlantsParams creates a new PostPlantsParams 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 NewPostPlantsParams() *PostPlantsParams { - var () return &PostPlantsParams{ - timeout: cr.DefaultTimeout, } } // NewPostPlantsParamsWithTimeout creates a new PostPlantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPlantsParamsWithTimeout(timeout time.Duration) *PostPlantsParams { - var () return &PostPlantsParams{ - timeout: timeout, } } // NewPostPlantsParamsWithContext creates a new PostPlantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPlantsParamsWithContext(ctx context.Context) *PostPlantsParams { - var () return &PostPlantsParams{ - Context: ctx, } } // NewPostPlantsParamsWithHTTPClient creates a new PostPlantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPlantsParamsWithHTTPClient(client *http.Client) *PostPlantsParams { - var () return &PostPlantsParams{ HTTPClient: client, } } -/*PostPlantsParams contains all the parameters to send to the API endpoint -for the post plants operation typically these are written to a http.Request +/* PostPlantsParams contains all the parameters to send to the API endpoint + for the post plants operation. + + Typically these are written to a http.Request. */ type PostPlantsParams struct { - /*PlantRequest - The New Plants + /* PlantRequest. + The New Plants */ PlantRequest *metrc_gw_models.PlantRequest @@ -77,6 +76,21 @@ type PostPlantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post plants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPlantsParams) WithDefaults() *PostPlantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post plants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPlantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post plants params func (o *PostPlantsParams) WithTimeout(timeout time.Duration) *PostPlantsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPlantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.PlantRequest != nil { if err := r.SetBodyParam(o.PlantRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/plants/post_plants_responses.go b/api/metrc-gw/metrc_gw_client/plants/post_plants_responses.go index c20ef91..62120b9 100644 --- a/api/metrc-gw/metrc_gw_client/plants/post_plants_responses.go +++ b/api/metrc-gw/metrc_gw_client/plants/post_plants_responses.go @@ -57,9 +57,8 @@ func (o *PostPlantsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostPlantsOK() *PostPlantsOK { return &PostPlantsOK{} } -/*PostPlantsOK handles this case with default header values. +/* PostPlantsOK describes a response with status code 200, with default header values. An array of Plants records with the new IDs */ @@ -79,7 +78,6 @@ type PostPlantsOK struct { func (o *PostPlantsOK) Error() string { return fmt.Sprintf("[POST /plants][%d] postPlantsOK %+v", 200, o.Payload) } - func (o *PostPlantsOK) GetPayload() *metrc_gw_models.PlantResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostPlantsUnauthorized() *PostPlantsUnauthorized { return &PostPlantsUnauthorized{} } -/*PostPlantsUnauthorized handles this case with default header values. +/* PostPlantsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostPlantsUnauthorized struct { func (o *PostPlantsUnauthorized) Error() string { return fmt.Sprintf("[POST /plants][%d] postPlantsUnauthorized %+v", 401, o.Payload) } - func (o *PostPlantsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostPlantsForbidden() *PostPlantsForbidden { return &PostPlantsForbidden{} } -/*PostPlantsForbidden handles this case with default header values. +/* PostPlantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostPlantsForbidden struct { func (o *PostPlantsForbidden) Error() string { return fmt.Sprintf("[POST /plants][%d] postPlantsForbidden %+v", 403, o.Payload) } - func (o *PostPlantsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostPlantsNotFound() *PostPlantsNotFound { return &PostPlantsNotFound{} } -/*PostPlantsNotFound handles this case with default header values. +/* PostPlantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostPlantsNotFound struct { func (o *PostPlantsNotFound) Error() string { return fmt.Sprintf("[POST /plants][%d] postPlantsNotFound %+v", 404, o.Payload) } - func (o *PostPlantsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostPlantsInternalServerError() *PostPlantsInternalServerError { return &PostPlantsInternalServerError{} } -/*PostPlantsInternalServerError handles this case with default header values. +/* PostPlantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostPlantsInternalServerError struct { func (o *PostPlantsInternalServerError) Error() string { return fmt.Sprintf("[POST /plants][%d] postPlantsInternalServerError %+v", 500, o.Payload) } - func (o *PostPlantsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/plants/put_plants_parameters.go b/api/metrc-gw/metrc_gw_client/plants/put_plants_parameters.go index c109bde..0abfc82 100644 --- a/api/metrc-gw/metrc_gw_client/plants/put_plants_parameters.go +++ b/api/metrc-gw/metrc_gw_client/plants/put_plants_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutPlantsParams creates a new PutPlantsParams object -// with the default values initialized. +// NewPutPlantsParams creates a new PutPlantsParams 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 NewPutPlantsParams() *PutPlantsParams { - var () return &PutPlantsParams{ - timeout: cr.DefaultTimeout, } } // NewPutPlantsParamsWithTimeout creates a new PutPlantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutPlantsParamsWithTimeout(timeout time.Duration) *PutPlantsParams { - var () return &PutPlantsParams{ - timeout: timeout, } } // NewPutPlantsParamsWithContext creates a new PutPlantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutPlantsParamsWithContext(ctx context.Context) *PutPlantsParams { - var () return &PutPlantsParams{ - Context: ctx, } } // NewPutPlantsParamsWithHTTPClient creates a new PutPlantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutPlantsParamsWithHTTPClient(client *http.Client) *PutPlantsParams { - var () return &PutPlantsParams{ HTTPClient: client, } } -/*PutPlantsParams contains all the parameters to send to the API endpoint -for the put plants operation typically these are written to a http.Request +/* PutPlantsParams contains all the parameters to send to the API endpoint + for the put plants operation. + + Typically these are written to a http.Request. */ type PutPlantsParams struct { - /*PlantRequest - The Existing Plants with Ids + /* PlantRequest. + The Existing Plants with Ids */ PlantRequest *metrc_gw_models.PlantRequest @@ -77,6 +76,21 @@ type PutPlantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put plants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPlantsParams) WithDefaults() *PutPlantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put plants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPlantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put plants params func (o *PutPlantsParams) WithTimeout(timeout time.Duration) *PutPlantsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutPlantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.PlantRequest != nil { if err := r.SetBodyParam(o.PlantRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/plants/put_plants_responses.go b/api/metrc-gw/metrc_gw_client/plants/put_plants_responses.go index 8d45dbd..138cf69 100644 --- a/api/metrc-gw/metrc_gw_client/plants/put_plants_responses.go +++ b/api/metrc-gw/metrc_gw_client/plants/put_plants_responses.go @@ -57,9 +57,8 @@ func (o *PutPlantsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutPlantsOK() *PutPlantsOK { return &PutPlantsOK{} } -/*PutPlantsOK handles this case with default header values. +/* PutPlantsOK describes a response with status code 200, with default header values. An array of Plants records */ @@ -79,7 +78,6 @@ type PutPlantsOK struct { func (o *PutPlantsOK) Error() string { return fmt.Sprintf("[PUT /plants][%d] putPlantsOK %+v", 200, o.Payload) } - func (o *PutPlantsOK) GetPayload() *metrc_gw_models.PlantResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutPlantsUnauthorized() *PutPlantsUnauthorized { return &PutPlantsUnauthorized{} } -/*PutPlantsUnauthorized handles this case with default header values. +/* PutPlantsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutPlantsUnauthorized struct { func (o *PutPlantsUnauthorized) Error() string { return fmt.Sprintf("[PUT /plants][%d] putPlantsUnauthorized %+v", 401, o.Payload) } - func (o *PutPlantsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutPlantsForbidden() *PutPlantsForbidden { return &PutPlantsForbidden{} } -/*PutPlantsForbidden handles this case with default header values. +/* PutPlantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutPlantsForbidden struct { func (o *PutPlantsForbidden) Error() string { return fmt.Sprintf("[PUT /plants][%d] putPlantsForbidden %+v", 403, o.Payload) } - func (o *PutPlantsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutPlantsNotFound() *PutPlantsNotFound { return &PutPlantsNotFound{} } -/*PutPlantsNotFound handles this case with default header values. +/* PutPlantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutPlantsNotFound struct { func (o *PutPlantsNotFound) Error() string { return fmt.Sprintf("[PUT /plants][%d] putPlantsNotFound %+v", 404, o.Payload) } - func (o *PutPlantsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutPlantsInternalServerError() *PutPlantsInternalServerError { return &PutPlantsInternalServerError{} } -/*PutPlantsInternalServerError handles this case with default header values. +/* PutPlantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutPlantsInternalServerError struct { func (o *PutPlantsInternalServerError) Error() string { return fmt.Sprintf("[PUT /plants][%d] putPlantsInternalServerError %+v", 500, o.Payload) } - func (o *PutPlantsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/rooms/delete_room_parameters.go b/api/metrc-gw/metrc_gw_client/rooms/delete_room_parameters.go index 83bcac0..9c85468 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/delete_room_parameters.go +++ b/api/metrc-gw/metrc_gw_client/rooms/delete_room_parameters.go @@ -20,73 +20,76 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteRoomParams creates a new DeleteRoomParams object -// with the default values initialized. +// NewDeleteRoomParams creates a new DeleteRoomParams 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 NewDeleteRoomParams() *DeleteRoomParams { - var () return &DeleteRoomParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteRoomParamsWithTimeout creates a new DeleteRoomParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteRoomParamsWithTimeout(timeout time.Duration) *DeleteRoomParams { - var () return &DeleteRoomParams{ - timeout: timeout, } } // NewDeleteRoomParamsWithContext creates a new DeleteRoomParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteRoomParamsWithContext(ctx context.Context) *DeleteRoomParams { - var () return &DeleteRoomParams{ - Context: ctx, } } // NewDeleteRoomParamsWithHTTPClient creates a new DeleteRoomParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteRoomParamsWithHTTPClient(client *http.Client) *DeleteRoomParams { - var () return &DeleteRoomParams{ HTTPClient: client, } } -/*DeleteRoomParams contains all the parameters to send to the API endpoint -for the delete room operation typically these are written to a http.Request +/* DeleteRoomParams contains all the parameters to send to the API endpoint + for the delete room operation. + + Typically these are written to a http.Request. */ type DeleteRoomParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*RoomNumber - The Room ID number + /* RoomNumber. + + The Room ID number */ RoomNumber string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -95,6 +98,21 @@ type DeleteRoomParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete room params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRoomParams) WithDefaults() *DeleteRoomParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete room params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRoomParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete room params func (o *DeleteRoomParams) WithTimeout(timeout time.Duration) *DeleteRoomParams { o.SetTimeout(timeout) @@ -195,6 +213,7 @@ func (o *DeleteRoomParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -204,6 +223,7 @@ func (o *DeleteRoomParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -213,6 +233,7 @@ func (o *DeleteRoomParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrRoomNumber := o.RoomNumber qRoomNumber := qrRoomNumber if qRoomNumber != "" { + if err := r.SetQueryParam("roomNumber", qRoomNumber); err != nil { return err } @@ -222,6 +243,7 @@ func (o *DeleteRoomParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -231,6 +253,7 @@ func (o *DeleteRoomParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/rooms/delete_room_responses.go b/api/metrc-gw/metrc_gw_client/rooms/delete_room_responses.go index 0631865..35f1202 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/delete_room_responses.go +++ b/api/metrc-gw/metrc_gw_client/rooms/delete_room_responses.go @@ -57,9 +57,8 @@ func (o *DeleteRoomReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeleteRoomOK() *DeleteRoomOK { return &DeleteRoomOK{} } -/*DeleteRoomOK handles this case with default header values. +/* DeleteRoomOK describes a response with status code 200, with default header values. Rooms were successfully deleted */ @@ -79,7 +78,6 @@ type DeleteRoomOK struct { func (o *DeleteRoomOK) Error() string { return fmt.Sprintf("[DELETE /rooms][%d] deleteRoomOK %+v", 200, o.Payload) } - func (o *DeleteRoomOK) GetPayload() *metrc_gw_models.RoomResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewDeleteRoomUnauthorized() *DeleteRoomUnauthorized { return &DeleteRoomUnauthorized{} } -/*DeleteRoomUnauthorized handles this case with default header values. +/* DeleteRoomUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type DeleteRoomUnauthorized struct { func (o *DeleteRoomUnauthorized) Error() string { return fmt.Sprintf("[DELETE /rooms][%d] deleteRoomUnauthorized %+v", 401, o.Payload) } - func (o *DeleteRoomUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewDeleteRoomForbidden() *DeleteRoomForbidden { return &DeleteRoomForbidden{} } -/*DeleteRoomForbidden handles this case with default header values. +/* DeleteRoomForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type DeleteRoomForbidden struct { func (o *DeleteRoomForbidden) Error() string { return fmt.Sprintf("[DELETE /rooms][%d] deleteRoomForbidden %+v", 403, o.Payload) } - func (o *DeleteRoomForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewDeleteRoomNotFound() *DeleteRoomNotFound { return &DeleteRoomNotFound{} } -/*DeleteRoomNotFound handles this case with default header values. +/* DeleteRoomNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type DeleteRoomNotFound struct { func (o *DeleteRoomNotFound) Error() string { return fmt.Sprintf("[DELETE /rooms][%d] deleteRoomNotFound %+v", 404, o.Payload) } - func (o *DeleteRoomNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewDeleteRoomInternalServerError() *DeleteRoomInternalServerError { return &DeleteRoomInternalServerError{} } -/*DeleteRoomInternalServerError handles this case with default header values. +/* DeleteRoomInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type DeleteRoomInternalServerError struct { func (o *DeleteRoomInternalServerError) Error() string { return fmt.Sprintf("[DELETE /rooms][%d] deleteRoomInternalServerError %+v", 500, o.Payload) } - func (o *DeleteRoomInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/rooms/get_rooms_parameters.go b/api/metrc-gw/metrc_gw_client/rooms/get_rooms_parameters.go index 6896f14..c3aacb9 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/get_rooms_parameters.go +++ b/api/metrc-gw/metrc_gw_client/rooms/get_rooms_parameters.go @@ -21,83 +21,88 @@ import ( "github.com/go-openapi/swag" ) -// NewGetRoomsParams creates a new GetRoomsParams object -// with the default values initialized. +// NewGetRoomsParams creates a new GetRoomsParams 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 NewGetRoomsParams() *GetRoomsParams { - var () return &GetRoomsParams{ - timeout: cr.DefaultTimeout, } } // NewGetRoomsParamsWithTimeout creates a new GetRoomsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetRoomsParamsWithTimeout(timeout time.Duration) *GetRoomsParams { - var () return &GetRoomsParams{ - timeout: timeout, } } // NewGetRoomsParamsWithContext creates a new GetRoomsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetRoomsParamsWithContext(ctx context.Context) *GetRoomsParams { - var () return &GetRoomsParams{ - Context: ctx, } } // NewGetRoomsParamsWithHTTPClient creates a new GetRoomsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetRoomsParamsWithHTTPClient(client *http.Client) *GetRoomsParams { - var () return &GetRoomsParams{ HTTPClient: client, } } -/*GetRoomsParams contains all the parameters to send to the API endpoint -for the get rooms operation typically these are written to a http.Request +/* GetRoomsParams contains all the parameters to send to the API endpoint + for the get rooms operation. + + Typically these are written to a http.Request. */ type GetRoomsParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -106,6 +111,21 @@ type GetRoomsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get rooms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRoomsParams) WithDefaults() *GetRoomsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get rooms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRoomsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get rooms params func (o *GetRoomsParams) WithTimeout(timeout time.Duration) *GetRoomsParams { o.SetTimeout(timeout) @@ -228,38 +248,41 @@ func (o *GetRoomsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -269,22 +292,24 @@ func (o *GetRoomsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -294,6 +319,7 @@ func (o *GetRoomsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -303,6 +329,7 @@ func (o *GetRoomsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/rooms/get_rooms_responses.go b/api/metrc-gw/metrc_gw_client/rooms/get_rooms_responses.go index 2a316ee..80bd0df 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/get_rooms_responses.go +++ b/api/metrc-gw/metrc_gw_client/rooms/get_rooms_responses.go @@ -57,9 +57,8 @@ func (o *GetRoomsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetRoomsOK() *GetRoomsOK { return &GetRoomsOK{} } -/*GetRoomsOK handles this case with default header values. +/* GetRoomsOK describes a response with status code 200, with default header values. Rooms were successfully retrieved */ @@ -79,7 +78,6 @@ type GetRoomsOK struct { func (o *GetRoomsOK) Error() string { return fmt.Sprintf("[GET /rooms][%d] getRoomsOK %+v", 200, o.Payload) } - func (o *GetRoomsOK) GetPayload() *metrc_gw_models.RoomResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetRoomsUnauthorized() *GetRoomsUnauthorized { return &GetRoomsUnauthorized{} } -/*GetRoomsUnauthorized handles this case with default header values. +/* GetRoomsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetRoomsUnauthorized struct { func (o *GetRoomsUnauthorized) Error() string { return fmt.Sprintf("[GET /rooms][%d] getRoomsUnauthorized %+v", 401, o.Payload) } - func (o *GetRoomsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetRoomsForbidden() *GetRoomsForbidden { return &GetRoomsForbidden{} } -/*GetRoomsForbidden handles this case with default header values. +/* GetRoomsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetRoomsForbidden struct { func (o *GetRoomsForbidden) Error() string { return fmt.Sprintf("[GET /rooms][%d] getRoomsForbidden %+v", 403, o.Payload) } - func (o *GetRoomsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetRoomsNotFound() *GetRoomsNotFound { return &GetRoomsNotFound{} } -/*GetRoomsNotFound handles this case with default header values. +/* GetRoomsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetRoomsNotFound struct { func (o *GetRoomsNotFound) Error() string { return fmt.Sprintf("[GET /rooms][%d] getRoomsNotFound %+v", 404, o.Payload) } - func (o *GetRoomsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetRoomsInternalServerError() *GetRoomsInternalServerError { return &GetRoomsInternalServerError{} } -/*GetRoomsInternalServerError handles this case with default header values. +/* GetRoomsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetRoomsInternalServerError struct { func (o *GetRoomsInternalServerError) Error() string { return fmt.Sprintf("[GET /rooms][%d] getRoomsInternalServerError %+v", 500, o.Payload) } - func (o *GetRoomsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/rooms/post_rooms_parameters.go b/api/metrc-gw/metrc_gw_client/rooms/post_rooms_parameters.go index 6bf6bcc..ed95874 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/post_rooms_parameters.go +++ b/api/metrc-gw/metrc_gw_client/rooms/post_rooms_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostRoomsParams creates a new PostRoomsParams object -// with the default values initialized. +// NewPostRoomsParams creates a new PostRoomsParams 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 NewPostRoomsParams() *PostRoomsParams { - var () return &PostRoomsParams{ - timeout: cr.DefaultTimeout, } } // NewPostRoomsParamsWithTimeout creates a new PostRoomsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostRoomsParamsWithTimeout(timeout time.Duration) *PostRoomsParams { - var () return &PostRoomsParams{ - timeout: timeout, } } // NewPostRoomsParamsWithContext creates a new PostRoomsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostRoomsParamsWithContext(ctx context.Context) *PostRoomsParams { - var () return &PostRoomsParams{ - Context: ctx, } } // NewPostRoomsParamsWithHTTPClient creates a new PostRoomsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostRoomsParamsWithHTTPClient(client *http.Client) *PostRoomsParams { - var () return &PostRoomsParams{ HTTPClient: client, } } -/*PostRoomsParams contains all the parameters to send to the API endpoint -for the post rooms operation typically these are written to a http.Request +/* PostRoomsParams contains all the parameters to send to the API endpoint + for the post rooms operation. + + Typically these are written to a http.Request. */ type PostRoomsParams struct { - /*RoomRequest - The New Rooms + /* RoomRequest. + The New Rooms */ RoomRequest *metrc_gw_models.RoomRequest @@ -77,6 +76,21 @@ type PostRoomsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post rooms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostRoomsParams) WithDefaults() *PostRoomsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post rooms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostRoomsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post rooms params func (o *PostRoomsParams) WithTimeout(timeout time.Duration) *PostRoomsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostRoomsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.RoomRequest != nil { if err := r.SetBodyParam(o.RoomRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/rooms/post_rooms_responses.go b/api/metrc-gw/metrc_gw_client/rooms/post_rooms_responses.go index 62047ef..0df2f0e 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/post_rooms_responses.go +++ b/api/metrc-gw/metrc_gw_client/rooms/post_rooms_responses.go @@ -57,9 +57,8 @@ func (o *PostRoomsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostRoomsOK() *PostRoomsOK { return &PostRoomsOK{} } -/*PostRoomsOK handles this case with default header values. +/* PostRoomsOK describes a response with status code 200, with default header values. An array of Room records with the new IDs */ @@ -79,7 +78,6 @@ type PostRoomsOK struct { func (o *PostRoomsOK) Error() string { return fmt.Sprintf("[POST /rooms][%d] postRoomsOK %+v", 200, o.Payload) } - func (o *PostRoomsOK) GetPayload() *metrc_gw_models.RoomResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostRoomsUnauthorized() *PostRoomsUnauthorized { return &PostRoomsUnauthorized{} } -/*PostRoomsUnauthorized handles this case with default header values. +/* PostRoomsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostRoomsUnauthorized struct { func (o *PostRoomsUnauthorized) Error() string { return fmt.Sprintf("[POST /rooms][%d] postRoomsUnauthorized %+v", 401, o.Payload) } - func (o *PostRoomsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostRoomsForbidden() *PostRoomsForbidden { return &PostRoomsForbidden{} } -/*PostRoomsForbidden handles this case with default header values. +/* PostRoomsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostRoomsForbidden struct { func (o *PostRoomsForbidden) Error() string { return fmt.Sprintf("[POST /rooms][%d] postRoomsForbidden %+v", 403, o.Payload) } - func (o *PostRoomsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostRoomsNotFound() *PostRoomsNotFound { return &PostRoomsNotFound{} } -/*PostRoomsNotFound handles this case with default header values. +/* PostRoomsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostRoomsNotFound struct { func (o *PostRoomsNotFound) Error() string { return fmt.Sprintf("[POST /rooms][%d] postRoomsNotFound %+v", 404, o.Payload) } - func (o *PostRoomsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostRoomsInternalServerError() *PostRoomsInternalServerError { return &PostRoomsInternalServerError{} } -/*PostRoomsInternalServerError handles this case with default header values. +/* PostRoomsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostRoomsInternalServerError struct { func (o *PostRoomsInternalServerError) Error() string { return fmt.Sprintf("[POST /rooms][%d] postRoomsInternalServerError %+v", 500, o.Payload) } - func (o *PostRoomsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/rooms/put_rooms_parameters.go b/api/metrc-gw/metrc_gw_client/rooms/put_rooms_parameters.go index f93ea61..0f118f1 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/put_rooms_parameters.go +++ b/api/metrc-gw/metrc_gw_client/rooms/put_rooms_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutRoomsParams creates a new PutRoomsParams object -// with the default values initialized. +// NewPutRoomsParams creates a new PutRoomsParams 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 NewPutRoomsParams() *PutRoomsParams { - var () return &PutRoomsParams{ - timeout: cr.DefaultTimeout, } } // NewPutRoomsParamsWithTimeout creates a new PutRoomsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutRoomsParamsWithTimeout(timeout time.Duration) *PutRoomsParams { - var () return &PutRoomsParams{ - timeout: timeout, } } // NewPutRoomsParamsWithContext creates a new PutRoomsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutRoomsParamsWithContext(ctx context.Context) *PutRoomsParams { - var () return &PutRoomsParams{ - Context: ctx, } } // NewPutRoomsParamsWithHTTPClient creates a new PutRoomsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutRoomsParamsWithHTTPClient(client *http.Client) *PutRoomsParams { - var () return &PutRoomsParams{ HTTPClient: client, } } -/*PutRoomsParams contains all the parameters to send to the API endpoint -for the put rooms operation typically these are written to a http.Request +/* PutRoomsParams contains all the parameters to send to the API endpoint + for the put rooms operation. + + Typically these are written to a http.Request. */ type PutRoomsParams struct { - /*RoomRequest - The Existing Rooms with Ids + /* RoomRequest. + The Existing Rooms with Ids */ RoomRequest *metrc_gw_models.RoomRequest @@ -77,6 +76,21 @@ type PutRoomsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put rooms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutRoomsParams) WithDefaults() *PutRoomsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put rooms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutRoomsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put rooms params func (o *PutRoomsParams) WithTimeout(timeout time.Duration) *PutRoomsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutRoomsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.RoomRequest != nil { if err := r.SetBodyParam(o.RoomRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/rooms/put_rooms_responses.go b/api/metrc-gw/metrc_gw_client/rooms/put_rooms_responses.go index 26515d9..6f28cdc 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/put_rooms_responses.go +++ b/api/metrc-gw/metrc_gw_client/rooms/put_rooms_responses.go @@ -57,9 +57,8 @@ func (o *PutRoomsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutRoomsOK() *PutRoomsOK { return &PutRoomsOK{} } -/*PutRoomsOK handles this case with default header values. +/* PutRoomsOK describes a response with status code 200, with default header values. An array of Room records */ @@ -79,7 +78,6 @@ type PutRoomsOK struct { func (o *PutRoomsOK) Error() string { return fmt.Sprintf("[PUT /rooms][%d] putRoomsOK %+v", 200, o.Payload) } - func (o *PutRoomsOK) GetPayload() *metrc_gw_models.RoomResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutRoomsUnauthorized() *PutRoomsUnauthorized { return &PutRoomsUnauthorized{} } -/*PutRoomsUnauthorized handles this case with default header values. +/* PutRoomsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutRoomsUnauthorized struct { func (o *PutRoomsUnauthorized) Error() string { return fmt.Sprintf("[PUT /rooms][%d] putRoomsUnauthorized %+v", 401, o.Payload) } - func (o *PutRoomsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutRoomsForbidden() *PutRoomsForbidden { return &PutRoomsForbidden{} } -/*PutRoomsForbidden handles this case with default header values. +/* PutRoomsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutRoomsForbidden struct { func (o *PutRoomsForbidden) Error() string { return fmt.Sprintf("[PUT /rooms][%d] putRoomsForbidden %+v", 403, o.Payload) } - func (o *PutRoomsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutRoomsNotFound() *PutRoomsNotFound { return &PutRoomsNotFound{} } -/*PutRoomsNotFound handles this case with default header values. +/* PutRoomsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutRoomsNotFound struct { func (o *PutRoomsNotFound) Error() string { return fmt.Sprintf("[PUT /rooms][%d] putRoomsNotFound %+v", 404, o.Payload) } - func (o *PutRoomsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutRoomsInternalServerError() *PutRoomsInternalServerError { return &PutRoomsInternalServerError{} } -/*PutRoomsInternalServerError handles this case with default header values. +/* PutRoomsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutRoomsInternalServerError struct { func (o *PutRoomsInternalServerError) Error() string { return fmt.Sprintf("[PUT /rooms][%d] putRoomsInternalServerError %+v", 500, o.Payload) } - func (o *PutRoomsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/rooms/rooms_client.go b/api/metrc-gw/metrc_gw_client/rooms/rooms_client.go index 775e0ba..71d8e5f 100644 --- a/api/metrc-gw/metrc_gw_client/rooms/rooms_client.go +++ b/api/metrc-gw/metrc_gw_client/rooms/rooms_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteRoom(params *DeleteRoomParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteRoomOK, error) + DeleteRoom(params *DeleteRoomParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteRoomOK, error) - GetRooms(params *GetRoomsParams, authInfo runtime.ClientAuthInfoWriter) (*GetRoomsOK, error) + GetRooms(params *GetRoomsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRoomsOK, error) - PostRooms(params *PostRoomsParams, authInfo runtime.ClientAuthInfoWriter) (*PostRoomsOK, error) + PostRooms(params *PostRoomsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostRoomsOK, error) - PutRooms(params *PutRoomsParams, authInfo runtime.ClientAuthInfoWriter) (*PutRoomsOK, error) + PutRooms(params *PutRoomsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutRoomsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -48,13 +51,12 @@ type ClientService interface { Delete a Room for this User-License */ -func (a *Client) DeleteRoom(params *DeleteRoomParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteRoomOK, error) { +func (a *Client) DeleteRoom(params *DeleteRoomParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteRoomOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteRoomParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteRoom", Method: "DELETE", PathPattern: "/rooms", @@ -66,7 +68,12 @@ func (a *Client) DeleteRoom(params *DeleteRoomParams, authInfo runtime.ClientAut 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 } @@ -86,13 +93,12 @@ func (a *Client) DeleteRoom(params *DeleteRoomParams, authInfo runtime.ClientAut Get Rooms for this User-License */ -func (a *Client) GetRooms(params *GetRoomsParams, authInfo runtime.ClientAuthInfoWriter) (*GetRoomsOK, error) { +func (a *Client) GetRooms(params *GetRoomsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRoomsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRoomsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRooms", Method: "GET", PathPattern: "/rooms", @@ -104,7 +110,12 @@ func (a *Client) GetRooms(params *GetRoomsParams, authInfo runtime.ClientAuthInf 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 } @@ -123,13 +134,12 @@ func (a *Client) GetRooms(params *GetRoomsParams, authInfo runtime.ClientAuthInf Create new Rooms */ -func (a *Client) PostRooms(params *PostRoomsParams, authInfo runtime.ClientAuthInfoWriter) (*PostRoomsOK, error) { +func (a *Client) PostRooms(params *PostRoomsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostRoomsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostRoomsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postRooms", Method: "POST", PathPattern: "/rooms", @@ -141,7 +151,12 @@ func (a *Client) PostRooms(params *PostRoomsParams, authInfo runtime.ClientAuthI 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 } @@ -160,13 +175,12 @@ func (a *Client) PostRooms(params *PostRoomsParams, authInfo runtime.ClientAuthI Update existing Rooms */ -func (a *Client) PutRooms(params *PutRoomsParams, authInfo runtime.ClientAuthInfoWriter) (*PutRoomsOK, error) { +func (a *Client) PutRooms(params *PutRoomsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutRoomsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutRoomsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putRooms", Method: "PUT", PathPattern: "/rooms", @@ -178,7 +192,12 @@ func (a *Client) PutRooms(params *PutRoomsParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_parameters.go b/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_parameters.go index ef6cbf7..123cdd9 100644 --- a/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_parameters.go @@ -20,73 +20,76 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteSalesDeliveryParams creates a new DeleteSalesDeliveryParams object -// with the default values initialized. +// NewDeleteSalesDeliveryParams creates a new DeleteSalesDeliveryParams 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 NewDeleteSalesDeliveryParams() *DeleteSalesDeliveryParams { - var () return &DeleteSalesDeliveryParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteSalesDeliveryParamsWithTimeout creates a new DeleteSalesDeliveryParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteSalesDeliveryParamsWithTimeout(timeout time.Duration) *DeleteSalesDeliveryParams { - var () return &DeleteSalesDeliveryParams{ - timeout: timeout, } } // NewDeleteSalesDeliveryParamsWithContext creates a new DeleteSalesDeliveryParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteSalesDeliveryParamsWithContext(ctx context.Context) *DeleteSalesDeliveryParams { - var () return &DeleteSalesDeliveryParams{ - Context: ctx, } } // NewDeleteSalesDeliveryParamsWithHTTPClient creates a new DeleteSalesDeliveryParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteSalesDeliveryParamsWithHTTPClient(client *http.Client) *DeleteSalesDeliveryParams { - var () return &DeleteSalesDeliveryParams{ HTTPClient: client, } } -/*DeleteSalesDeliveryParams contains all the parameters to send to the API endpoint -for the delete sales delivery operation typically these are written to a http.Request +/* DeleteSalesDeliveryParams contains all the parameters to send to the API endpoint + for the delete sales delivery operation. + + Typically these are written to a http.Request. */ type DeleteSalesDeliveryParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*SalesDeliveryID - The Sales Delivery Number + /* SalesDeliveryID. + + The Sales Delivery Number */ SalesDeliveryID string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -95,6 +98,21 @@ type DeleteSalesDeliveryParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete sales delivery params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteSalesDeliveryParams) WithDefaults() *DeleteSalesDeliveryParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete sales delivery params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteSalesDeliveryParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete sales delivery params func (o *DeleteSalesDeliveryParams) WithTimeout(timeout time.Duration) *DeleteSalesDeliveryParams { o.SetTimeout(timeout) @@ -195,6 +213,7 @@ func (o *DeleteSalesDeliveryParams) WriteToRequest(r runtime.ClientRequest, reg qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -204,6 +223,7 @@ func (o *DeleteSalesDeliveryParams) WriteToRequest(r runtime.ClientRequest, reg qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -213,6 +233,7 @@ func (o *DeleteSalesDeliveryParams) WriteToRequest(r runtime.ClientRequest, reg qrSalesDeliveryID := o.SalesDeliveryID qSalesDeliveryID := qrSalesDeliveryID if qSalesDeliveryID != "" { + if err := r.SetQueryParam("salesDeliveryId", qSalesDeliveryID); err != nil { return err } @@ -222,6 +243,7 @@ func (o *DeleteSalesDeliveryParams) WriteToRequest(r runtime.ClientRequest, reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -231,6 +253,7 @@ func (o *DeleteSalesDeliveryParams) WriteToRequest(r runtime.ClientRequest, reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_responses.go b/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_responses.go index 66f46ce..4c8b304 100644 --- a/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/delete_sales_delivery_responses.go @@ -57,9 +57,8 @@ func (o *DeleteSalesDeliveryReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeleteSalesDeliveryOK() *DeleteSalesDeliveryOK { return &DeleteSalesDeliveryOK{} } -/*DeleteSalesDeliveryOK handles this case with default header values. +/* DeleteSalesDeliveryOK describes a response with status code 200, with default header values. Sales Delivery was successfully deleted */ @@ -79,7 +78,6 @@ type DeleteSalesDeliveryOK struct { func (o *DeleteSalesDeliveryOK) Error() string { return fmt.Sprintf("[DELETE /sales/deliveries][%d] deleteSalesDeliveryOK %+v", 200, o.Payload) } - func (o *DeleteSalesDeliveryOK) GetPayload() *metrc_gw_models.SalesDeliveryResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewDeleteSalesDeliveryUnauthorized() *DeleteSalesDeliveryUnauthorized { return &DeleteSalesDeliveryUnauthorized{} } -/*DeleteSalesDeliveryUnauthorized handles this case with default header values. +/* DeleteSalesDeliveryUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type DeleteSalesDeliveryUnauthorized struct { func (o *DeleteSalesDeliveryUnauthorized) Error() string { return fmt.Sprintf("[DELETE /sales/deliveries][%d] deleteSalesDeliveryUnauthorized %+v", 401, o.Payload) } - func (o *DeleteSalesDeliveryUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewDeleteSalesDeliveryForbidden() *DeleteSalesDeliveryForbidden { return &DeleteSalesDeliveryForbidden{} } -/*DeleteSalesDeliveryForbidden handles this case with default header values. +/* DeleteSalesDeliveryForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type DeleteSalesDeliveryForbidden struct { func (o *DeleteSalesDeliveryForbidden) Error() string { return fmt.Sprintf("[DELETE /sales/deliveries][%d] deleteSalesDeliveryForbidden %+v", 403, o.Payload) } - func (o *DeleteSalesDeliveryForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewDeleteSalesDeliveryNotFound() *DeleteSalesDeliveryNotFound { return &DeleteSalesDeliveryNotFound{} } -/*DeleteSalesDeliveryNotFound handles this case with default header values. +/* DeleteSalesDeliveryNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type DeleteSalesDeliveryNotFound struct { func (o *DeleteSalesDeliveryNotFound) Error() string { return fmt.Sprintf("[DELETE /sales/deliveries][%d] deleteSalesDeliveryNotFound %+v", 404, o.Payload) } - func (o *DeleteSalesDeliveryNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewDeleteSalesDeliveryInternalServerError() *DeleteSalesDeliveryInternalSer return &DeleteSalesDeliveryInternalServerError{} } -/*DeleteSalesDeliveryInternalServerError handles this case with default header values. +/* DeleteSalesDeliveryInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type DeleteSalesDeliveryInternalServerError struct { func (o *DeleteSalesDeliveryInternalServerError) Error() string { return fmt.Sprintf("[DELETE /sales/deliveries][%d] deleteSalesDeliveryInternalServerError %+v", 500, o.Payload) } - func (o *DeleteSalesDeliveryInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_parameters.go b/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_parameters.go index dd16134..f3963ef 100644 --- a/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_parameters.go @@ -20,73 +20,76 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteSalesReceiptsParams creates a new DeleteSalesReceiptsParams object -// with the default values initialized. +// NewDeleteSalesReceiptsParams creates a new DeleteSalesReceiptsParams 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 NewDeleteSalesReceiptsParams() *DeleteSalesReceiptsParams { - var () return &DeleteSalesReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteSalesReceiptsParamsWithTimeout creates a new DeleteSalesReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteSalesReceiptsParamsWithTimeout(timeout time.Duration) *DeleteSalesReceiptsParams { - var () return &DeleteSalesReceiptsParams{ - timeout: timeout, } } // NewDeleteSalesReceiptsParamsWithContext creates a new DeleteSalesReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteSalesReceiptsParamsWithContext(ctx context.Context) *DeleteSalesReceiptsParams { - var () return &DeleteSalesReceiptsParams{ - Context: ctx, } } // NewDeleteSalesReceiptsParamsWithHTTPClient creates a new DeleteSalesReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteSalesReceiptsParamsWithHTTPClient(client *http.Client) *DeleteSalesReceiptsParams { - var () return &DeleteSalesReceiptsParams{ HTTPClient: client, } } -/*DeleteSalesReceiptsParams contains all the parameters to send to the API endpoint -for the delete sales receipts operation typically these are written to a http.Request +/* DeleteSalesReceiptsParams contains all the parameters to send to the API endpoint + for the delete sales receipts operation. + + Typically these are written to a http.Request. */ type DeleteSalesReceiptsParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*SalesReceiptID - The Sales Receipt Number + /* SalesReceiptID. + + The Sales Receipt Number */ SalesReceiptID string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -95,6 +98,21 @@ type DeleteSalesReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteSalesReceiptsParams) WithDefaults() *DeleteSalesReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteSalesReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete sales receipts params func (o *DeleteSalesReceiptsParams) WithTimeout(timeout time.Duration) *DeleteSalesReceiptsParams { o.SetTimeout(timeout) @@ -195,6 +213,7 @@ func (o *DeleteSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -204,6 +223,7 @@ func (o *DeleteSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -213,6 +233,7 @@ func (o *DeleteSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg qrSalesReceiptID := o.SalesReceiptID qSalesReceiptID := qrSalesReceiptID if qSalesReceiptID != "" { + if err := r.SetQueryParam("salesReceiptId", qSalesReceiptID); err != nil { return err } @@ -222,6 +243,7 @@ func (o *DeleteSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -231,6 +253,7 @@ func (o *DeleteSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_responses.go b/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_responses.go index ed813e9..9561ae3 100644 --- a/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/delete_sales_receipts_responses.go @@ -57,9 +57,8 @@ func (o *DeleteSalesReceiptsReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeleteSalesReceiptsOK() *DeleteSalesReceiptsOK { return &DeleteSalesReceiptsOK{} } -/*DeleteSalesReceiptsOK handles this case with default header values. +/* DeleteSalesReceiptsOK describes a response with status code 200, with default header values. Sales Receipt was successfully deleted */ @@ -79,7 +78,6 @@ type DeleteSalesReceiptsOK struct { func (o *DeleteSalesReceiptsOK) Error() string { return fmt.Sprintf("[DELETE /sales/receipts][%d] deleteSalesReceiptsOK %+v", 200, o.Payload) } - func (o *DeleteSalesReceiptsOK) GetPayload() *metrc_gw_models.SalesReceiptResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewDeleteSalesReceiptsUnauthorized() *DeleteSalesReceiptsUnauthorized { return &DeleteSalesReceiptsUnauthorized{} } -/*DeleteSalesReceiptsUnauthorized handles this case with default header values. +/* DeleteSalesReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type DeleteSalesReceiptsUnauthorized struct { func (o *DeleteSalesReceiptsUnauthorized) Error() string { return fmt.Sprintf("[DELETE /sales/receipts][%d] deleteSalesReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *DeleteSalesReceiptsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewDeleteSalesReceiptsForbidden() *DeleteSalesReceiptsForbidden { return &DeleteSalesReceiptsForbidden{} } -/*DeleteSalesReceiptsForbidden handles this case with default header values. +/* DeleteSalesReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type DeleteSalesReceiptsForbidden struct { func (o *DeleteSalesReceiptsForbidden) Error() string { return fmt.Sprintf("[DELETE /sales/receipts][%d] deleteSalesReceiptsForbidden %+v", 403, o.Payload) } - func (o *DeleteSalesReceiptsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewDeleteSalesReceiptsNotFound() *DeleteSalesReceiptsNotFound { return &DeleteSalesReceiptsNotFound{} } -/*DeleteSalesReceiptsNotFound handles this case with default header values. +/* DeleteSalesReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type DeleteSalesReceiptsNotFound struct { func (o *DeleteSalesReceiptsNotFound) Error() string { return fmt.Sprintf("[DELETE /sales/receipts][%d] deleteSalesReceiptsNotFound %+v", 404, o.Payload) } - func (o *DeleteSalesReceiptsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewDeleteSalesReceiptsInternalServerError() *DeleteSalesReceiptsInternalSer return &DeleteSalesReceiptsInternalServerError{} } -/*DeleteSalesReceiptsInternalServerError handles this case with default header values. +/* DeleteSalesReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type DeleteSalesReceiptsInternalServerError struct { func (o *DeleteSalesReceiptsInternalServerError) Error() string { return fmt.Sprintf("[DELETE /sales/receipts][%d] deleteSalesReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *DeleteSalesReceiptsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_customer_types_parameters.go b/api/metrc-gw/metrc_gw_client/sales/get_customer_types_parameters.go index 2ace012..72d8720 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_customer_types_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_customer_types_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCustomerTypesParams creates a new GetCustomerTypesParams object -// with the default values initialized. +// NewGetCustomerTypesParams creates a new GetCustomerTypesParams 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 NewGetCustomerTypesParams() *GetCustomerTypesParams { - var () return &GetCustomerTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCustomerTypesParamsWithTimeout creates a new GetCustomerTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCustomerTypesParamsWithTimeout(timeout time.Duration) *GetCustomerTypesParams { - var () return &GetCustomerTypesParams{ - timeout: timeout, } } // NewGetCustomerTypesParamsWithContext creates a new GetCustomerTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCustomerTypesParamsWithContext(ctx context.Context) *GetCustomerTypesParams { - var () return &GetCustomerTypesParams{ - Context: ctx, } } // NewGetCustomerTypesParamsWithHTTPClient creates a new GetCustomerTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCustomerTypesParamsWithHTTPClient(client *http.Client) *GetCustomerTypesParams { - var () return &GetCustomerTypesParams{ HTTPClient: client, } } -/*GetCustomerTypesParams contains all the parameters to send to the API endpoint -for the get customer types operation typically these are written to a http.Request +/* GetCustomerTypesParams contains all the parameters to send to the API endpoint + for the get customer types operation. + + Typically these are written to a http.Request. */ type GetCustomerTypesParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type GetCustomerTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get customer types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCustomerTypesParams) WithDefaults() *GetCustomerTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get customer types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCustomerTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get customer types params func (o *GetCustomerTypesParams) WithTimeout(timeout time.Duration) *GetCustomerTypesParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *GetCustomerTypesParams) WriteToRequest(r runtime.ClientRequest, reg str qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -205,22 +224,24 @@ func (o *GetCustomerTypesParams) WriteToRequest(r runtime.ClientRequest, reg str // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -230,6 +251,7 @@ func (o *GetCustomerTypesParams) WriteToRequest(r runtime.ClientRequest, reg str qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -239,6 +261,7 @@ func (o *GetCustomerTypesParams) WriteToRequest(r runtime.ClientRequest, reg str qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_customer_types_responses.go b/api/metrc-gw/metrc_gw_client/sales/get_customer_types_responses.go index dc40367..8634bdf 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_customer_types_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_customer_types_responses.go @@ -57,9 +57,8 @@ func (o *GetCustomerTypesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetCustomerTypesOK() *GetCustomerTypesOK { return &GetCustomerTypesOK{} } -/*GetCustomerTypesOK handles this case with default header values. +/* GetCustomerTypesOK describes a response with status code 200, with default header values. A list of active Customer Types was succefully retrieved */ @@ -79,7 +78,6 @@ type GetCustomerTypesOK struct { func (o *GetCustomerTypesOK) Error() string { return fmt.Sprintf("[GET /sales/customertypes][%d] getCustomerTypesOK %+v", 200, o.Payload) } - func (o *GetCustomerTypesOK) GetPayload() *metrc_gw_models.CustomerTypeResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetCustomerTypesUnauthorized() *GetCustomerTypesUnauthorized { return &GetCustomerTypesUnauthorized{} } -/*GetCustomerTypesUnauthorized handles this case with default header values. +/* GetCustomerTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetCustomerTypesUnauthorized struct { func (o *GetCustomerTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /sales/customertypes][%d] getCustomerTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetCustomerTypesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetCustomerTypesForbidden() *GetCustomerTypesForbidden { return &GetCustomerTypesForbidden{} } -/*GetCustomerTypesForbidden handles this case with default header values. +/* GetCustomerTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetCustomerTypesForbidden struct { func (o *GetCustomerTypesForbidden) Error() string { return fmt.Sprintf("[GET /sales/customertypes][%d] getCustomerTypesForbidden %+v", 403, o.Payload) } - func (o *GetCustomerTypesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetCustomerTypesNotFound() *GetCustomerTypesNotFound { return &GetCustomerTypesNotFound{} } -/*GetCustomerTypesNotFound handles this case with default header values. +/* GetCustomerTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetCustomerTypesNotFound struct { func (o *GetCustomerTypesNotFound) Error() string { return fmt.Sprintf("[GET /sales/customertypes][%d] getCustomerTypesNotFound %+v", 404, o.Payload) } - func (o *GetCustomerTypesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetCustomerTypesInternalServerError() *GetCustomerTypesInternalServerErr return &GetCustomerTypesInternalServerError{} } -/*GetCustomerTypesInternalServerError handles this case with default header values. +/* GetCustomerTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetCustomerTypesInternalServerError struct { func (o *GetCustomerTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /sales/customertypes][%d] getCustomerTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetCustomerTypesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_parameters.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_parameters.go index 22517e3..d3c779a 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_parameters.go @@ -21,88 +21,94 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSalesDeliveriesParams creates a new GetSalesDeliveriesParams object -// with the default values initialized. +// NewGetSalesDeliveriesParams creates a new GetSalesDeliveriesParams 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 NewGetSalesDeliveriesParams() *GetSalesDeliveriesParams { - var () return &GetSalesDeliveriesParams{ - timeout: cr.DefaultTimeout, } } // NewGetSalesDeliveriesParamsWithTimeout creates a new GetSalesDeliveriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSalesDeliveriesParamsWithTimeout(timeout time.Duration) *GetSalesDeliveriesParams { - var () return &GetSalesDeliveriesParams{ - timeout: timeout, } } // NewGetSalesDeliveriesParamsWithContext creates a new GetSalesDeliveriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSalesDeliveriesParamsWithContext(ctx context.Context) *GetSalesDeliveriesParams { - var () return &GetSalesDeliveriesParams{ - Context: ctx, } } // NewGetSalesDeliveriesParamsWithHTTPClient creates a new GetSalesDeliveriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSalesDeliveriesParamsWithHTTPClient(client *http.Client) *GetSalesDeliveriesParams { - var () return &GetSalesDeliveriesParams{ HTTPClient: client, } } -/*GetSalesDeliveriesParams contains all the parameters to send to the API endpoint -for the get sales deliveries operation typically these are written to a http.Request +/* GetSalesDeliveriesParams contains all the parameters to send to the API endpoint + for the get sales deliveries operation. + + Typically these are written to a http.Request. */ type GetSalesDeliveriesParams struct { - /*DeliveryID - The Sales Delivery Number + /* DeliveryID. + The Sales Delivery Number */ DeliveryID *string - /*LastModifiedEnd - The last modified end timestamp + /* LastModifiedEnd. + + The last modified end timestamp */ LastModifiedEnd *string - /*LastModifiedStart - The last modified start timestamp + /* LastModifiedStart. + + The last modified start timestamp */ LastModifiedStart *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -111,6 +117,21 @@ type GetSalesDeliveriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get sales deliveries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesDeliveriesParams) WithDefaults() *GetSalesDeliveriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get sales deliveries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesDeliveriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get sales deliveries params func (o *GetSalesDeliveriesParams) WithTimeout(timeout time.Duration) *GetSalesDeliveriesParams { o.SetTimeout(timeout) @@ -244,54 +265,58 @@ func (o *GetSalesDeliveriesParams) WriteToRequest(r runtime.ClientRequest, reg s // query param deliveryId var qrDeliveryID string + if o.DeliveryID != nil { qrDeliveryID = *o.DeliveryID } qDeliveryID := qrDeliveryID if qDeliveryID != "" { + if err := r.SetQueryParam("deliveryId", qDeliveryID); err != nil { return err } } - } if o.LastModifiedEnd != nil { // query param lastModifiedEnd var qrLastModifiedEnd string + if o.LastModifiedEnd != nil { qrLastModifiedEnd = *o.LastModifiedEnd } qLastModifiedEnd := qrLastModifiedEnd if qLastModifiedEnd != "" { + if err := r.SetQueryParam("lastModifiedEnd", qLastModifiedEnd); err != nil { return err } } - } if o.LastModifiedStart != nil { // query param lastModifiedStart var qrLastModifiedStart string + if o.LastModifiedStart != nil { qrLastModifiedStart = *o.LastModifiedStart } qLastModifiedStart := qrLastModifiedStart if qLastModifiedStart != "" { + if err := r.SetQueryParam("lastModifiedStart", qLastModifiedStart); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -301,22 +326,24 @@ func (o *GetSalesDeliveriesParams) WriteToRequest(r runtime.ClientRequest, reg s // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -326,6 +353,7 @@ func (o *GetSalesDeliveriesParams) WriteToRequest(r runtime.ClientRequest, reg s qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -335,6 +363,7 @@ func (o *GetSalesDeliveriesParams) WriteToRequest(r runtime.ClientRequest, reg s qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_responses.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_responses.go index bc6b3f4..e2d2ec8 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_deliveries_responses.go @@ -57,9 +57,8 @@ func (o *GetSalesDeliveriesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetSalesDeliveriesOK() *GetSalesDeliveriesOK { return &GetSalesDeliveriesOK{} } -/*GetSalesDeliveriesOK handles this case with default header values. +/* GetSalesDeliveriesOK describes a response with status code 200, with default header values. A list of Deliveries was succefully retrieved */ @@ -79,7 +78,6 @@ type GetSalesDeliveriesOK struct { func (o *GetSalesDeliveriesOK) Error() string { return fmt.Sprintf("[GET /sales/deliveries][%d] getSalesDeliveriesOK %+v", 200, o.Payload) } - func (o *GetSalesDeliveriesOK) GetPayload() *metrc_gw_models.SalesDeliveryResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetSalesDeliveriesUnauthorized() *GetSalesDeliveriesUnauthorized { return &GetSalesDeliveriesUnauthorized{} } -/*GetSalesDeliveriesUnauthorized handles this case with default header values. +/* GetSalesDeliveriesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetSalesDeliveriesUnauthorized struct { func (o *GetSalesDeliveriesUnauthorized) Error() string { return fmt.Sprintf("[GET /sales/deliveries][%d] getSalesDeliveriesUnauthorized %+v", 401, o.Payload) } - func (o *GetSalesDeliveriesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetSalesDeliveriesForbidden() *GetSalesDeliveriesForbidden { return &GetSalesDeliveriesForbidden{} } -/*GetSalesDeliveriesForbidden handles this case with default header values. +/* GetSalesDeliveriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetSalesDeliveriesForbidden struct { func (o *GetSalesDeliveriesForbidden) Error() string { return fmt.Sprintf("[GET /sales/deliveries][%d] getSalesDeliveriesForbidden %+v", 403, o.Payload) } - func (o *GetSalesDeliveriesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetSalesDeliveriesNotFound() *GetSalesDeliveriesNotFound { return &GetSalesDeliveriesNotFound{} } -/*GetSalesDeliveriesNotFound handles this case with default header values. +/* GetSalesDeliveriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetSalesDeliveriesNotFound struct { func (o *GetSalesDeliveriesNotFound) Error() string { return fmt.Sprintf("[GET /sales/deliveries][%d] getSalesDeliveriesNotFound %+v", 404, o.Payload) } - func (o *GetSalesDeliveriesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetSalesDeliveriesInternalServerError() *GetSalesDeliveriesInternalServe return &GetSalesDeliveriesInternalServerError{} } -/*GetSalesDeliveriesInternalServerError handles this case with default header values. +/* GetSalesDeliveriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetSalesDeliveriesInternalServerError struct { func (o *GetSalesDeliveriesInternalServerError) Error() string { return fmt.Sprintf("[GET /sales/deliveries][%d] getSalesDeliveriesInternalServerError %+v", 500, o.Payload) } - func (o *GetSalesDeliveriesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_parameters.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_parameters.go index fdb0c8e..6a43f28 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSalesDeliveryReturnReasonsParams creates a new GetSalesDeliveryReturnReasonsParams object -// with the default values initialized. +// NewGetSalesDeliveryReturnReasonsParams creates a new GetSalesDeliveryReturnReasonsParams 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 NewGetSalesDeliveryReturnReasonsParams() *GetSalesDeliveryReturnReasonsParams { - var () return &GetSalesDeliveryReturnReasonsParams{ - timeout: cr.DefaultTimeout, } } // NewGetSalesDeliveryReturnReasonsParamsWithTimeout creates a new GetSalesDeliveryReturnReasonsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSalesDeliveryReturnReasonsParamsWithTimeout(timeout time.Duration) *GetSalesDeliveryReturnReasonsParams { - var () return &GetSalesDeliveryReturnReasonsParams{ - timeout: timeout, } } // NewGetSalesDeliveryReturnReasonsParamsWithContext creates a new GetSalesDeliveryReturnReasonsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSalesDeliveryReturnReasonsParamsWithContext(ctx context.Context) *GetSalesDeliveryReturnReasonsParams { - var () return &GetSalesDeliveryReturnReasonsParams{ - Context: ctx, } } // NewGetSalesDeliveryReturnReasonsParamsWithHTTPClient creates a new GetSalesDeliveryReturnReasonsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSalesDeliveryReturnReasonsParamsWithHTTPClient(client *http.Client) *GetSalesDeliveryReturnReasonsParams { - var () return &GetSalesDeliveryReturnReasonsParams{ HTTPClient: client, } } -/*GetSalesDeliveryReturnReasonsParams contains all the parameters to send to the API endpoint -for the get sales delivery return reasons operation typically these are written to a http.Request +/* GetSalesDeliveryReturnReasonsParams contains all the parameters to send to the API endpoint + for the get sales delivery return reasons operation. + + Typically these are written to a http.Request. */ type GetSalesDeliveryReturnReasonsParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type GetSalesDeliveryReturnReasonsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get sales delivery return reasons params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesDeliveryReturnReasonsParams) WithDefaults() *GetSalesDeliveryReturnReasonsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get sales delivery return reasons params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesDeliveryReturnReasonsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get sales delivery return reasons params func (o *GetSalesDeliveryReturnReasonsParams) WithTimeout(timeout time.Duration) *GetSalesDeliveryReturnReasonsParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *GetSalesDeliveryReturnReasonsParams) WriteToRequest(r runtime.ClientReq qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -205,22 +224,24 @@ func (o *GetSalesDeliveryReturnReasonsParams) WriteToRequest(r runtime.ClientReq // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -230,6 +251,7 @@ func (o *GetSalesDeliveryReturnReasonsParams) WriteToRequest(r runtime.ClientReq qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -239,6 +261,7 @@ func (o *GetSalesDeliveryReturnReasonsParams) WriteToRequest(r runtime.ClientReq qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_responses.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_responses.go index 3fb2e98..d61e2d6 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_delivery_return_reasons_responses.go @@ -57,9 +57,8 @@ func (o *GetSalesDeliveryReturnReasonsReader) ReadResponse(response runtime.Clie return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetSalesDeliveryReturnReasonsOK() *GetSalesDeliveryReturnReasonsOK { return &GetSalesDeliveryReturnReasonsOK{} } -/*GetSalesDeliveryReturnReasonsOK handles this case with default header values. +/* GetSalesDeliveryReturnReasonsOK describes a response with status code 200, with default header values. A list of active Sales Delivery Return Reasons was succefully retrieved */ @@ -79,7 +78,6 @@ type GetSalesDeliveryReturnReasonsOK struct { func (o *GetSalesDeliveryReturnReasonsOK) Error() string { return fmt.Sprintf("[GET /sales/deliveries/returnreasons][%d] getSalesDeliveryReturnReasonsOK %+v", 200, o.Payload) } - func (o *GetSalesDeliveryReturnReasonsOK) GetPayload() *metrc_gw_models.SalesDeliveryReturnReasonResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetSalesDeliveryReturnReasonsUnauthorized() *GetSalesDeliveryReturnReaso return &GetSalesDeliveryReturnReasonsUnauthorized{} } -/*GetSalesDeliveryReturnReasonsUnauthorized handles this case with default header values. +/* GetSalesDeliveryReturnReasonsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetSalesDeliveryReturnReasonsUnauthorized struct { func (o *GetSalesDeliveryReturnReasonsUnauthorized) Error() string { return fmt.Sprintf("[GET /sales/deliveries/returnreasons][%d] getSalesDeliveryReturnReasonsUnauthorized %+v", 401, o.Payload) } - func (o *GetSalesDeliveryReturnReasonsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetSalesDeliveryReturnReasonsForbidden() *GetSalesDeliveryReturnReasonsF return &GetSalesDeliveryReturnReasonsForbidden{} } -/*GetSalesDeliveryReturnReasonsForbidden handles this case with default header values. +/* GetSalesDeliveryReturnReasonsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetSalesDeliveryReturnReasonsForbidden struct { func (o *GetSalesDeliveryReturnReasonsForbidden) Error() string { return fmt.Sprintf("[GET /sales/deliveries/returnreasons][%d] getSalesDeliveryReturnReasonsForbidden %+v", 403, o.Payload) } - func (o *GetSalesDeliveryReturnReasonsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetSalesDeliveryReturnReasonsNotFound() *GetSalesDeliveryReturnReasonsNo return &GetSalesDeliveryReturnReasonsNotFound{} } -/*GetSalesDeliveryReturnReasonsNotFound handles this case with default header values. +/* GetSalesDeliveryReturnReasonsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetSalesDeliveryReturnReasonsNotFound struct { func (o *GetSalesDeliveryReturnReasonsNotFound) Error() string { return fmt.Sprintf("[GET /sales/deliveries/returnreasons][%d] getSalesDeliveryReturnReasonsNotFound %+v", 404, o.Payload) } - func (o *GetSalesDeliveryReturnReasonsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetSalesDeliveryReturnReasonsInternalServerError() *GetSalesDeliveryRetu return &GetSalesDeliveryReturnReasonsInternalServerError{} } -/*GetSalesDeliveryReturnReasonsInternalServerError handles this case with default header values. +/* GetSalesDeliveryReturnReasonsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetSalesDeliveryReturnReasonsInternalServerError struct { func (o *GetSalesDeliveryReturnReasonsInternalServerError) Error() string { return fmt.Sprintf("[GET /sales/deliveries/returnreasons][%d] getSalesDeliveryReturnReasonsInternalServerError %+v", 500, o.Payload) } - func (o *GetSalesDeliveryReturnReasonsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_parameters.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_parameters.go index a69cc10..41e151e 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_parameters.go @@ -21,88 +21,94 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSalesReceiptsParams creates a new GetSalesReceiptsParams object -// with the default values initialized. +// NewGetSalesReceiptsParams creates a new GetSalesReceiptsParams 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 NewGetSalesReceiptsParams() *GetSalesReceiptsParams { - var () return &GetSalesReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewGetSalesReceiptsParamsWithTimeout creates a new GetSalesReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSalesReceiptsParamsWithTimeout(timeout time.Duration) *GetSalesReceiptsParams { - var () return &GetSalesReceiptsParams{ - timeout: timeout, } } // NewGetSalesReceiptsParamsWithContext creates a new GetSalesReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSalesReceiptsParamsWithContext(ctx context.Context) *GetSalesReceiptsParams { - var () return &GetSalesReceiptsParams{ - Context: ctx, } } // NewGetSalesReceiptsParamsWithHTTPClient creates a new GetSalesReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSalesReceiptsParamsWithHTTPClient(client *http.Client) *GetSalesReceiptsParams { - var () return &GetSalesReceiptsParams{ HTTPClient: client, } } -/*GetSalesReceiptsParams contains all the parameters to send to the API endpoint -for the get sales receipts operation typically these are written to a http.Request +/* GetSalesReceiptsParams contains all the parameters to send to the API endpoint + for the get sales receipts operation. + + Typically these are written to a http.Request. */ type GetSalesReceiptsParams struct { - /*LastModifiedEnd - The last modified end timestamp + /* LastModifiedEnd. + The last modified end timestamp */ LastModifiedEnd *string - /*LastModifiedStart - The last modified start timestamp + /* LastModifiedStart. + + The last modified start timestamp */ LastModifiedStart *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*SalesReceiptID - The Sales Receipt Number + /* SalesReceiptID. + + The Sales Receipt Number */ SalesReceiptID *string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -111,6 +117,21 @@ type GetSalesReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesReceiptsParams) WithDefaults() *GetSalesReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get sales receipts params func (o *GetSalesReceiptsParams) WithTimeout(timeout time.Duration) *GetSalesReceiptsParams { o.SetTimeout(timeout) @@ -244,38 +265,41 @@ func (o *GetSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg str // query param lastModifiedEnd var qrLastModifiedEnd string + if o.LastModifiedEnd != nil { qrLastModifiedEnd = *o.LastModifiedEnd } qLastModifiedEnd := qrLastModifiedEnd if qLastModifiedEnd != "" { + if err := r.SetQueryParam("lastModifiedEnd", qLastModifiedEnd); err != nil { return err } } - } if o.LastModifiedStart != nil { // query param lastModifiedStart var qrLastModifiedStart string + if o.LastModifiedStart != nil { qrLastModifiedStart = *o.LastModifiedStart } qLastModifiedStart := qrLastModifiedStart if qLastModifiedStart != "" { + if err := r.SetQueryParam("lastModifiedStart", qLastModifiedStart); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -285,22 +309,24 @@ func (o *GetSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg str // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -310,22 +336,24 @@ func (o *GetSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg str // query param salesReceiptId var qrSalesReceiptID string + if o.SalesReceiptID != nil { qrSalesReceiptID = *o.SalesReceiptID } qSalesReceiptID := qrSalesReceiptID if qSalesReceiptID != "" { + if err := r.SetQueryParam("salesReceiptId", qSalesReceiptID); err != nil { return err } } - } // query param state qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -335,6 +363,7 @@ func (o *GetSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg str qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_responses.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_responses.go index fdaccf4..c1bfff9 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_receipts_responses.go @@ -57,9 +57,8 @@ func (o *GetSalesReceiptsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetSalesReceiptsOK() *GetSalesReceiptsOK { return &GetSalesReceiptsOK{} } -/*GetSalesReceiptsOK handles this case with default header values. +/* GetSalesReceiptsOK describes a response with status code 200, with default header values. A list of active Sales Receipts was succefully retrieved */ @@ -79,7 +78,6 @@ type GetSalesReceiptsOK struct { func (o *GetSalesReceiptsOK) Error() string { return fmt.Sprintf("[GET /sales/receipts][%d] getSalesReceiptsOK %+v", 200, o.Payload) } - func (o *GetSalesReceiptsOK) GetPayload() *metrc_gw_models.SalesReceiptResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetSalesReceiptsUnauthorized() *GetSalesReceiptsUnauthorized { return &GetSalesReceiptsUnauthorized{} } -/*GetSalesReceiptsUnauthorized handles this case with default header values. +/* GetSalesReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetSalesReceiptsUnauthorized struct { func (o *GetSalesReceiptsUnauthorized) Error() string { return fmt.Sprintf("[GET /sales/receipts][%d] getSalesReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *GetSalesReceiptsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetSalesReceiptsForbidden() *GetSalesReceiptsForbidden { return &GetSalesReceiptsForbidden{} } -/*GetSalesReceiptsForbidden handles this case with default header values. +/* GetSalesReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetSalesReceiptsForbidden struct { func (o *GetSalesReceiptsForbidden) Error() string { return fmt.Sprintf("[GET /sales/receipts][%d] getSalesReceiptsForbidden %+v", 403, o.Payload) } - func (o *GetSalesReceiptsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetSalesReceiptsNotFound() *GetSalesReceiptsNotFound { return &GetSalesReceiptsNotFound{} } -/*GetSalesReceiptsNotFound handles this case with default header values. +/* GetSalesReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetSalesReceiptsNotFound struct { func (o *GetSalesReceiptsNotFound) Error() string { return fmt.Sprintf("[GET /sales/receipts][%d] getSalesReceiptsNotFound %+v", 404, o.Payload) } - func (o *GetSalesReceiptsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetSalesReceiptsInternalServerError() *GetSalesReceiptsInternalServerErr return &GetSalesReceiptsInternalServerError{} } -/*GetSalesReceiptsInternalServerError handles this case with default header values. +/* GetSalesReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetSalesReceiptsInternalServerError struct { func (o *GetSalesReceiptsInternalServerError) Error() string { return fmt.Sprintf("[GET /sales/receipts][%d] getSalesReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *GetSalesReceiptsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_parameters.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_parameters.go index 1b86f34..d568693 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSalesTransactionDatesParams creates a new GetSalesTransactionDatesParams object -// with the default values initialized. +// NewGetSalesTransactionDatesParams creates a new GetSalesTransactionDatesParams 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 NewGetSalesTransactionDatesParams() *GetSalesTransactionDatesParams { - var () return &GetSalesTransactionDatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetSalesTransactionDatesParamsWithTimeout creates a new GetSalesTransactionDatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSalesTransactionDatesParamsWithTimeout(timeout time.Duration) *GetSalesTransactionDatesParams { - var () return &GetSalesTransactionDatesParams{ - timeout: timeout, } } // NewGetSalesTransactionDatesParamsWithContext creates a new GetSalesTransactionDatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSalesTransactionDatesParamsWithContext(ctx context.Context) *GetSalesTransactionDatesParams { - var () return &GetSalesTransactionDatesParams{ - Context: ctx, } } // NewGetSalesTransactionDatesParamsWithHTTPClient creates a new GetSalesTransactionDatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSalesTransactionDatesParamsWithHTTPClient(client *http.Client) *GetSalesTransactionDatesParams { - var () return &GetSalesTransactionDatesParams{ HTTPClient: client, } } -/*GetSalesTransactionDatesParams contains all the parameters to send to the API endpoint -for the get sales transaction dates operation typically these are written to a http.Request +/* GetSalesTransactionDatesParams contains all the parameters to send to the API endpoint + for the get sales transaction dates operation. + + Typically these are written to a http.Request. */ type GetSalesTransactionDatesParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type GetSalesTransactionDatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get sales transaction dates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesTransactionDatesParams) WithDefaults() *GetSalesTransactionDatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get sales transaction dates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesTransactionDatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get sales transaction dates params func (o *GetSalesTransactionDatesParams) WithTimeout(timeout time.Duration) *GetSalesTransactionDatesParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *GetSalesTransactionDatesParams) WriteToRequest(r runtime.ClientRequest, qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -205,22 +224,24 @@ func (o *GetSalesTransactionDatesParams) WriteToRequest(r runtime.ClientRequest, // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -230,6 +251,7 @@ func (o *GetSalesTransactionDatesParams) WriteToRequest(r runtime.ClientRequest, qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -239,6 +261,7 @@ func (o *GetSalesTransactionDatesParams) WriteToRequest(r runtime.ClientRequest, qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_responses.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_responses.go index bbd941a..645dafa 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_transaction_dates_responses.go @@ -57,9 +57,8 @@ func (o *GetSalesTransactionDatesReader) ReadResponse(response runtime.ClientRes return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetSalesTransactionDatesOK() *GetSalesTransactionDatesOK { return &GetSalesTransactionDatesOK{} } -/*GetSalesTransactionDatesOK handles this case with default header values. +/* GetSalesTransactionDatesOK describes a response with status code 200, with default header values. A list of Sales Transaction Dates was succefully retrieved */ @@ -79,7 +78,6 @@ type GetSalesTransactionDatesOK struct { func (o *GetSalesTransactionDatesOK) Error() string { return fmt.Sprintf("[GET /sales/transactiondates][%d] getSalesTransactionDatesOK %+v", 200, o.Payload) } - func (o *GetSalesTransactionDatesOK) GetPayload() *metrc_gw_models.SalesTransactionDateResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetSalesTransactionDatesUnauthorized() *GetSalesTransactionDatesUnauthor return &GetSalesTransactionDatesUnauthorized{} } -/*GetSalesTransactionDatesUnauthorized handles this case with default header values. +/* GetSalesTransactionDatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetSalesTransactionDatesUnauthorized struct { func (o *GetSalesTransactionDatesUnauthorized) Error() string { return fmt.Sprintf("[GET /sales/transactiondates][%d] getSalesTransactionDatesUnauthorized %+v", 401, o.Payload) } - func (o *GetSalesTransactionDatesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetSalesTransactionDatesForbidden() *GetSalesTransactionDatesForbidden { return &GetSalesTransactionDatesForbidden{} } -/*GetSalesTransactionDatesForbidden handles this case with default header values. +/* GetSalesTransactionDatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetSalesTransactionDatesForbidden struct { func (o *GetSalesTransactionDatesForbidden) Error() string { return fmt.Sprintf("[GET /sales/transactiondates][%d] getSalesTransactionDatesForbidden %+v", 403, o.Payload) } - func (o *GetSalesTransactionDatesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetSalesTransactionDatesNotFound() *GetSalesTransactionDatesNotFound { return &GetSalesTransactionDatesNotFound{} } -/*GetSalesTransactionDatesNotFound handles this case with default header values. +/* GetSalesTransactionDatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetSalesTransactionDatesNotFound struct { func (o *GetSalesTransactionDatesNotFound) Error() string { return fmt.Sprintf("[GET /sales/transactiondates][%d] getSalesTransactionDatesNotFound %+v", 404, o.Payload) } - func (o *GetSalesTransactionDatesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetSalesTransactionDatesInternalServerError() *GetSalesTransactionDatesI return &GetSalesTransactionDatesInternalServerError{} } -/*GetSalesTransactionDatesInternalServerError handles this case with default header values. +/* GetSalesTransactionDatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetSalesTransactionDatesInternalServerError struct { func (o *GetSalesTransactionDatesInternalServerError) Error() string { return fmt.Sprintf("[GET /sales/transactiondates][%d] getSalesTransactionDatesInternalServerError %+v", 500, o.Payload) } - func (o *GetSalesTransactionDatesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_parameters.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_parameters.go index 9cda371..aa00ce2 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_parameters.go @@ -20,83 +20,88 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetSalesTransactionsParams creates a new GetSalesTransactionsParams object -// with the default values initialized. +// NewGetSalesTransactionsParams creates a new GetSalesTransactionsParams 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 NewGetSalesTransactionsParams() *GetSalesTransactionsParams { - var () return &GetSalesTransactionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetSalesTransactionsParamsWithTimeout creates a new GetSalesTransactionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSalesTransactionsParamsWithTimeout(timeout time.Duration) *GetSalesTransactionsParams { - var () return &GetSalesTransactionsParams{ - timeout: timeout, } } // NewGetSalesTransactionsParamsWithContext creates a new GetSalesTransactionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSalesTransactionsParamsWithContext(ctx context.Context) *GetSalesTransactionsParams { - var () return &GetSalesTransactionsParams{ - Context: ctx, } } // NewGetSalesTransactionsParamsWithHTTPClient creates a new GetSalesTransactionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSalesTransactionsParamsWithHTTPClient(client *http.Client) *GetSalesTransactionsParams { - var () return &GetSalesTransactionsParams{ HTTPClient: client, } } -/*GetSalesTransactionsParams contains all the parameters to send to the API endpoint -for the get sales transactions operation typically these are written to a http.Request +/* GetSalesTransactionsParams contains all the parameters to send to the API endpoint + for the get sales transactions operation. + + Typically these are written to a http.Request. */ type GetSalesTransactionsParams struct { - /*LastModifiedEnd - The last modified end timestamp + /* LastModifiedEnd. + The last modified end timestamp */ LastModifiedEnd *string - /*LastModifiedStart - The last modified start timestamp + /* LastModifiedStart. + + The last modified start timestamp */ LastModifiedStart *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*SalesReceiptID - The Sales Receipt Number + /* SalesReceiptID. + + The Sales Receipt Number */ SalesReceiptID *string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -105,6 +110,21 @@ type GetSalesTransactionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get sales transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesTransactionsParams) WithDefaults() *GetSalesTransactionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get sales transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesTransactionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get sales transactions params func (o *GetSalesTransactionsParams) WithTimeout(timeout time.Duration) *GetSalesTransactionsParams { o.SetTimeout(timeout) @@ -227,38 +247,41 @@ func (o *GetSalesTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg // query param lastModifiedEnd var qrLastModifiedEnd string + if o.LastModifiedEnd != nil { qrLastModifiedEnd = *o.LastModifiedEnd } qLastModifiedEnd := qrLastModifiedEnd if qLastModifiedEnd != "" { + if err := r.SetQueryParam("lastModifiedEnd", qLastModifiedEnd); err != nil { return err } } - } if o.LastModifiedStart != nil { // query param lastModifiedStart var qrLastModifiedStart string + if o.LastModifiedStart != nil { qrLastModifiedStart = *o.LastModifiedStart } qLastModifiedStart := qrLastModifiedStart if qLastModifiedStart != "" { + if err := r.SetQueryParam("lastModifiedStart", qLastModifiedStart); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -268,6 +291,7 @@ func (o *GetSalesTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -277,22 +301,24 @@ func (o *GetSalesTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg // query param salesReceiptId var qrSalesReceiptID string + if o.SalesReceiptID != nil { qrSalesReceiptID = *o.SalesReceiptID } qSalesReceiptID := qrSalesReceiptID if qSalesReceiptID != "" { + if err := r.SetQueryParam("salesReceiptId", qSalesReceiptID); err != nil { return err } } - } // query param state qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -302,6 +328,7 @@ func (o *GetSalesTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_responses.go b/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_responses.go index 2cf9359..9c1db58 100644 --- a/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/get_sales_transactions_responses.go @@ -57,9 +57,8 @@ func (o *GetSalesTransactionsReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetSalesTransactionsOK() *GetSalesTransactionsOK { return &GetSalesTransactionsOK{} } -/*GetSalesTransactionsOK handles this case with default header values. +/* GetSalesTransactionsOK describes a response with status code 200, with default header values. A list of active Sales Receipts was succefully retrieved */ @@ -79,7 +78,6 @@ type GetSalesTransactionsOK struct { func (o *GetSalesTransactionsOK) Error() string { return fmt.Sprintf("[GET /sales/transactions][%d] getSalesTransactionsOK %+v", 200, o.Payload) } - func (o *GetSalesTransactionsOK) GetPayload() *metrc_gw_models.TransactionResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetSalesTransactionsUnauthorized() *GetSalesTransactionsUnauthorized { return &GetSalesTransactionsUnauthorized{} } -/*GetSalesTransactionsUnauthorized handles this case with default header values. +/* GetSalesTransactionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetSalesTransactionsUnauthorized struct { func (o *GetSalesTransactionsUnauthorized) Error() string { return fmt.Sprintf("[GET /sales/transactions][%d] getSalesTransactionsUnauthorized %+v", 401, o.Payload) } - func (o *GetSalesTransactionsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetSalesTransactionsForbidden() *GetSalesTransactionsForbidden { return &GetSalesTransactionsForbidden{} } -/*GetSalesTransactionsForbidden handles this case with default header values. +/* GetSalesTransactionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetSalesTransactionsForbidden struct { func (o *GetSalesTransactionsForbidden) Error() string { return fmt.Sprintf("[GET /sales/transactions][%d] getSalesTransactionsForbidden %+v", 403, o.Payload) } - func (o *GetSalesTransactionsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetSalesTransactionsNotFound() *GetSalesTransactionsNotFound { return &GetSalesTransactionsNotFound{} } -/*GetSalesTransactionsNotFound handles this case with default header values. +/* GetSalesTransactionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetSalesTransactionsNotFound struct { func (o *GetSalesTransactionsNotFound) Error() string { return fmt.Sprintf("[GET /sales/transactions][%d] getSalesTransactionsNotFound %+v", 404, o.Payload) } - func (o *GetSalesTransactionsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetSalesTransactionsInternalServerError() *GetSalesTransactionsInternalS return &GetSalesTransactionsInternalServerError{} } -/*GetSalesTransactionsInternalServerError handles this case with default header values. +/* GetSalesTransactionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetSalesTransactionsInternalServerError struct { func (o *GetSalesTransactionsInternalServerError) Error() string { return fmt.Sprintf("[GET /sales/transactions][%d] getSalesTransactionsInternalServerError %+v", 500, o.Payload) } - func (o *GetSalesTransactionsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_parameters.go b/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_parameters.go index 57124af..8bb0ac7 100644 --- a/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostSalesDeliveriesParams creates a new PostSalesDeliveriesParams object -// with the default values initialized. +// NewPostSalesDeliveriesParams creates a new PostSalesDeliveriesParams 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 NewPostSalesDeliveriesParams() *PostSalesDeliveriesParams { - var () return &PostSalesDeliveriesParams{ - timeout: cr.DefaultTimeout, } } // NewPostSalesDeliveriesParamsWithTimeout creates a new PostSalesDeliveriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostSalesDeliveriesParamsWithTimeout(timeout time.Duration) *PostSalesDeliveriesParams { - var () return &PostSalesDeliveriesParams{ - timeout: timeout, } } // NewPostSalesDeliveriesParamsWithContext creates a new PostSalesDeliveriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostSalesDeliveriesParamsWithContext(ctx context.Context) *PostSalesDeliveriesParams { - var () return &PostSalesDeliveriesParams{ - Context: ctx, } } // NewPostSalesDeliveriesParamsWithHTTPClient creates a new PostSalesDeliveriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostSalesDeliveriesParamsWithHTTPClient(client *http.Client) *PostSalesDeliveriesParams { - var () return &PostSalesDeliveriesParams{ HTTPClient: client, } } -/*PostSalesDeliveriesParams contains all the parameters to send to the API endpoint -for the post sales deliveries operation typically these are written to a http.Request +/* PostSalesDeliveriesParams contains all the parameters to send to the API endpoint + for the post sales deliveries operation. + + Typically these are written to a http.Request. */ type PostSalesDeliveriesParams struct { - /*SalesDeliveryRequest - The New Sales Deliveries + /* SalesDeliveryRequest. + The New Sales Deliveries */ SalesDeliveryRequest *metrc_gw_models.SalesDeliveryRequest @@ -77,6 +76,21 @@ type PostSalesDeliveriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post sales deliveries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSalesDeliveriesParams) WithDefaults() *PostSalesDeliveriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post sales deliveries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSalesDeliveriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post sales deliveries params func (o *PostSalesDeliveriesParams) WithTimeout(timeout time.Duration) *PostSalesDeliveriesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostSalesDeliveriesParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.SalesDeliveryRequest != nil { if err := r.SetBodyParam(o.SalesDeliveryRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_responses.go b/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_responses.go index 2bced53..488cf3c 100644 --- a/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/post_sales_deliveries_responses.go @@ -57,9 +57,8 @@ func (o *PostSalesDeliveriesReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostSalesDeliveriesOK() *PostSalesDeliveriesOK { return &PostSalesDeliveriesOK{} } -/*PostSalesDeliveriesOK handles this case with default header values. +/* PostSalesDeliveriesOK describes a response with status code 200, with default header values. An array of Sales Delivery records with the new IDs */ @@ -79,7 +78,6 @@ type PostSalesDeliveriesOK struct { func (o *PostSalesDeliveriesOK) Error() string { return fmt.Sprintf("[POST /sales/deliveries][%d] postSalesDeliveriesOK %+v", 200, o.Payload) } - func (o *PostSalesDeliveriesOK) GetPayload() *metrc_gw_models.SalesDeliveryResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostSalesDeliveriesUnauthorized() *PostSalesDeliveriesUnauthorized { return &PostSalesDeliveriesUnauthorized{} } -/*PostSalesDeliveriesUnauthorized handles this case with default header values. +/* PostSalesDeliveriesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostSalesDeliveriesUnauthorized struct { func (o *PostSalesDeliveriesUnauthorized) Error() string { return fmt.Sprintf("[POST /sales/deliveries][%d] postSalesDeliveriesUnauthorized %+v", 401, o.Payload) } - func (o *PostSalesDeliveriesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostSalesDeliveriesForbidden() *PostSalesDeliveriesForbidden { return &PostSalesDeliveriesForbidden{} } -/*PostSalesDeliveriesForbidden handles this case with default header values. +/* PostSalesDeliveriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostSalesDeliveriesForbidden struct { func (o *PostSalesDeliveriesForbidden) Error() string { return fmt.Sprintf("[POST /sales/deliveries][%d] postSalesDeliveriesForbidden %+v", 403, o.Payload) } - func (o *PostSalesDeliveriesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostSalesDeliveriesNotFound() *PostSalesDeliveriesNotFound { return &PostSalesDeliveriesNotFound{} } -/*PostSalesDeliveriesNotFound handles this case with default header values. +/* PostSalesDeliveriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostSalesDeliveriesNotFound struct { func (o *PostSalesDeliveriesNotFound) Error() string { return fmt.Sprintf("[POST /sales/deliveries][%d] postSalesDeliveriesNotFound %+v", 404, o.Payload) } - func (o *PostSalesDeliveriesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostSalesDeliveriesInternalServerError() *PostSalesDeliveriesInternalSer return &PostSalesDeliveriesInternalServerError{} } -/*PostSalesDeliveriesInternalServerError handles this case with default header values. +/* PostSalesDeliveriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostSalesDeliveriesInternalServerError struct { func (o *PostSalesDeliveriesInternalServerError) Error() string { return fmt.Sprintf("[POST /sales/deliveries][%d] postSalesDeliveriesInternalServerError %+v", 500, o.Payload) } - func (o *PostSalesDeliveriesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_parameters.go b/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_parameters.go index 90f4b5f..96c798c 100644 --- a/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostSalesReceiptsParams creates a new PostSalesReceiptsParams object -// with the default values initialized. +// NewPostSalesReceiptsParams creates a new PostSalesReceiptsParams 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 NewPostSalesReceiptsParams() *PostSalesReceiptsParams { - var () return &PostSalesReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewPostSalesReceiptsParamsWithTimeout creates a new PostSalesReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostSalesReceiptsParamsWithTimeout(timeout time.Duration) *PostSalesReceiptsParams { - var () return &PostSalesReceiptsParams{ - timeout: timeout, } } // NewPostSalesReceiptsParamsWithContext creates a new PostSalesReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostSalesReceiptsParamsWithContext(ctx context.Context) *PostSalesReceiptsParams { - var () return &PostSalesReceiptsParams{ - Context: ctx, } } // NewPostSalesReceiptsParamsWithHTTPClient creates a new PostSalesReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostSalesReceiptsParamsWithHTTPClient(client *http.Client) *PostSalesReceiptsParams { - var () return &PostSalesReceiptsParams{ HTTPClient: client, } } -/*PostSalesReceiptsParams contains all the parameters to send to the API endpoint -for the post sales receipts operation typically these are written to a http.Request +/* PostSalesReceiptsParams contains all the parameters to send to the API endpoint + for the post sales receipts operation. + + Typically these are written to a http.Request. */ type PostSalesReceiptsParams struct { - /*SalesReceiptRequest - The New Sales Receipts + /* SalesReceiptRequest. + The New Sales Receipts */ SalesReceiptRequest *metrc_gw_models.SalesReceiptRequest @@ -77,6 +76,21 @@ type PostSalesReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSalesReceiptsParams) WithDefaults() *PostSalesReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSalesReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post sales receipts params func (o *PostSalesReceiptsParams) WithTimeout(timeout time.Duration) *PostSalesReceiptsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.SalesReceiptRequest != nil { if err := r.SetBodyParam(o.SalesReceiptRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_responses.go b/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_responses.go index b61b0a9..7d39013 100644 --- a/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/post_sales_receipts_responses.go @@ -57,9 +57,8 @@ func (o *PostSalesReceiptsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostSalesReceiptsOK() *PostSalesReceiptsOK { return &PostSalesReceiptsOK{} } -/*PostSalesReceiptsOK handles this case with default header values. +/* PostSalesReceiptsOK describes a response with status code 200, with default header values. An array of Sales Receipt records with the new IDs */ @@ -79,7 +78,6 @@ type PostSalesReceiptsOK struct { func (o *PostSalesReceiptsOK) Error() string { return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsOK %+v", 200, o.Payload) } - func (o *PostSalesReceiptsOK) GetPayload() *metrc_gw_models.SalesReceiptResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostSalesReceiptsUnauthorized() *PostSalesReceiptsUnauthorized { return &PostSalesReceiptsUnauthorized{} } -/*PostSalesReceiptsUnauthorized handles this case with default header values. +/* PostSalesReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostSalesReceiptsUnauthorized struct { func (o *PostSalesReceiptsUnauthorized) Error() string { return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *PostSalesReceiptsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostSalesReceiptsForbidden() *PostSalesReceiptsForbidden { return &PostSalesReceiptsForbidden{} } -/*PostSalesReceiptsForbidden handles this case with default header values. +/* PostSalesReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostSalesReceiptsForbidden struct { func (o *PostSalesReceiptsForbidden) Error() string { return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsForbidden %+v", 403, o.Payload) } - func (o *PostSalesReceiptsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostSalesReceiptsNotFound() *PostSalesReceiptsNotFound { return &PostSalesReceiptsNotFound{} } -/*PostSalesReceiptsNotFound handles this case with default header values. +/* PostSalesReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostSalesReceiptsNotFound struct { func (o *PostSalesReceiptsNotFound) Error() string { return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsNotFound %+v", 404, o.Payload) } - func (o *PostSalesReceiptsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostSalesReceiptsInternalServerError() *PostSalesReceiptsInternalServerE return &PostSalesReceiptsInternalServerError{} } -/*PostSalesReceiptsInternalServerError handles this case with default header values. +/* PostSalesReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostSalesReceiptsInternalServerError struct { func (o *PostSalesReceiptsInternalServerError) Error() string { return fmt.Sprintf("[POST /sales/receipts][%d] postSalesReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *PostSalesReceiptsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_parameters.go b/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_parameters.go index eefac6d..edf4e72 100644 --- a/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostSalesTransactionsParams creates a new PostSalesTransactionsParams object -// with the default values initialized. +// NewPostSalesTransactionsParams creates a new PostSalesTransactionsParams 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 NewPostSalesTransactionsParams() *PostSalesTransactionsParams { - var () return &PostSalesTransactionsParams{ - timeout: cr.DefaultTimeout, } } // NewPostSalesTransactionsParamsWithTimeout creates a new PostSalesTransactionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostSalesTransactionsParamsWithTimeout(timeout time.Duration) *PostSalesTransactionsParams { - var () return &PostSalesTransactionsParams{ - timeout: timeout, } } // NewPostSalesTransactionsParamsWithContext creates a new PostSalesTransactionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostSalesTransactionsParamsWithContext(ctx context.Context) *PostSalesTransactionsParams { - var () return &PostSalesTransactionsParams{ - Context: ctx, } } // NewPostSalesTransactionsParamsWithHTTPClient creates a new PostSalesTransactionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostSalesTransactionsParamsWithHTTPClient(client *http.Client) *PostSalesTransactionsParams { - var () return &PostSalesTransactionsParams{ HTTPClient: client, } } -/*PostSalesTransactionsParams contains all the parameters to send to the API endpoint -for the post sales transactions operation typically these are written to a http.Request +/* PostSalesTransactionsParams contains all the parameters to send to the API endpoint + for the post sales transactions operation. + + Typically these are written to a http.Request. */ type PostSalesTransactionsParams struct { - /*SalesTransactionRequest - The New Sales Transactions + /* SalesTransactionRequest. + The New Sales Transactions */ SalesTransactionRequest *metrc_gw_models.TransactionRequest @@ -77,6 +76,21 @@ type PostSalesTransactionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post sales transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSalesTransactionsParams) WithDefaults() *PostSalesTransactionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post sales transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSalesTransactionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post sales transactions params func (o *PostSalesTransactionsParams) WithTimeout(timeout time.Duration) *PostSalesTransactionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostSalesTransactionsParams) WriteToRequest(r runtime.ClientRequest, re return err } var res []error - if o.SalesTransactionRequest != nil { if err := r.SetBodyParam(o.SalesTransactionRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_responses.go b/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_responses.go index 06fb792..7308d16 100644 --- a/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/post_sales_transactions_responses.go @@ -57,9 +57,8 @@ func (o *PostSalesTransactionsReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostSalesTransactionsOK() *PostSalesTransactionsOK { return &PostSalesTransactionsOK{} } -/*PostSalesTransactionsOK handles this case with default header values. +/* PostSalesTransactionsOK describes a response with status code 200, with default header values. An array of Sales Transaction records with the new IDs */ @@ -79,7 +78,6 @@ type PostSalesTransactionsOK struct { func (o *PostSalesTransactionsOK) Error() string { return fmt.Sprintf("[POST /sales/transactions][%d] postSalesTransactionsOK %+v", 200, o.Payload) } - func (o *PostSalesTransactionsOK) GetPayload() *metrc_gw_models.TransactionResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostSalesTransactionsUnauthorized() *PostSalesTransactionsUnauthorized { return &PostSalesTransactionsUnauthorized{} } -/*PostSalesTransactionsUnauthorized handles this case with default header values. +/* PostSalesTransactionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostSalesTransactionsUnauthorized struct { func (o *PostSalesTransactionsUnauthorized) Error() string { return fmt.Sprintf("[POST /sales/transactions][%d] postSalesTransactionsUnauthorized %+v", 401, o.Payload) } - func (o *PostSalesTransactionsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostSalesTransactionsForbidden() *PostSalesTransactionsForbidden { return &PostSalesTransactionsForbidden{} } -/*PostSalesTransactionsForbidden handles this case with default header values. +/* PostSalesTransactionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostSalesTransactionsForbidden struct { func (o *PostSalesTransactionsForbidden) Error() string { return fmt.Sprintf("[POST /sales/transactions][%d] postSalesTransactionsForbidden %+v", 403, o.Payload) } - func (o *PostSalesTransactionsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostSalesTransactionsNotFound() *PostSalesTransactionsNotFound { return &PostSalesTransactionsNotFound{} } -/*PostSalesTransactionsNotFound handles this case with default header values. +/* PostSalesTransactionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostSalesTransactionsNotFound struct { func (o *PostSalesTransactionsNotFound) Error() string { return fmt.Sprintf("[POST /sales/transactions][%d] postSalesTransactionsNotFound %+v", 404, o.Payload) } - func (o *PostSalesTransactionsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostSalesTransactionsInternalServerError() *PostSalesTransactionsInterna return &PostSalesTransactionsInternalServerError{} } -/*PostSalesTransactionsInternalServerError handles this case with default header values. +/* PostSalesTransactionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostSalesTransactionsInternalServerError struct { func (o *PostSalesTransactionsInternalServerError) Error() string { return fmt.Sprintf("[POST /sales/transactions][%d] postSalesTransactionsInternalServerError %+v", 500, o.Payload) } - func (o *PostSalesTransactionsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_parameters.go b/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_parameters.go index 50317b8..89f40d2 100644 --- a/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutSalesDeliveriesParams creates a new PutSalesDeliveriesParams object -// with the default values initialized. +// NewPutSalesDeliveriesParams creates a new PutSalesDeliveriesParams 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 NewPutSalesDeliveriesParams() *PutSalesDeliveriesParams { - var () return &PutSalesDeliveriesParams{ - timeout: cr.DefaultTimeout, } } // NewPutSalesDeliveriesParamsWithTimeout creates a new PutSalesDeliveriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutSalesDeliveriesParamsWithTimeout(timeout time.Duration) *PutSalesDeliveriesParams { - var () return &PutSalesDeliveriesParams{ - timeout: timeout, } } // NewPutSalesDeliveriesParamsWithContext creates a new PutSalesDeliveriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutSalesDeliveriesParamsWithContext(ctx context.Context) *PutSalesDeliveriesParams { - var () return &PutSalesDeliveriesParams{ - Context: ctx, } } // NewPutSalesDeliveriesParamsWithHTTPClient creates a new PutSalesDeliveriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutSalesDeliveriesParamsWithHTTPClient(client *http.Client) *PutSalesDeliveriesParams { - var () return &PutSalesDeliveriesParams{ HTTPClient: client, } } -/*PutSalesDeliveriesParams contains all the parameters to send to the API endpoint -for the put sales deliveries operation typically these are written to a http.Request +/* PutSalesDeliveriesParams contains all the parameters to send to the API endpoint + for the put sales deliveries operation. + + Typically these are written to a http.Request. */ type PutSalesDeliveriesParams struct { - /*SalesDeliveryRequest - The New Sales Deliveries + /* SalesDeliveryRequest. + The New Sales Deliveries */ SalesDeliveryRequest *metrc_gw_models.SalesDeliveryRequest @@ -77,6 +76,21 @@ type PutSalesDeliveriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put sales deliveries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSalesDeliveriesParams) WithDefaults() *PutSalesDeliveriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put sales deliveries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSalesDeliveriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put sales deliveries params func (o *PutSalesDeliveriesParams) WithTimeout(timeout time.Duration) *PutSalesDeliveriesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutSalesDeliveriesParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if o.SalesDeliveryRequest != nil { if err := r.SetBodyParam(o.SalesDeliveryRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_responses.go b/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_responses.go index ba9b294..0bd066c 100644 --- a/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/put_sales_deliveries_responses.go @@ -57,9 +57,8 @@ func (o *PutSalesDeliveriesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutSalesDeliveriesOK() *PutSalesDeliveriesOK { return &PutSalesDeliveriesOK{} } -/*PutSalesDeliveriesOK handles this case with default header values. +/* PutSalesDeliveriesOK describes a response with status code 200, with default header values. An array of Sales Delivery records with the new IDs */ @@ -79,7 +78,6 @@ type PutSalesDeliveriesOK struct { func (o *PutSalesDeliveriesOK) Error() string { return fmt.Sprintf("[PUT /sales/deliveries][%d] putSalesDeliveriesOK %+v", 200, o.Payload) } - func (o *PutSalesDeliveriesOK) GetPayload() *metrc_gw_models.SalesDeliveryResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutSalesDeliveriesUnauthorized() *PutSalesDeliveriesUnauthorized { return &PutSalesDeliveriesUnauthorized{} } -/*PutSalesDeliveriesUnauthorized handles this case with default header values. +/* PutSalesDeliveriesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutSalesDeliveriesUnauthorized struct { func (o *PutSalesDeliveriesUnauthorized) Error() string { return fmt.Sprintf("[PUT /sales/deliveries][%d] putSalesDeliveriesUnauthorized %+v", 401, o.Payload) } - func (o *PutSalesDeliveriesUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutSalesDeliveriesForbidden() *PutSalesDeliveriesForbidden { return &PutSalesDeliveriesForbidden{} } -/*PutSalesDeliveriesForbidden handles this case with default header values. +/* PutSalesDeliveriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutSalesDeliveriesForbidden struct { func (o *PutSalesDeliveriesForbidden) Error() string { return fmt.Sprintf("[PUT /sales/deliveries][%d] putSalesDeliveriesForbidden %+v", 403, o.Payload) } - func (o *PutSalesDeliveriesForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutSalesDeliveriesNotFound() *PutSalesDeliveriesNotFound { return &PutSalesDeliveriesNotFound{} } -/*PutSalesDeliveriesNotFound handles this case with default header values. +/* PutSalesDeliveriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutSalesDeliveriesNotFound struct { func (o *PutSalesDeliveriesNotFound) Error() string { return fmt.Sprintf("[PUT /sales/deliveries][%d] putSalesDeliveriesNotFound %+v", 404, o.Payload) } - func (o *PutSalesDeliveriesNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutSalesDeliveriesInternalServerError() *PutSalesDeliveriesInternalServe return &PutSalesDeliveriesInternalServerError{} } -/*PutSalesDeliveriesInternalServerError handles this case with default header values. +/* PutSalesDeliveriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutSalesDeliveriesInternalServerError struct { func (o *PutSalesDeliveriesInternalServerError) Error() string { return fmt.Sprintf("[PUT /sales/deliveries][%d] putSalesDeliveriesInternalServerError %+v", 500, o.Payload) } - func (o *PutSalesDeliveriesInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_parameters.go b/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_parameters.go index a1f9678..11c693f 100644 --- a/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutSalesReceiptsParams creates a new PutSalesReceiptsParams object -// with the default values initialized. +// NewPutSalesReceiptsParams creates a new PutSalesReceiptsParams 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 NewPutSalesReceiptsParams() *PutSalesReceiptsParams { - var () return &PutSalesReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewPutSalesReceiptsParamsWithTimeout creates a new PutSalesReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutSalesReceiptsParamsWithTimeout(timeout time.Duration) *PutSalesReceiptsParams { - var () return &PutSalesReceiptsParams{ - timeout: timeout, } } // NewPutSalesReceiptsParamsWithContext creates a new PutSalesReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutSalesReceiptsParamsWithContext(ctx context.Context) *PutSalesReceiptsParams { - var () return &PutSalesReceiptsParams{ - Context: ctx, } } // NewPutSalesReceiptsParamsWithHTTPClient creates a new PutSalesReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutSalesReceiptsParamsWithHTTPClient(client *http.Client) *PutSalesReceiptsParams { - var () return &PutSalesReceiptsParams{ HTTPClient: client, } } -/*PutSalesReceiptsParams contains all the parameters to send to the API endpoint -for the put sales receipts operation typically these are written to a http.Request +/* PutSalesReceiptsParams contains all the parameters to send to the API endpoint + for the put sales receipts operation. + + Typically these are written to a http.Request. */ type PutSalesReceiptsParams struct { - /*SalesReceiptRequest - The Existing Sales Receipts + /* SalesReceiptRequest. + The Existing Sales Receipts */ SalesReceiptRequest *metrc_gw_models.SalesReceiptRequest @@ -77,6 +76,21 @@ type PutSalesReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSalesReceiptsParams) WithDefaults() *PutSalesReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put sales receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSalesReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put sales receipts params func (o *PutSalesReceiptsParams) WithTimeout(timeout time.Duration) *PutSalesReceiptsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutSalesReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.SalesReceiptRequest != nil { if err := r.SetBodyParam(o.SalesReceiptRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_responses.go b/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_responses.go index dd7c3a3..6495828 100644 --- a/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/put_sales_receipts_responses.go @@ -57,9 +57,8 @@ func (o *PutSalesReceiptsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutSalesReceiptsOK() *PutSalesReceiptsOK { return &PutSalesReceiptsOK{} } -/*PutSalesReceiptsOK handles this case with default header values. +/* PutSalesReceiptsOK describes a response with status code 200, with default header values. An array of Sales Receipt records with the existing IDs */ @@ -79,7 +78,6 @@ type PutSalesReceiptsOK struct { func (o *PutSalesReceiptsOK) Error() string { return fmt.Sprintf("[PUT /sales/receipts][%d] putSalesReceiptsOK %+v", 200, o.Payload) } - func (o *PutSalesReceiptsOK) GetPayload() *metrc_gw_models.SalesReceiptResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutSalesReceiptsUnauthorized() *PutSalesReceiptsUnauthorized { return &PutSalesReceiptsUnauthorized{} } -/*PutSalesReceiptsUnauthorized handles this case with default header values. +/* PutSalesReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutSalesReceiptsUnauthorized struct { func (o *PutSalesReceiptsUnauthorized) Error() string { return fmt.Sprintf("[PUT /sales/receipts][%d] putSalesReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *PutSalesReceiptsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutSalesReceiptsForbidden() *PutSalesReceiptsForbidden { return &PutSalesReceiptsForbidden{} } -/*PutSalesReceiptsForbidden handles this case with default header values. +/* PutSalesReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutSalesReceiptsForbidden struct { func (o *PutSalesReceiptsForbidden) Error() string { return fmt.Sprintf("[PUT /sales/receipts][%d] putSalesReceiptsForbidden %+v", 403, o.Payload) } - func (o *PutSalesReceiptsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutSalesReceiptsNotFound() *PutSalesReceiptsNotFound { return &PutSalesReceiptsNotFound{} } -/*PutSalesReceiptsNotFound handles this case with default header values. +/* PutSalesReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutSalesReceiptsNotFound struct { func (o *PutSalesReceiptsNotFound) Error() string { return fmt.Sprintf("[PUT /sales/receipts][%d] putSalesReceiptsNotFound %+v", 404, o.Payload) } - func (o *PutSalesReceiptsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutSalesReceiptsInternalServerError() *PutSalesReceiptsInternalServerErr return &PutSalesReceiptsInternalServerError{} } -/*PutSalesReceiptsInternalServerError handles this case with default header values. +/* PutSalesReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutSalesReceiptsInternalServerError struct { func (o *PutSalesReceiptsInternalServerError) Error() string { return fmt.Sprintf("[PUT /sales/receipts][%d] putSalesReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *PutSalesReceiptsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_parameters.go b/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_parameters.go index 1d3ffe9..63390d2 100644 --- a/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutSalesTransactionsParams creates a new PutSalesTransactionsParams object -// with the default values initialized. +// NewPutSalesTransactionsParams creates a new PutSalesTransactionsParams 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 NewPutSalesTransactionsParams() *PutSalesTransactionsParams { - var () return &PutSalesTransactionsParams{ - timeout: cr.DefaultTimeout, } } // NewPutSalesTransactionsParamsWithTimeout creates a new PutSalesTransactionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutSalesTransactionsParamsWithTimeout(timeout time.Duration) *PutSalesTransactionsParams { - var () return &PutSalesTransactionsParams{ - timeout: timeout, } } // NewPutSalesTransactionsParamsWithContext creates a new PutSalesTransactionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutSalesTransactionsParamsWithContext(ctx context.Context) *PutSalesTransactionsParams { - var () return &PutSalesTransactionsParams{ - Context: ctx, } } // NewPutSalesTransactionsParamsWithHTTPClient creates a new PutSalesTransactionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutSalesTransactionsParamsWithHTTPClient(client *http.Client) *PutSalesTransactionsParams { - var () return &PutSalesTransactionsParams{ HTTPClient: client, } } -/*PutSalesTransactionsParams contains all the parameters to send to the API endpoint -for the put sales transactions operation typically these are written to a http.Request +/* PutSalesTransactionsParams contains all the parameters to send to the API endpoint + for the put sales transactions operation. + + Typically these are written to a http.Request. */ type PutSalesTransactionsParams struct { - /*SalesTransactionRequest - The New Sales Transactions + /* SalesTransactionRequest. + The New Sales Transactions */ SalesTransactionRequest *metrc_gw_models.TransactionRequest @@ -77,6 +76,21 @@ type PutSalesTransactionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put sales transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSalesTransactionsParams) WithDefaults() *PutSalesTransactionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put sales transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSalesTransactionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put sales transactions params func (o *PutSalesTransactionsParams) WithTimeout(timeout time.Duration) *PutSalesTransactionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutSalesTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.SalesTransactionRequest != nil { if err := r.SetBodyParam(o.SalesTransactionRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_responses.go b/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_responses.go index 2ddc45d..edc7fb3 100644 --- a/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_responses.go +++ b/api/metrc-gw/metrc_gw_client/sales/put_sales_transactions_responses.go @@ -57,9 +57,8 @@ func (o *PutSalesTransactionsReader) ReadResponse(response runtime.ClientRespons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutSalesTransactionsOK() *PutSalesTransactionsOK { return &PutSalesTransactionsOK{} } -/*PutSalesTransactionsOK handles this case with default header values. +/* PutSalesTransactionsOK describes a response with status code 200, with default header values. An array of Sales Transaction records with the existing IDs */ @@ -79,7 +78,6 @@ type PutSalesTransactionsOK struct { func (o *PutSalesTransactionsOK) Error() string { return fmt.Sprintf("[PUT /sales/transactions][%d] putSalesTransactionsOK %+v", 200, o.Payload) } - func (o *PutSalesTransactionsOK) GetPayload() *metrc_gw_models.TransactionResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutSalesTransactionsUnauthorized() *PutSalesTransactionsUnauthorized { return &PutSalesTransactionsUnauthorized{} } -/*PutSalesTransactionsUnauthorized handles this case with default header values. +/* PutSalesTransactionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutSalesTransactionsUnauthorized struct { func (o *PutSalesTransactionsUnauthorized) Error() string { return fmt.Sprintf("[PUT /sales/transactions][%d] putSalesTransactionsUnauthorized %+v", 401, o.Payload) } - func (o *PutSalesTransactionsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutSalesTransactionsForbidden() *PutSalesTransactionsForbidden { return &PutSalesTransactionsForbidden{} } -/*PutSalesTransactionsForbidden handles this case with default header values. +/* PutSalesTransactionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutSalesTransactionsForbidden struct { func (o *PutSalesTransactionsForbidden) Error() string { return fmt.Sprintf("[PUT /sales/transactions][%d] putSalesTransactionsForbidden %+v", 403, o.Payload) } - func (o *PutSalesTransactionsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutSalesTransactionsNotFound() *PutSalesTransactionsNotFound { return &PutSalesTransactionsNotFound{} } -/*PutSalesTransactionsNotFound handles this case with default header values. +/* PutSalesTransactionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutSalesTransactionsNotFound struct { func (o *PutSalesTransactionsNotFound) Error() string { return fmt.Sprintf("[PUT /sales/transactions][%d] putSalesTransactionsNotFound %+v", 404, o.Payload) } - func (o *PutSalesTransactionsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutSalesTransactionsInternalServerError() *PutSalesTransactionsInternalS return &PutSalesTransactionsInternalServerError{} } -/*PutSalesTransactionsInternalServerError handles this case with default header values. +/* PutSalesTransactionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutSalesTransactionsInternalServerError struct { func (o *PutSalesTransactionsInternalServerError) Error() string { return fmt.Sprintf("[PUT /sales/transactions][%d] putSalesTransactionsInternalServerError %+v", 500, o.Payload) } - func (o *PutSalesTransactionsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/sales/sales_client.go b/api/metrc-gw/metrc_gw_client/sales/sales_client.go index bae7582..57dd02b 100644 --- a/api/metrc-gw/metrc_gw_client/sales/sales_client.go +++ b/api/metrc-gw/metrc_gw_client/sales/sales_client.go @@ -29,35 +29,38 @@ type Client struct { 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 { - DeleteSalesDelivery(params *DeleteSalesDeliveryParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSalesDeliveryOK, error) + DeleteSalesDelivery(params *DeleteSalesDeliveryParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSalesDeliveryOK, error) - DeleteSalesReceipts(params *DeleteSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSalesReceiptsOK, error) + DeleteSalesReceipts(params *DeleteSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSalesReceiptsOK, error) - GetCustomerTypes(params *GetCustomerTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCustomerTypesOK, error) + GetCustomerTypes(params *GetCustomerTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCustomerTypesOK, error) - GetSalesDeliveries(params *GetSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesDeliveriesOK, error) + GetSalesDeliveries(params *GetSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesDeliveriesOK, error) - GetSalesDeliveryReturnReasons(params *GetSalesDeliveryReturnReasonsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesDeliveryReturnReasonsOK, error) + GetSalesDeliveryReturnReasons(params *GetSalesDeliveryReturnReasonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesDeliveryReturnReasonsOK, error) - GetSalesReceipts(params *GetSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesReceiptsOK, error) + GetSalesReceipts(params *GetSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesReceiptsOK, error) - GetSalesTransactionDates(params *GetSalesTransactionDatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesTransactionDatesOK, error) + GetSalesTransactionDates(params *GetSalesTransactionDatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesTransactionDatesOK, error) - GetSalesTransactions(params *GetSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesTransactionsOK, error) + GetSalesTransactions(params *GetSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesTransactionsOK, error) - PostSalesDeliveries(params *PostSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter) (*PostSalesDeliveriesOK, error) + PostSalesDeliveries(params *PostSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSalesDeliveriesOK, error) - PostSalesReceipts(params *PostSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSalesReceiptsOK, error) + PostSalesReceipts(params *PostSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSalesReceiptsOK, error) - PostSalesTransactions(params *PostSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSalesTransactionsOK, error) + PostSalesTransactions(params *PostSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSalesTransactionsOK, error) - PutSalesDeliveries(params *PutSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter) (*PutSalesDeliveriesOK, error) + PutSalesDeliveries(params *PutSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSalesDeliveriesOK, error) - PutSalesReceipts(params *PutSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSalesReceiptsOK, error) + PutSalesReceipts(params *PutSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSalesReceiptsOK, error) - PutSalesTransactions(params *PutSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSalesTransactionsOK, error) + PutSalesTransactions(params *PutSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSalesTransactionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -68,13 +71,12 @@ type ClientService interface { Delete a Sales Delivery for this User-License */ -func (a *Client) DeleteSalesDelivery(params *DeleteSalesDeliveryParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSalesDeliveryOK, error) { +func (a *Client) DeleteSalesDelivery(params *DeleteSalesDeliveryParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSalesDeliveryOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteSalesDeliveryParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteSalesDelivery", Method: "DELETE", PathPattern: "/sales/deliveries", @@ -86,7 +88,12 @@ func (a *Client) DeleteSalesDelivery(params *DeleteSalesDeliveryParams, authInfo 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 } @@ -106,13 +113,12 @@ func (a *Client) DeleteSalesDelivery(params *DeleteSalesDeliveryParams, authInfo Delete a Sales Receipt for this User-License */ -func (a *Client) DeleteSalesReceipts(params *DeleteSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSalesReceiptsOK, error) { +func (a *Client) DeleteSalesReceipts(params *DeleteSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSalesReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteSalesReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteSalesReceipts", Method: "DELETE", PathPattern: "/sales/receipts", @@ -124,7 +130,12 @@ func (a *Client) DeleteSalesReceipts(params *DeleteSalesReceiptsParams, authInfo 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 } @@ -144,13 +155,12 @@ func (a *Client) DeleteSalesReceipts(params *DeleteSalesReceiptsParams, authInfo Get Customer Types for this User */ -func (a *Client) GetCustomerTypes(params *GetCustomerTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCustomerTypesOK, error) { +func (a *Client) GetCustomerTypes(params *GetCustomerTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCustomerTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCustomerTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCustomerTypes", Method: "GET", PathPattern: "/sales/customertypes", @@ -162,7 +172,12 @@ func (a *Client) GetCustomerTypes(params *GetCustomerTypesParams, authInfo runti 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 } @@ -182,13 +197,12 @@ func (a *Client) GetCustomerTypes(params *GetCustomerTypesParams, authInfo runti Deliveries for this User-License */ -func (a *Client) GetSalesDeliveries(params *GetSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesDeliveriesOK, error) { +func (a *Client) GetSalesDeliveries(params *GetSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesDeliveriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSalesDeliveriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSalesDeliveries", Method: "GET", PathPattern: "/sales/deliveries", @@ -200,7 +214,12 @@ func (a *Client) GetSalesDeliveries(params *GetSalesDeliveriesParams, authInfo r 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 } @@ -220,13 +239,12 @@ func (a *Client) GetSalesDeliveries(params *GetSalesDeliveriesParams, authInfo r Delivery Return Reasons for this User-License */ -func (a *Client) GetSalesDeliveryReturnReasons(params *GetSalesDeliveryReturnReasonsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesDeliveryReturnReasonsOK, error) { +func (a *Client) GetSalesDeliveryReturnReasons(params *GetSalesDeliveryReturnReasonsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesDeliveryReturnReasonsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSalesDeliveryReturnReasonsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSalesDeliveryReturnReasons", Method: "GET", PathPattern: "/sales/deliveries/returnreasons", @@ -238,7 +256,12 @@ func (a *Client) GetSalesDeliveryReturnReasons(params *GetSalesDeliveryReturnRea 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 } @@ -258,13 +281,12 @@ func (a *Client) GetSalesDeliveryReturnReasons(params *GetSalesDeliveryReturnRea Sales Receipts for this User-License */ -func (a *Client) GetSalesReceipts(params *GetSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesReceiptsOK, error) { +func (a *Client) GetSalesReceipts(params *GetSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSalesReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSalesReceipts", Method: "GET", PathPattern: "/sales/receipts", @@ -276,7 +298,12 @@ func (a *Client) GetSalesReceipts(params *GetSalesReceiptsParams, authInfo runti 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 } @@ -296,13 +323,12 @@ func (a *Client) GetSalesReceipts(params *GetSalesReceiptsParams, authInfo runti Get A list of Sales Transaction Dates for this User-License */ -func (a *Client) GetSalesTransactionDates(params *GetSalesTransactionDatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesTransactionDatesOK, error) { +func (a *Client) GetSalesTransactionDates(params *GetSalesTransactionDatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesTransactionDatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSalesTransactionDatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSalesTransactionDates", Method: "GET", PathPattern: "/sales/transactiondates", @@ -314,7 +340,12 @@ func (a *Client) GetSalesTransactionDates(params *GetSalesTransactionDatesParams 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 } @@ -334,13 +365,12 @@ func (a *Client) GetSalesTransactionDates(params *GetSalesTransactionDatesParams Sales Transactions for this User-License */ -func (a *Client) GetSalesTransactions(params *GetSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesTransactionsOK, error) { +func (a *Client) GetSalesTransactions(params *GetSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesTransactionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSalesTransactionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSalesTransactions", Method: "GET", PathPattern: "/sales/transactions", @@ -352,7 +382,12 @@ func (a *Client) GetSalesTransactions(params *GetSalesTransactionsParams, authIn 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 } @@ -371,13 +406,12 @@ func (a *Client) GetSalesTransactions(params *GetSalesTransactionsParams, authIn Create new Sales Deliveries */ -func (a *Client) PostSalesDeliveries(params *PostSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter) (*PostSalesDeliveriesOK, error) { +func (a *Client) PostSalesDeliveries(params *PostSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSalesDeliveriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostSalesDeliveriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postSalesDeliveries", Method: "POST", PathPattern: "/sales/deliveries", @@ -389,7 +423,12 @@ func (a *Client) PostSalesDeliveries(params *PostSalesDeliveriesParams, authInfo 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 } @@ -408,13 +447,12 @@ func (a *Client) PostSalesDeliveries(params *PostSalesDeliveriesParams, authInfo Create new Sales Receipts */ -func (a *Client) PostSalesReceipts(params *PostSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSalesReceiptsOK, error) { +func (a *Client) PostSalesReceipts(params *PostSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSalesReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostSalesReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postSalesReceipts", Method: "POST", PathPattern: "/sales/receipts", @@ -426,7 +464,12 @@ func (a *Client) PostSalesReceipts(params *PostSalesReceiptsParams, authInfo run 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 } @@ -445,13 +488,12 @@ func (a *Client) PostSalesReceipts(params *PostSalesReceiptsParams, authInfo run Create new Sales Transactions */ -func (a *Client) PostSalesTransactions(params *PostSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSalesTransactionsOK, error) { +func (a *Client) PostSalesTransactions(params *PostSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSalesTransactionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostSalesTransactionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postSalesTransactions", Method: "POST", PathPattern: "/sales/transactions", @@ -463,7 +505,12 @@ func (a *Client) PostSalesTransactions(params *PostSalesTransactionsParams, auth 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 } @@ -482,13 +529,12 @@ func (a *Client) PostSalesTransactions(params *PostSalesTransactionsParams, auth Create new Sales Deliveries */ -func (a *Client) PutSalesDeliveries(params *PutSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter) (*PutSalesDeliveriesOK, error) { +func (a *Client) PutSalesDeliveries(params *PutSalesDeliveriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSalesDeliveriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutSalesDeliveriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putSalesDeliveries", Method: "PUT", PathPattern: "/sales/deliveries", @@ -500,7 +546,12 @@ func (a *Client) PutSalesDeliveries(params *PutSalesDeliveriesParams, authInfo r 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 } @@ -519,13 +570,12 @@ func (a *Client) PutSalesDeliveries(params *PutSalesDeliveriesParams, authInfo r Create new Sales Receipts */ -func (a *Client) PutSalesReceipts(params *PutSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSalesReceiptsOK, error) { +func (a *Client) PutSalesReceipts(params *PutSalesReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSalesReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutSalesReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putSalesReceipts", Method: "PUT", PathPattern: "/sales/receipts", @@ -537,7 +587,12 @@ func (a *Client) PutSalesReceipts(params *PutSalesReceiptsParams, authInfo runti 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 } @@ -556,13 +611,12 @@ func (a *Client) PutSalesReceipts(params *PutSalesReceiptsParams, authInfo runti Create new Sales Transactions */ -func (a *Client) PutSalesTransactions(params *PutSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSalesTransactionsOK, error) { +func (a *Client) PutSalesTransactions(params *PutSalesTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSalesTransactionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutSalesTransactionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putSalesTransactions", Method: "PUT", PathPattern: "/sales/transactions", @@ -574,7 +628,12 @@ func (a *Client) PutSalesTransactions(params *PutSalesTransactionsParams, authIn 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 } diff --git a/api/metrc-gw/metrc_gw_client/strains/delete_strain_parameters.go b/api/metrc-gw/metrc_gw_client/strains/delete_strain_parameters.go index a9dbb89..f179631 100644 --- a/api/metrc-gw/metrc_gw_client/strains/delete_strain_parameters.go +++ b/api/metrc-gw/metrc_gw_client/strains/delete_strain_parameters.go @@ -21,73 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewDeleteStrainParams creates a new DeleteStrainParams object -// with the default values initialized. +// NewDeleteStrainParams creates a new DeleteStrainParams 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 NewDeleteStrainParams() *DeleteStrainParams { - var () return &DeleteStrainParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteStrainParamsWithTimeout creates a new DeleteStrainParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteStrainParamsWithTimeout(timeout time.Duration) *DeleteStrainParams { - var () return &DeleteStrainParams{ - timeout: timeout, } } // NewDeleteStrainParamsWithContext creates a new DeleteStrainParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteStrainParamsWithContext(ctx context.Context) *DeleteStrainParams { - var () return &DeleteStrainParams{ - Context: ctx, } } // NewDeleteStrainParamsWithHTTPClient creates a new DeleteStrainParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteStrainParamsWithHTTPClient(client *http.Client) *DeleteStrainParams { - var () return &DeleteStrainParams{ HTTPClient: client, } } -/*DeleteStrainParams contains all the parameters to send to the API endpoint -for the delete strain operation typically these are written to a http.Request +/* DeleteStrainParams contains all the parameters to send to the API endpoint + for the delete strain operation. + + Typically these are written to a http.Request. */ type DeleteStrainParams struct { - /*ItemID - The Item Number + /* ItemID. + The Item Number */ ItemID float64 - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -96,6 +99,21 @@ type DeleteStrainParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete strain params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteStrainParams) WithDefaults() *DeleteStrainParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete strain params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteStrainParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete strain params func (o *DeleteStrainParams) WithTimeout(timeout time.Duration) *DeleteStrainParams { o.SetTimeout(timeout) @@ -196,6 +214,7 @@ func (o *DeleteStrainParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. qrItemID := o.ItemID qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } @@ -205,6 +224,7 @@ func (o *DeleteStrainParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -214,6 +234,7 @@ func (o *DeleteStrainParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -223,6 +244,7 @@ func (o *DeleteStrainParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -232,6 +254,7 @@ func (o *DeleteStrainParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/strains/delete_strain_responses.go b/api/metrc-gw/metrc_gw_client/strains/delete_strain_responses.go index 6fd6653..324331c 100644 --- a/api/metrc-gw/metrc_gw_client/strains/delete_strain_responses.go +++ b/api/metrc-gw/metrc_gw_client/strains/delete_strain_responses.go @@ -57,9 +57,8 @@ func (o *DeleteStrainReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewDeleteStrainOK() *DeleteStrainOK { return &DeleteStrainOK{} } -/*DeleteStrainOK handles this case with default header values. +/* DeleteStrainOK describes a response with status code 200, with default header values. Strains were successfully retrieved */ @@ -79,7 +78,6 @@ type DeleteStrainOK struct { func (o *DeleteStrainOK) Error() string { return fmt.Sprintf("[DELETE /strains][%d] deleteStrainOK %+v", 200, o.Payload) } - func (o *DeleteStrainOK) GetPayload() *metrc_gw_models.StrainResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewDeleteStrainUnauthorized() *DeleteStrainUnauthorized { return &DeleteStrainUnauthorized{} } -/*DeleteStrainUnauthorized handles this case with default header values. +/* DeleteStrainUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type DeleteStrainUnauthorized struct { func (o *DeleteStrainUnauthorized) Error() string { return fmt.Sprintf("[DELETE /strains][%d] deleteStrainUnauthorized %+v", 401, o.Payload) } - func (o *DeleteStrainUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewDeleteStrainForbidden() *DeleteStrainForbidden { return &DeleteStrainForbidden{} } -/*DeleteStrainForbidden handles this case with default header values. +/* DeleteStrainForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type DeleteStrainForbidden struct { func (o *DeleteStrainForbidden) Error() string { return fmt.Sprintf("[DELETE /strains][%d] deleteStrainForbidden %+v", 403, o.Payload) } - func (o *DeleteStrainForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewDeleteStrainNotFound() *DeleteStrainNotFound { return &DeleteStrainNotFound{} } -/*DeleteStrainNotFound handles this case with default header values. +/* DeleteStrainNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type DeleteStrainNotFound struct { func (o *DeleteStrainNotFound) Error() string { return fmt.Sprintf("[DELETE /strains][%d] deleteStrainNotFound %+v", 404, o.Payload) } - func (o *DeleteStrainNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewDeleteStrainInternalServerError() *DeleteStrainInternalServerError { return &DeleteStrainInternalServerError{} } -/*DeleteStrainInternalServerError handles this case with default header values. +/* DeleteStrainInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type DeleteStrainInternalServerError struct { func (o *DeleteStrainInternalServerError) Error() string { return fmt.Sprintf("[DELETE /strains][%d] deleteStrainInternalServerError %+v", 500, o.Payload) } - func (o *DeleteStrainInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/strains/get_strains_parameters.go b/api/metrc-gw/metrc_gw_client/strains/get_strains_parameters.go index d95caf5..8548013 100644 --- a/api/metrc-gw/metrc_gw_client/strains/get_strains_parameters.go +++ b/api/metrc-gw/metrc_gw_client/strains/get_strains_parameters.go @@ -21,93 +21,100 @@ import ( "github.com/go-openapi/swag" ) -// NewGetStrainsParams creates a new GetStrainsParams object -// with the default values initialized. +// NewGetStrainsParams creates a new GetStrainsParams 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 NewGetStrainsParams() *GetStrainsParams { - var () return &GetStrainsParams{ - timeout: cr.DefaultTimeout, } } // NewGetStrainsParamsWithTimeout creates a new GetStrainsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStrainsParamsWithTimeout(timeout time.Duration) *GetStrainsParams { - var () return &GetStrainsParams{ - timeout: timeout, } } // NewGetStrainsParamsWithContext creates a new GetStrainsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStrainsParamsWithContext(ctx context.Context) *GetStrainsParams { - var () return &GetStrainsParams{ - Context: ctx, } } // NewGetStrainsParamsWithHTTPClient creates a new GetStrainsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStrainsParamsWithHTTPClient(client *http.Client) *GetStrainsParams { - var () return &GetStrainsParams{ HTTPClient: client, } } -/*GetStrainsParams contains all the parameters to send to the API endpoint -for the get strains operation typically these are written to a http.Request +/* GetStrainsParams contains all the parameters to send to the API endpoint + for the get strains operation. + + Typically these are written to a http.Request. */ type GetStrainsParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*Label - The METRC Package Label + /* Label. + + The METRC Package Label */ Label *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Onhold - Get On Hold objects? + /* Onhold. + + Get On Hold objects? */ Onhold *bool - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -116,6 +123,21 @@ type GetStrainsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get strains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStrainsParams) WithDefaults() *GetStrainsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get strains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStrainsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get strains params func (o *GetStrainsParams) WithTimeout(timeout time.Duration) *GetStrainsParams { o.SetTimeout(timeout) @@ -260,54 +282,58 @@ func (o *GetStrainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } if o.Label != nil { // query param label var qrLabel string + if o.Label != nil { qrLabel = *o.Label } qLabel := qrLabel if qLabel != "" { + if err := r.SetQueryParam("label", qLabel); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -317,38 +343,41 @@ func (o *GetStrainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param onhold var qrOnhold bool + if o.Onhold != nil { qrOnhold = *o.Onhold } qOnhold := swag.FormatBool(qrOnhold) if qOnhold != "" { + if err := r.SetQueryParam("onhold", qOnhold); err != nil { return err } } - } if o.Production != nil { // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -358,6 +387,7 @@ func (o *GetStrainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -367,6 +397,7 @@ func (o *GetStrainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/strains/get_strains_responses.go b/api/metrc-gw/metrc_gw_client/strains/get_strains_responses.go index 920f040..875f1e4 100644 --- a/api/metrc-gw/metrc_gw_client/strains/get_strains_responses.go +++ b/api/metrc-gw/metrc_gw_client/strains/get_strains_responses.go @@ -57,9 +57,8 @@ func (o *GetStrainsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetStrainsOK() *GetStrainsOK { return &GetStrainsOK{} } -/*GetStrainsOK handles this case with default header values. +/* GetStrainsOK describes a response with status code 200, with default header values. Strains were successfully retrieved */ @@ -79,7 +78,6 @@ type GetStrainsOK struct { func (o *GetStrainsOK) Error() string { return fmt.Sprintf("[GET /strains][%d] getStrainsOK %+v", 200, o.Payload) } - func (o *GetStrainsOK) GetPayload() *metrc_gw_models.StrainResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetStrainsUnauthorized() *GetStrainsUnauthorized { return &GetStrainsUnauthorized{} } -/*GetStrainsUnauthorized handles this case with default header values. +/* GetStrainsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetStrainsUnauthorized struct { func (o *GetStrainsUnauthorized) Error() string { return fmt.Sprintf("[GET /strains][%d] getStrainsUnauthorized %+v", 401, o.Payload) } - func (o *GetStrainsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetStrainsForbidden() *GetStrainsForbidden { return &GetStrainsForbidden{} } -/*GetStrainsForbidden handles this case with default header values. +/* GetStrainsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetStrainsForbidden struct { func (o *GetStrainsForbidden) Error() string { return fmt.Sprintf("[GET /strains][%d] getStrainsForbidden %+v", 403, o.Payload) } - func (o *GetStrainsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetStrainsNotFound() *GetStrainsNotFound { return &GetStrainsNotFound{} } -/*GetStrainsNotFound handles this case with default header values. +/* GetStrainsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetStrainsNotFound struct { func (o *GetStrainsNotFound) Error() string { return fmt.Sprintf("[GET /strains][%d] getStrainsNotFound %+v", 404, o.Payload) } - func (o *GetStrainsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetStrainsInternalServerError() *GetStrainsInternalServerError { return &GetStrainsInternalServerError{} } -/*GetStrainsInternalServerError handles this case with default header values. +/* GetStrainsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetStrainsInternalServerError struct { func (o *GetStrainsInternalServerError) Error() string { return fmt.Sprintf("[GET /strains][%d] getStrainsInternalServerError %+v", 500, o.Payload) } - func (o *GetStrainsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/strains/post_strains_parameters.go b/api/metrc-gw/metrc_gw_client/strains/post_strains_parameters.go index 7fbcb36..3c7c2eb 100644 --- a/api/metrc-gw/metrc_gw_client/strains/post_strains_parameters.go +++ b/api/metrc-gw/metrc_gw_client/strains/post_strains_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPostStrainsParams creates a new PostStrainsParams object -// with the default values initialized. +// NewPostStrainsParams creates a new PostStrainsParams 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 NewPostStrainsParams() *PostStrainsParams { - var () return &PostStrainsParams{ - timeout: cr.DefaultTimeout, } } // NewPostStrainsParamsWithTimeout creates a new PostStrainsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostStrainsParamsWithTimeout(timeout time.Duration) *PostStrainsParams { - var () return &PostStrainsParams{ - timeout: timeout, } } // NewPostStrainsParamsWithContext creates a new PostStrainsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostStrainsParamsWithContext(ctx context.Context) *PostStrainsParams { - var () return &PostStrainsParams{ - Context: ctx, } } // NewPostStrainsParamsWithHTTPClient creates a new PostStrainsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostStrainsParamsWithHTTPClient(client *http.Client) *PostStrainsParams { - var () return &PostStrainsParams{ HTTPClient: client, } } -/*PostStrainsParams contains all the parameters to send to the API endpoint -for the post strains operation typically these are written to a http.Request +/* PostStrainsParams contains all the parameters to send to the API endpoint + for the post strains operation. + + Typically these are written to a http.Request. */ type PostStrainsParams struct { - /*StrainRequest - The New Strains + /* StrainRequest. + The New Strains */ StrainRequest *metrc_gw_models.StrainRequest @@ -77,6 +76,21 @@ type PostStrainsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post strains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostStrainsParams) WithDefaults() *PostStrainsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post strains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostStrainsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post strains params func (o *PostStrainsParams) WithTimeout(timeout time.Duration) *PostStrainsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostStrainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.StrainRequest != nil { if err := r.SetBodyParam(o.StrainRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/strains/post_strains_responses.go b/api/metrc-gw/metrc_gw_client/strains/post_strains_responses.go index cb893ff..106e2ae 100644 --- a/api/metrc-gw/metrc_gw_client/strains/post_strains_responses.go +++ b/api/metrc-gw/metrc_gw_client/strains/post_strains_responses.go @@ -57,9 +57,8 @@ func (o *PostStrainsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostStrainsOK() *PostStrainsOK { return &PostStrainsOK{} } -/*PostStrainsOK handles this case with default header values. +/* PostStrainsOK describes a response with status code 200, with default header values. An array of Strain records with the new IDs */ @@ -79,7 +78,6 @@ type PostStrainsOK struct { func (o *PostStrainsOK) Error() string { return fmt.Sprintf("[POST /strains][%d] postStrainsOK %+v", 200, o.Payload) } - func (o *PostStrainsOK) GetPayload() *metrc_gw_models.StrainResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostStrainsUnauthorized() *PostStrainsUnauthorized { return &PostStrainsUnauthorized{} } -/*PostStrainsUnauthorized handles this case with default header values. +/* PostStrainsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostStrainsUnauthorized struct { func (o *PostStrainsUnauthorized) Error() string { return fmt.Sprintf("[POST /strains][%d] postStrainsUnauthorized %+v", 401, o.Payload) } - func (o *PostStrainsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostStrainsForbidden() *PostStrainsForbidden { return &PostStrainsForbidden{} } -/*PostStrainsForbidden handles this case with default header values. +/* PostStrainsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostStrainsForbidden struct { func (o *PostStrainsForbidden) Error() string { return fmt.Sprintf("[POST /strains][%d] postStrainsForbidden %+v", 403, o.Payload) } - func (o *PostStrainsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostStrainsNotFound() *PostStrainsNotFound { return &PostStrainsNotFound{} } -/*PostStrainsNotFound handles this case with default header values. +/* PostStrainsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostStrainsNotFound struct { func (o *PostStrainsNotFound) Error() string { return fmt.Sprintf("[POST /strains][%d] postStrainsNotFound %+v", 404, o.Payload) } - func (o *PostStrainsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostStrainsInternalServerError() *PostStrainsInternalServerError { return &PostStrainsInternalServerError{} } -/*PostStrainsInternalServerError handles this case with default header values. +/* PostStrainsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostStrainsInternalServerError struct { func (o *PostStrainsInternalServerError) Error() string { return fmt.Sprintf("[POST /strains][%d] postStrainsInternalServerError %+v", 500, o.Payload) } - func (o *PostStrainsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/strains/put_strains_parameters.go b/api/metrc-gw/metrc_gw_client/strains/put_strains_parameters.go index de3d73f..83d5b69 100644 --- a/api/metrc-gw/metrc_gw_client/strains/put_strains_parameters.go +++ b/api/metrc-gw/metrc_gw_client/strains/put_strains_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/metrc-gw/metrc_gw_models" ) -// NewPutStrainsParams creates a new PutStrainsParams object -// with the default values initialized. +// NewPutStrainsParams creates a new PutStrainsParams 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 NewPutStrainsParams() *PutStrainsParams { - var () return &PutStrainsParams{ - timeout: cr.DefaultTimeout, } } // NewPutStrainsParamsWithTimeout creates a new PutStrainsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutStrainsParamsWithTimeout(timeout time.Duration) *PutStrainsParams { - var () return &PutStrainsParams{ - timeout: timeout, } } // NewPutStrainsParamsWithContext creates a new PutStrainsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutStrainsParamsWithContext(ctx context.Context) *PutStrainsParams { - var () return &PutStrainsParams{ - Context: ctx, } } // NewPutStrainsParamsWithHTTPClient creates a new PutStrainsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutStrainsParamsWithHTTPClient(client *http.Client) *PutStrainsParams { - var () return &PutStrainsParams{ HTTPClient: client, } } -/*PutStrainsParams contains all the parameters to send to the API endpoint -for the put strains operation typically these are written to a http.Request +/* PutStrainsParams contains all the parameters to send to the API endpoint + for the put strains operation. + + Typically these are written to a http.Request. */ type PutStrainsParams struct { - /*StrainRequest - The Existing Strains with Ids + /* StrainRequest. + The Existing Strains with Ids */ StrainRequest *metrc_gw_models.StrainRequest @@ -77,6 +76,21 @@ type PutStrainsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put strains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutStrainsParams) WithDefaults() *PutStrainsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put strains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutStrainsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put strains params func (o *PutStrainsParams) WithTimeout(timeout time.Duration) *PutStrainsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutStrainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.StrainRequest != nil { if err := r.SetBodyParam(o.StrainRequest); err != nil { return err diff --git a/api/metrc-gw/metrc_gw_client/strains/put_strains_responses.go b/api/metrc-gw/metrc_gw_client/strains/put_strains_responses.go index 3e62abc..68f848f 100644 --- a/api/metrc-gw/metrc_gw_client/strains/put_strains_responses.go +++ b/api/metrc-gw/metrc_gw_client/strains/put_strains_responses.go @@ -57,9 +57,8 @@ func (o *PutStrainsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutStrainsOK() *PutStrainsOK { return &PutStrainsOK{} } -/*PutStrainsOK handles this case with default header values. +/* PutStrainsOK describes a response with status code 200, with default header values. An array of Strain records */ @@ -79,7 +78,6 @@ type PutStrainsOK struct { func (o *PutStrainsOK) Error() string { return fmt.Sprintf("[PUT /strains][%d] putStrainsOK %+v", 200, o.Payload) } - func (o *PutStrainsOK) GetPayload() *metrc_gw_models.StrainResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutStrainsUnauthorized() *PutStrainsUnauthorized { return &PutStrainsUnauthorized{} } -/*PutStrainsUnauthorized handles this case with default header values. +/* PutStrainsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutStrainsUnauthorized struct { func (o *PutStrainsUnauthorized) Error() string { return fmt.Sprintf("[PUT /strains][%d] putStrainsUnauthorized %+v", 401, o.Payload) } - func (o *PutStrainsUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutStrainsForbidden() *PutStrainsForbidden { return &PutStrainsForbidden{} } -/*PutStrainsForbidden handles this case with default header values. +/* PutStrainsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutStrainsForbidden struct { func (o *PutStrainsForbidden) Error() string { return fmt.Sprintf("[PUT /strains][%d] putStrainsForbidden %+v", 403, o.Payload) } - func (o *PutStrainsForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutStrainsNotFound() *PutStrainsNotFound { return &PutStrainsNotFound{} } -/*PutStrainsNotFound handles this case with default header values. +/* PutStrainsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutStrainsNotFound struct { func (o *PutStrainsNotFound) Error() string { return fmt.Sprintf("[PUT /strains][%d] putStrainsNotFound %+v", 404, o.Payload) } - func (o *PutStrainsNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutStrainsInternalServerError() *PutStrainsInternalServerError { return &PutStrainsInternalServerError{} } -/*PutStrainsInternalServerError handles this case with default header values. +/* PutStrainsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutStrainsInternalServerError struct { func (o *PutStrainsInternalServerError) Error() string { return fmt.Sprintf("[PUT /strains][%d] putStrainsInternalServerError %+v", 500, o.Payload) } - func (o *PutStrainsInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/strains/strains_client.go b/api/metrc-gw/metrc_gw_client/strains/strains_client.go index 9b26c9c..0ee4060 100644 --- a/api/metrc-gw/metrc_gw_client/strains/strains_client.go +++ b/api/metrc-gw/metrc_gw_client/strains/strains_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteStrain(params *DeleteStrainParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteStrainOK, error) + DeleteStrain(params *DeleteStrainParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteStrainOK, error) - GetStrains(params *GetStrainsParams, authInfo runtime.ClientAuthInfoWriter) (*GetStrainsOK, error) + GetStrains(params *GetStrainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStrainsOK, error) - PostStrains(params *PostStrainsParams, authInfo runtime.ClientAuthInfoWriter) (*PostStrainsOK, error) + PostStrains(params *PostStrainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostStrainsOK, error) - PutStrains(params *PutStrainsParams, authInfo runtime.ClientAuthInfoWriter) (*PutStrainsOK, error) + PutStrains(params *PutStrainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutStrainsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -48,13 +51,12 @@ type ClientService interface { Delete a Strain for this User-License */ -func (a *Client) DeleteStrain(params *DeleteStrainParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteStrainOK, error) { +func (a *Client) DeleteStrain(params *DeleteStrainParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteStrainOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteStrainParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteStrain", Method: "DELETE", PathPattern: "/strains", @@ -66,7 +68,12 @@ func (a *Client) DeleteStrain(params *DeleteStrainParams, authInfo runtime.Clien 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 } @@ -86,13 +93,12 @@ func (a *Client) DeleteStrain(params *DeleteStrainParams, authInfo runtime.Clien Get Strains for this User-License */ -func (a *Client) GetStrains(params *GetStrainsParams, authInfo runtime.ClientAuthInfoWriter) (*GetStrainsOK, error) { +func (a *Client) GetStrains(params *GetStrainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStrainsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStrainsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getStrains", Method: "GET", PathPattern: "/strains", @@ -104,7 +110,12 @@ func (a *Client) GetStrains(params *GetStrainsParams, authInfo runtime.ClientAut 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 } @@ -123,13 +134,12 @@ func (a *Client) GetStrains(params *GetStrainsParams, authInfo runtime.ClientAut Create new Strains */ -func (a *Client) PostStrains(params *PostStrainsParams, authInfo runtime.ClientAuthInfoWriter) (*PostStrainsOK, error) { +func (a *Client) PostStrains(params *PostStrainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostStrainsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostStrainsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postStrains", Method: "POST", PathPattern: "/strains", @@ -141,7 +151,12 @@ func (a *Client) PostStrains(params *PostStrainsParams, authInfo runtime.ClientA 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 } @@ -160,13 +175,12 @@ func (a *Client) PostStrains(params *PostStrainsParams, authInfo runtime.ClientA Update existing Strains */ -func (a *Client) PutStrains(params *PutStrainsParams, authInfo runtime.ClientAuthInfoWriter) (*PutStrainsOK, error) { +func (a *Client) PutStrains(params *PutStrainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutStrainsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutStrainsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putStrains", Method: "PUT", PathPattern: "/strains", @@ -178,7 +192,12 @@ func (a *Client) PutStrains(params *PutStrainsParams, authInfo runtime.ClientAut 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 } diff --git a/api/metrc-gw/metrc_gw_client/sys/get_metrics_parameters.go b/api/metrc-gw/metrc_gw_client/sys/get_metrics_parameters.go index 5eacab9..32846df 100644 --- a/api/metrc-gw/metrc_gw_client/sys/get_metrics_parameters.go +++ b/api/metrc-gw/metrc_gw_client/sys/get_metrics_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetMetricsParams creates a new GetMetricsParams object -// with the default values initialized. +// NewGetMetricsParams creates a new GetMetricsParams 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 NewGetMetricsParams() *GetMetricsParams { - return &GetMetricsParams{ - timeout: cr.DefaultTimeout, } } // NewGetMetricsParamsWithTimeout creates a new GetMetricsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetMetricsParamsWithTimeout(timeout time.Duration) *GetMetricsParams { - return &GetMetricsParams{ - timeout: timeout, } } // NewGetMetricsParamsWithContext creates a new GetMetricsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetMetricsParamsWithContext(ctx context.Context) *GetMetricsParams { - return &GetMetricsParams{ - Context: ctx, } } // NewGetMetricsParamsWithHTTPClient creates a new GetMetricsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetMetricsParamsWithHTTPClient(client *http.Client) *GetMetricsParams { - return &GetMetricsParams{ HTTPClient: client, } } -/*GetMetricsParams contains all the parameters to send to the API endpoint -for the get metrics operation typically these are written to a http.Request +/* GetMetricsParams contains all the parameters to send to the API endpoint + for the get metrics operation. + + Typically these are written to a http.Request. */ type GetMetricsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type GetMetricsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMetricsParams) WithDefaults() *GetMetricsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMetricsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get metrics params func (o *GetMetricsParams) WithTimeout(timeout time.Duration) *GetMetricsParams { o.SetTimeout(timeout) diff --git a/api/metrc-gw/metrc_gw_client/sys/get_metrics_responses.go b/api/metrc-gw/metrc_gw_client/sys/get_metrics_responses.go index 0328af5..997ad97 100644 --- a/api/metrc-gw/metrc_gw_client/sys/get_metrics_responses.go +++ b/api/metrc-gw/metrc_gw_client/sys/get_metrics_responses.go @@ -30,9 +30,8 @@ func (o *GetMetricsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,7 +40,7 @@ func NewGetMetricsOK() *GetMetricsOK { return &GetMetricsOK{} } -/*GetMetricsOK handles this case with default header values. +/* GetMetricsOK describes a response with status code 200, with default header values. OK */ diff --git a/api/metrc-gw/metrc_gw_client/sys/sys_client.go b/api/metrc-gw/metrc_gw_client/sys/sys_client.go index a0bb122..1c73d33 100644 --- a/api/metrc-gw/metrc_gw_client/sys/sys_client.go +++ b/api/metrc-gw/metrc_gw_client/sys/sys_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetMetrics(params *GetMetricsParams, authInfo runtime.ClientAuthInfoWriter) (*GetMetricsOK, error) + GetMetrics(params *GetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMetricsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Provides application metrics to Prometheuus logging system */ -func (a *Client) GetMetrics(params *GetMetricsParams, authInfo runtime.ClientAuthInfoWriter) (*GetMetricsOK, error) { +func (a *Client) GetMetrics(params *GetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMetricsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetMetricsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getMetrics", Method: "GET", PathPattern: "/metrics", @@ -59,7 +61,12 @@ func (a *Client) GetMetrics(params *GetMetricsParams, authInfo runtime.ClientAut 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 } diff --git a/api/metrc-gw/metrc_gw_client/transfers/get_transfers_parameters.go b/api/metrc-gw/metrc_gw_client/transfers/get_transfers_parameters.go index a359732..17f600f 100644 --- a/api/metrc-gw/metrc_gw_client/transfers/get_transfers_parameters.go +++ b/api/metrc-gw/metrc_gw_client/transfers/get_transfers_parameters.go @@ -21,113 +21,124 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTransfersParams creates a new GetTransfersParams object -// with the default values initialized. +// NewGetTransfersParams creates a new GetTransfersParams 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 NewGetTransfersParams() *GetTransfersParams { - var () return &GetTransfersParams{ - timeout: cr.DefaultTimeout, } } // NewGetTransfersParamsWithTimeout creates a new GetTransfersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTransfersParamsWithTimeout(timeout time.Duration) *GetTransfersParams { - var () return &GetTransfersParams{ - timeout: timeout, } } // NewGetTransfersParamsWithContext creates a new GetTransfersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTransfersParamsWithContext(ctx context.Context) *GetTransfersParams { - var () return &GetTransfersParams{ - Context: ctx, } } // NewGetTransfersParamsWithHTTPClient creates a new GetTransfersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTransfersParamsWithHTTPClient(client *http.Client) *GetTransfersParams { - var () return &GetTransfersParams{ HTTPClient: client, } } -/*GetTransfersParams contains all the parameters to send to the API endpoint -for the get transfers operation typically these are written to a http.Request +/* GetTransfersParams contains all the parameters to send to the API endpoint + for the get transfers operation. + + Typically these are written to a http.Request. */ type GetTransfersParams struct { - /*Active - Get Active objects? + /* Active. + Get Active objects? */ Active *bool - /*DeliveryID - The Sales Delivery Number + /* DeliveryID. + + The Sales Delivery Number */ DeliveryID *string - /*ItemID - The Item Number + /* ItemID. + + The Item Number */ ItemID *float64 - /*Label - The METRC Package Label + /* Label. + + The METRC Package Label */ Label *string - /*LastModifiedEnd - The last modified end timestamp + /* LastModifiedEnd. + + The last modified end timestamp */ LastModifiedEnd *string - /*LastModifiedStart - The last modified start timestamp + /* LastModifiedStart. + + The last modified start timestamp */ LastModifiedStart *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License string - /*Onhold - Get On Hold objects? + /* Onhold. + + Get On Hold objects? */ Onhold *bool - /*PackageID - The METRC Package Number + /* PackageID. + + The METRC Package Number */ PackageID *string - /*Production - Use Production API? + /* Production. + + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -136,6 +147,21 @@ type GetTransfersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get transfers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransfersParams) WithDefaults() *GetTransfersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get transfers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransfersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get transfers params func (o *GetTransfersParams) WithTimeout(timeout time.Duration) *GetTransfersParams { o.SetTimeout(timeout) @@ -324,102 +350,109 @@ func (o *GetTransfersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.DeliveryID != nil { // query param deliveryId var qrDeliveryID string + if o.DeliveryID != nil { qrDeliveryID = *o.DeliveryID } qDeliveryID := qrDeliveryID if qDeliveryID != "" { + if err := r.SetQueryParam("deliveryId", qDeliveryID); err != nil { return err } } - } if o.ItemID != nil { // query param itemId var qrItemID float64 + if o.ItemID != nil { qrItemID = *o.ItemID } qItemID := swag.FormatFloat64(qrItemID) if qItemID != "" { + if err := r.SetQueryParam("itemId", qItemID); err != nil { return err } } - } if o.Label != nil { // query param label var qrLabel string + if o.Label != nil { qrLabel = *o.Label } qLabel := qrLabel if qLabel != "" { + if err := r.SetQueryParam("label", qLabel); err != nil { return err } } - } if o.LastModifiedEnd != nil { // query param lastModifiedEnd var qrLastModifiedEnd string + if o.LastModifiedEnd != nil { qrLastModifiedEnd = *o.LastModifiedEnd } qLastModifiedEnd := qrLastModifiedEnd if qLastModifiedEnd != "" { + if err := r.SetQueryParam("lastModifiedEnd", qLastModifiedEnd); err != nil { return err } } - } if o.LastModifiedStart != nil { // query param lastModifiedStart var qrLastModifiedStart string + if o.LastModifiedStart != nil { qrLastModifiedStart = *o.LastModifiedStart } qLastModifiedStart := qrLastModifiedStart if qLastModifiedStart != "" { + if err := r.SetQueryParam("lastModifiedStart", qLastModifiedStart); err != nil { return err } } - } // query param license qrLicense := o.License qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } @@ -429,54 +462,58 @@ func (o *GetTransfersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param onhold var qrOnhold bool + if o.Onhold != nil { qrOnhold = *o.Onhold } qOnhold := swag.FormatBool(qrOnhold) if qOnhold != "" { + if err := r.SetQueryParam("onhold", qOnhold); err != nil { return err } } - } if o.PackageID != nil { // query param packageId var qrPackageID string + if o.PackageID != nil { qrPackageID = *o.PackageID } qPackageID := qrPackageID if qPackageID != "" { + if err := r.SetQueryParam("packageId", qPackageID); err != nil { return err } } - } if o.Production != nil { // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -486,6 +523,7 @@ func (o *GetTransfersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -495,6 +533,7 @@ func (o *GetTransfersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/transfers/get_transfers_responses.go b/api/metrc-gw/metrc_gw_client/transfers/get_transfers_responses.go index 495f900..076d8c1 100644 --- a/api/metrc-gw/metrc_gw_client/transfers/get_transfers_responses.go +++ b/api/metrc-gw/metrc_gw_client/transfers/get_transfers_responses.go @@ -57,9 +57,8 @@ func (o *GetTransfersReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetTransfersOK() *GetTransfersOK { return &GetTransfersOK{} } -/*GetTransfersOK handles this case with default header values. +/* GetTransfersOK describes a response with status code 200, with default header values. Transfers were successfully retrieved */ @@ -79,7 +78,6 @@ type GetTransfersOK struct { func (o *GetTransfersOK) Error() string { return fmt.Sprintf("[GET /transfers][%d] getTransfersOK %+v", 200, o.Payload) } - func (o *GetTransfersOK) GetPayload() *metrc_gw_models.TransferResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetTransfersUnauthorized() *GetTransfersUnauthorized { return &GetTransfersUnauthorized{} } -/*GetTransfersUnauthorized handles this case with default header values. +/* GetTransfersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetTransfersUnauthorized struct { func (o *GetTransfersUnauthorized) Error() string { return fmt.Sprintf("[GET /transfers][%d] getTransfersUnauthorized %+v", 401, o.Payload) } - func (o *GetTransfersUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetTransfersForbidden() *GetTransfersForbidden { return &GetTransfersForbidden{} } -/*GetTransfersForbidden handles this case with default header values. +/* GetTransfersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetTransfersForbidden struct { func (o *GetTransfersForbidden) Error() string { return fmt.Sprintf("[GET /transfers][%d] getTransfersForbidden %+v", 403, o.Payload) } - func (o *GetTransfersForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetTransfersNotFound() *GetTransfersNotFound { return &GetTransfersNotFound{} } -/*GetTransfersNotFound handles this case with default header values. +/* GetTransfersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetTransfersNotFound struct { func (o *GetTransfersNotFound) Error() string { return fmt.Sprintf("[GET /transfers][%d] getTransfersNotFound %+v", 404, o.Payload) } - func (o *GetTransfersNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetTransfersInternalServerError() *GetTransfersInternalServerError { return &GetTransfersInternalServerError{} } -/*GetTransfersInternalServerError handles this case with default header values. +/* GetTransfersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetTransfersInternalServerError struct { func (o *GetTransfersInternalServerError) Error() string { return fmt.Sprintf("[GET /transfers][%d] getTransfersInternalServerError %+v", 500, o.Payload) } - func (o *GetTransfersInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/transfers/transfers_client.go b/api/metrc-gw/metrc_gw_client/transfers/transfers_client.go index c4ad7a2..10d3a32 100644 --- a/api/metrc-gw/metrc_gw_client/transfers/transfers_client.go +++ b/api/metrc-gw/metrc_gw_client/transfers/transfers_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetTransfers(params *GetTransfersParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransfersOK, error) + GetTransfers(params *GetTransfersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransfersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -42,13 +45,12 @@ type ClientService interface { Get Transfers for this User-License */ -func (a *Client) GetTransfers(params *GetTransfersParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransfersOK, error) { +func (a *Client) GetTransfers(params *GetTransfersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransfersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTransfersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTransfers", Method: "GET", PathPattern: "/transfers", @@ -60,7 +62,12 @@ func (a *Client) GetTransfers(params *GetTransfersParams, authInfo runtime.Clien 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 } diff --git a/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_parameters.go b/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_parameters.go index ee84746..9ffb566 100644 --- a/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_parameters.go +++ b/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetUnitsOfMeasureParams creates a new GetUnitsOfMeasureParams object -// with the default values initialized. +// NewGetUnitsOfMeasureParams creates a new GetUnitsOfMeasureParams 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 NewGetUnitsOfMeasureParams() *GetUnitsOfMeasureParams { - var () return &GetUnitsOfMeasureParams{ - timeout: cr.DefaultTimeout, } } // NewGetUnitsOfMeasureParamsWithTimeout creates a new GetUnitsOfMeasureParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUnitsOfMeasureParamsWithTimeout(timeout time.Duration) *GetUnitsOfMeasureParams { - var () return &GetUnitsOfMeasureParams{ - timeout: timeout, } } // NewGetUnitsOfMeasureParamsWithContext creates a new GetUnitsOfMeasureParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUnitsOfMeasureParamsWithContext(ctx context.Context) *GetUnitsOfMeasureParams { - var () return &GetUnitsOfMeasureParams{ - Context: ctx, } } // NewGetUnitsOfMeasureParamsWithHTTPClient creates a new GetUnitsOfMeasureParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUnitsOfMeasureParamsWithHTTPClient(client *http.Client) *GetUnitsOfMeasureParams { - var () return &GetUnitsOfMeasureParams{ HTTPClient: client, } } -/*GetUnitsOfMeasureParams contains all the parameters to send to the API endpoint -for the get units of measure operation typically these are written to a http.Request +/* GetUnitsOfMeasureParams contains all the parameters to send to the API endpoint + for the get units of measure operation. + + Typically these are written to a http.Request. */ type GetUnitsOfMeasureParams struct { - /*Production - Use Production API? + /* Production. + Use Production API? */ Production *bool - /*Reseller - The METRC Reseller Key + /* Reseller. + + The METRC Reseller Key */ Reseller string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The METRC User Key + /* User. + + The METRC User Key */ User string @@ -91,6 +93,21 @@ type GetUnitsOfMeasureParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get units of measure params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUnitsOfMeasureParams) WithDefaults() *GetUnitsOfMeasureParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get units of measure params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUnitsOfMeasureParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get units of measure params func (o *GetUnitsOfMeasureParams) WithTimeout(timeout time.Duration) *GetUnitsOfMeasureParams { o.SetTimeout(timeout) @@ -180,22 +197,24 @@ func (o *GetUnitsOfMeasureParams) WriteToRequest(r runtime.ClientRequest, reg st // query param production var qrProduction bool + if o.Production != nil { qrProduction = *o.Production } qProduction := swag.FormatBool(qrProduction) if qProduction != "" { + if err := r.SetQueryParam("production", qProduction); err != nil { return err } } - } // query param reseller qrReseller := o.Reseller qReseller := qrReseller if qReseller != "" { + if err := r.SetQueryParam("reseller", qReseller); err != nil { return err } @@ -205,6 +224,7 @@ func (o *GetUnitsOfMeasureParams) WriteToRequest(r runtime.ClientRequest, reg st qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -214,6 +234,7 @@ func (o *GetUnitsOfMeasureParams) WriteToRequest(r runtime.ClientRequest, reg st qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } diff --git a/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_responses.go b/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_responses.go index a3d764f..e3fbe86 100644 --- a/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_responses.go +++ b/api/metrc-gw/metrc_gw_client/units_of_measure/get_units_of_measure_responses.go @@ -57,9 +57,8 @@ func (o *GetUnitsOfMeasureReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewGetUnitsOfMeasureOK() *GetUnitsOfMeasureOK { return &GetUnitsOfMeasureOK{} } -/*GetUnitsOfMeasureOK handles this case with default header values. +/* GetUnitsOfMeasureOK describes a response with status code 200, with default header values. A list of Units of Measure was succefully retrieved */ @@ -79,7 +78,6 @@ type GetUnitsOfMeasureOK struct { func (o *GetUnitsOfMeasureOK) Error() string { return fmt.Sprintf("[GET /unitsofmeasure][%d] getUnitsOfMeasureOK %+v", 200, o.Payload) } - func (o *GetUnitsOfMeasureOK) GetPayload() *metrc_gw_models.UnitsOfMeasureResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewGetUnitsOfMeasureUnauthorized() *GetUnitsOfMeasureUnauthorized { return &GetUnitsOfMeasureUnauthorized{} } -/*GetUnitsOfMeasureUnauthorized handles this case with default header values. +/* GetUnitsOfMeasureUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type GetUnitsOfMeasureUnauthorized struct { func (o *GetUnitsOfMeasureUnauthorized) Error() string { return fmt.Sprintf("[GET /unitsofmeasure][%d] getUnitsOfMeasureUnauthorized %+v", 401, o.Payload) } - func (o *GetUnitsOfMeasureUnauthorized) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewGetUnitsOfMeasureForbidden() *GetUnitsOfMeasureForbidden { return &GetUnitsOfMeasureForbidden{} } -/*GetUnitsOfMeasureForbidden handles this case with default header values. +/* GetUnitsOfMeasureForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type GetUnitsOfMeasureForbidden struct { func (o *GetUnitsOfMeasureForbidden) Error() string { return fmt.Sprintf("[GET /unitsofmeasure][%d] getUnitsOfMeasureForbidden %+v", 403, o.Payload) } - func (o *GetUnitsOfMeasureForbidden) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewGetUnitsOfMeasureNotFound() *GetUnitsOfMeasureNotFound { return &GetUnitsOfMeasureNotFound{} } -/*GetUnitsOfMeasureNotFound handles this case with default header values. +/* GetUnitsOfMeasureNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type GetUnitsOfMeasureNotFound struct { func (o *GetUnitsOfMeasureNotFound) Error() string { return fmt.Sprintf("[GET /unitsofmeasure][%d] getUnitsOfMeasureNotFound %+v", 404, o.Payload) } - func (o *GetUnitsOfMeasureNotFound) GetPayload() *metrc_gw_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewGetUnitsOfMeasureInternalServerError() *GetUnitsOfMeasureInternalServerE return &GetUnitsOfMeasureInternalServerError{} } -/*GetUnitsOfMeasureInternalServerError handles this case with default header values. +/* GetUnitsOfMeasureInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type GetUnitsOfMeasureInternalServerError struct { func (o *GetUnitsOfMeasureInternalServerError) Error() string { return fmt.Sprintf("[GET /unitsofmeasure][%d] getUnitsOfMeasureInternalServerError %+v", 500, o.Payload) } - func (o *GetUnitsOfMeasureInternalServerError) GetPayload() *metrc_gw_models.Error { return o.Payload } diff --git a/api/metrc-gw/metrc_gw_client/units_of_measure/units_of_measure_client.go b/api/metrc-gw/metrc_gw_client/units_of_measure/units_of_measure_client.go index b0576cf..c867799 100644 --- a/api/metrc-gw/metrc_gw_client/units_of_measure/units_of_measure_client.go +++ b/api/metrc-gw/metrc_gw_client/units_of_measure/units_of_measure_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetUnitsOfMeasure(params *GetUnitsOfMeasureParams, authInfo runtime.ClientAuthInfoWriter) (*GetUnitsOfMeasureOK, error) + GetUnitsOfMeasure(params *GetUnitsOfMeasureParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUnitsOfMeasureOK, error) SetTransport(transport runtime.ClientTransport) } @@ -42,13 +45,12 @@ type ClientService interface { Units of Measure */ -func (a *Client) GetUnitsOfMeasure(params *GetUnitsOfMeasureParams, authInfo runtime.ClientAuthInfoWriter) (*GetUnitsOfMeasureOK, error) { +func (a *Client) GetUnitsOfMeasure(params *GetUnitsOfMeasureParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUnitsOfMeasureOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUnitsOfMeasureParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUnitsOfMeasure", Method: "GET", PathPattern: "/unitsofmeasure", @@ -60,7 +62,12 @@ func (a *Client) GetUnitsOfMeasure(params *GetUnitsOfMeasureParams, authInfo run 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 } diff --git a/api/metrc-gw/metrc_gw_models/customer_type.go b/api/metrc-gw/metrc_gw_models/customer_type.go index 3d52582..6811c1a 100644 --- a/api/metrc-gw/metrc_gw_models/customer_type.go +++ b/api/metrc-gw/metrc_gw_models/customer_type.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *CustomerType) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this customer type based on context it is used +func (m *CustomerType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CustomerType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/customer_type_response.go b/api/metrc-gw/metrc_gw_models/customer_type_response.go index 4388f49..784d5db 100644 --- a/api/metrc-gw/metrc_gw_models/customer_type_response.go +++ b/api/metrc-gw/metrc_gw_models/customer_type_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CustomerTypeResponse) Validate(formats strfmt.Registry) error { } func (m *CustomerTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CustomerTypeResponse) validateData(formats strfmt.Registry) error { } func (m *CustomerTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CustomerTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this customer type response based on the context it is used +func (m *CustomerTypeResponse) 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 *CustomerTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CustomerTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CustomerTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/error.go b/api/metrc-gw/metrc_gw_models/error.go index 351c1d5..868d468 100644 --- a/api/metrc-gw/metrc_gw_models/error.go +++ b/api/metrc-gw/metrc_gw_models/error.go @@ -10,6 +10,8 @@ package metrc_gw_models // 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" @@ -45,22 +47,26 @@ func (m *Error) Validate(formats strfmt.Registry) error { } func (m *Error) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } - if err := validate.MinimumInt("status", "body", int64(m.Status), 100, false); err != nil { + if err := validate.MinimumInt("status", "body", m.Status, 100, false); err != nil { return err } - if err := validate.MaximumInt("status", "body", int64(m.Status), 600, false); err != nil { + if err := validate.MaximumInt("status", "body", m.Status, 600, false); err != nil { return err } return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/facility.go b/api/metrc-gw/metrc_gw_models/facility.go index 8926229..d07d6ec 100644 --- a/api/metrc-gw/metrc_gw_models/facility.go +++ b/api/metrc-gw/metrc_gw_models/facility.go @@ -10,6 +10,8 @@ package metrc_gw_models // 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" @@ -21,33 +23,41 @@ import ( type Facility struct { // alias + // Example: OR Larger Rec-WHSLR 1 Alias string `json:"Alias,omitempty"` // credentialed date + // Example: 2017-08-13 CredentialedDate string `json:"CredentialedDate,omitempty"` // display name + // Example: OR Larger Rec-WHSLR 1 DisplayName string `json:"DisplayName,omitempty"` // facility type FacilityType *FacilityFacilityType `json:"FacilityType,omitempty"` // hire date + // Example: 2017-08-14 HireDate string `json:"HireDate,omitempty"` // is manager + // Example: true IsManager bool `json:"IsManager,omitempty"` // is owner + // Example: true IsOwner bool `json:"IsOwner,omitempty"` // license License *License `json:"License,omitempty"` // name + // Example: OR LARGER THAN SALES, LLC Name string `json:"Name,omitempty"` // occupations + // Example: [] Occupations []string `json:"Occupations"` } @@ -70,7 +80,6 @@ func (m *Facility) Validate(formats strfmt.Registry) error { } func (m *Facility) validateFacilityType(formats strfmt.Registry) error { - if swag.IsZero(m.FacilityType) { // not required return nil } @@ -88,7 +97,6 @@ func (m *Facility) validateFacilityType(formats strfmt.Registry) error { } func (m *Facility) validateLicense(formats strfmt.Registry) error { - if swag.IsZero(m.License) { // not required return nil } @@ -105,6 +113,52 @@ func (m *Facility) validateLicense(formats strfmt.Registry) error { return nil } +// ContextValidate validate this facility based on the context it is used +func (m *Facility) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFacilityType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLicense(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Facility) contextValidateFacilityType(ctx context.Context, formats strfmt.Registry) error { + + if m.FacilityType != nil { + if err := m.FacilityType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("FacilityType") + } + return err + } + } + + return nil +} + +func (m *Facility) contextValidateLicense(ctx context.Context, formats strfmt.Registry) error { + + if m.License != nil { + if err := m.License.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("License") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Facility) MarshalBinary() ([]byte, error) { if m == nil { @@ -129,120 +183,159 @@ func (m *Facility) UnmarshalBinary(b []byte) error { type FacilityFacilityType struct { // advanced sales + // Example: false AdvancedSales bool `json:"AdvancedSales,omitempty"` // can assign rooms to packages + // Example: false CanAssignRoomsToPackages bool `json:"CanAssignRoomsToPackages,omitempty"` // can assign rooms to plant batches + // Example: false CanAssignRoomsToPlantBatches bool `json:"CanAssignRoomsToPlantBatches,omitempty"` // can create derived packages + // Example: true CanCreateDerivedPackages bool `json:"CanCreateDerivedPackages,omitempty"` // can create opening balance packages + // Example: true CanCreateOpeningBalancePackages bool `json:"CanCreateOpeningBalancePackages,omitempty"` // can create process validation packages + // Example: true CanCreateProcessValidationPackages bool `json:"CanCreateProcessValidationPackages,omitempty"` // can deliver sales to consumers + // Example: false CanDeliverSalesToConsumers bool `json:"CanDeliverSalesToConsumers,omitempty"` // can deliver sales to patients + // Example: false CanDeliverSalesToPatients bool `json:"CanDeliverSalesToPatients,omitempty"` // can grow plants + // Example: false CanGrowPlants bool `json:"CanGrowPlants,omitempty"` // can have member patients + // Example: false CanHaveMemberPatients bool `json:"CanHaveMemberPatients,omitempty"` // can infuse products + // Example: false CanInfuseProducts bool `json:"CanInfuseProducts,omitempty"` // can package vegetative plants + // Example: false CanPackageVegetativePlants bool `json:"CanPackageVegetativePlants,omitempty"` // can remediate packages with failed lab results + // Example: false CanRemediatePackagesWithFailedLabResults bool `json:"CanRemediatePackagesWithFailedLabResults,omitempty"` // can report harvest schedules + // Example: false CanReportHarvestSchedules bool `json:"CanReportHarvestSchedules,omitempty"` // can report patients adverse responses + // Example: false CanReportPatientsAdverseResponses bool `json:"CanReportPatientsAdverseResponses,omitempty"` // can request product remediation + // Example: false CanRequestProductRemediation bool `json:"CanRequestProductRemediation,omitempty"` // can require harvest sample lab test batches + // Example: false CanRequireHarvestSampleLabTestBatches bool `json:"CanRequireHarvestSampleLabTestBatches,omitempty"` // can require package sample lab test batches + // Example: false CanRequirePackageSampleLabTestBatches bool `json:"CanRequirePackageSampleLabTestBatches,omitempty"` // can sell to caregivers + // Example: false CanSellToCaregivers bool `json:"CanSellToCaregivers,omitempty"` // can sell to consumers + // Example: false CanSellToConsumers bool `json:"CanSellToConsumers,omitempty"` // can sell to external patients + // Example: false CanSellToExternalPatients bool `json:"CanSellToExternalPatients,omitempty"` // can sell to patients + // Example: false CanSellToPatients bool `json:"CanSellToPatients,omitempty"` // can submit harvests for testing + // Example: false CanSubmitHarvestsForTesting bool `json:"CanSubmitHarvestsForTesting,omitempty"` // can submit packages for testing + // Example: true CanSubmitPackagesForTesting bool `json:"CanSubmitPackagesForTesting,omitempty"` // can tag plant batches + // Example: false CanTagPlantBatches bool `json:"CanTagPlantBatches,omitempty"` // can test packages + // Example: false CanTestPackages bool `json:"CanTestPackages,omitempty"` // can track vegetative plants + // Example: true CanTrackVegetativePlants bool `json:"CanTrackVegetativePlants,omitempty"` // can transfer from external facilities + // Example: true CanTransferFromExternalFacilities bool `json:"CanTransferFromExternalFacilities,omitempty"` // can update plant strains + // Example: false CanUpdatePlantStrains bool `json:"CanUpdatePlantStrains,omitempty"` // is medical + // Example: false IsMedical bool `json:"IsMedical,omitempty"` // is retail + // Example: true IsRetail bool `json:"IsRetail,omitempty"` // packages require patient affiliation + // Example: false PackagesRequirePatientAffiliation bool `json:"PackagesRequirePatientAffiliation,omitempty"` // plants require patient affiliation + // Example: false PlantsRequirePatientAffiliation bool `json:"PlantsRequirePatientAffiliation,omitempty"` // sales delivery require patient number + // Example: false SalesDeliveryRequirePatientNumber bool `json:"SalesDeliveryRequirePatientNumber,omitempty"` // sales require caregiver number + // Example: false SalesRequireCaregiverNumber bool `json:"SalesRequireCaregiverNumber,omitempty"` // sales require caregiver patient number + // Example: false SalesRequireCaregiverPatientNumber bool `json:"SalesRequireCaregiverPatientNumber,omitempty"` // sales require external patient identification method + // Example: false SalesRequireExternalPatientIdentificationMethod bool `json:"SalesRequireExternalPatientIdentificationMethod,omitempty"` // sales require external patient number + // Example: false SalesRequireExternalPatientNumber bool `json:"SalesRequireExternalPatientNumber,omitempty"` // sales require patient number + // Example: false SalesRequirePatientNumber bool `json:"SalesRequirePatientNumber,omitempty"` } @@ -251,6 +344,11 @@ func (m *FacilityFacilityType) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this facility facility type based on context it is used +func (m *FacilityFacilityType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *FacilityFacilityType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/facility_response.go b/api/metrc-gw/metrc_gw_models/facility_response.go index 0452fc0..9d6389e 100644 --- a/api/metrc-gw/metrc_gw_models/facility_response.go +++ b/api/metrc-gw/metrc_gw_models/facility_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *FacilityResponse) Validate(formats strfmt.Registry) error { } func (m *FacilityResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *FacilityResponse) validateData(formats strfmt.Registry) error { } func (m *FacilityResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *FacilityResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this facility response based on the context it is used +func (m *FacilityResponse) 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 *FacilityResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FacilityResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FacilityResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest.go b/api/metrc-gw/metrc_gw_models/harvest.go index b2b8015..f40fdae 100644 --- a/api/metrc-gw/metrc_gw_models/harvest.go +++ b/api/metrc-gw/metrc_gw_models/harvest.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,54 +22,71 @@ import ( type Harvest struct { // current weight + // Example: 0 CurrentWeight float64 `json:"CurrentWeight,omitempty"` // drying room Id + // Example: 1 DryingRoomID float64 `json:"DryingRoomId,omitempty"` // drying room name + // Example: Harvest Room DryingRoomName string `json:"DryingRoomName,omitempty"` // harvest start date + // Example: 2014-11-19 HarvestStartDate string `json:"HarvestStartDate,omitempty"` // harvest type + // Example: WholePlant HarvestType string `json:"HarvestType,omitempty"` // Id + // Example: 2 ID float64 `json:"Id,omitempty"` // is on hold + // Example: false IsOnHold bool `json:"IsOnHold,omitempty"` // last modified + // Example: 0001-01-01T00:00:00+00:00 LastModified string `json:"LastModified,omitempty"` // name + // Example: 2014-11-19-Harvest Room-H Name string `json:"Name,omitempty"` // package count + // Example: 0 PackageCount float64 `json:"PackageCount,omitempty"` // plant count + // Example: 70 PlantCount float64 `json:"PlantCount,omitempty"` // source strain count + // Example: 0 SourceStrainCount float64 `json:"SourceStrainCount,omitempty"` // total packaged weight + // Example: 0 TotalPackagedWeight float64 `json:"TotalPackagedWeight,omitempty"` // total restored weight + // Example: 0 TotalRestoredWeight float64 `json:"TotalRestoredWeight,omitempty"` // total waste weight + // Example: 0 TotalWasteWeight float64 `json:"TotalWasteWeight,omitempty"` // total wet weight + // Example: 40 TotalWetWeight float64 `json:"TotalWetWeight,omitempty"` // unit of weight name + // Example: Ounces UnitOfWeightName string `json:"UnitOfWeightName,omitempty"` } @@ -76,6 +95,11 @@ func (m *Harvest) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this harvest based on context it is used +func (m *Harvest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Harvest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_package.go b/api/metrc-gw/metrc_gw_models/harvest_package.go index 2992bae..4b4a346 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_package.go +++ b/api/metrc-gw/metrc_gw_models/harvest_package.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,45 +24,58 @@ import ( type HarvestPackage struct { // actual date + // Example: 2015-12-15 ActualDate string `json:"ActualDate,omitempty"` // ingredients Ingredients []*HarvestPackageIngredient `json:"Ingredients"` // is production batch + // Example: false IsProductionBatch bool `json:"IsProductionBatch,omitempty"` // item + // Example: Buds Item string `json:"Item,omitempty"` // patient license number + // Example: X00001 PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"` // product requires remediation + // Example: false ProductRequiresRemediation bool `json:"ProductRequiresRemediation,omitempty"` // production batch number + // Example: _string_ ProductionBatchNumber string `json:"ProductionBatchNumber,omitempty"` // remediate product + // Example: false RemediateProduct bool `json:"RemediateProduct,omitempty"` // remediation date + // Example: 2015-12-15 RemediationDate string `json:"RemediationDate,omitempty"` // remediation method Id + // Example: _string_ RemediationMethodID string `json:"RemediationMethodId,omitempty"` // remediation steps + // Example: _string_ RemediationSteps string `json:"RemediationSteps,omitempty"` // room + // Example: _string_ Room string `json:"Room,omitempty"` // tag + // Example: ABCDEF012345670000020201 Tag string `json:"Tag,omitempty"` // unit of weight + // Example: Grams UnitOfWeight string `json:"UnitOfWeight,omitempty"` } @@ -80,7 +94,6 @@ func (m *HarvestPackage) Validate(formats strfmt.Registry) error { } func (m *HarvestPackage) validateIngredients(formats strfmt.Registry) error { - if swag.IsZero(m.Ingredients) { // not required return nil } @@ -104,6 +117,38 @@ func (m *HarvestPackage) validateIngredients(formats strfmt.Registry) error { return nil } +// ContextValidate validate this harvest package based on the context it is used +func (m *HarvestPackage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIngredients(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HarvestPackage) contextValidateIngredients(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Ingredients); i++ { + + if m.Ingredients[i] != nil { + if err := m.Ingredients[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Ingredients" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *HarvestPackage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_package_ingredient.go b/api/metrc-gw/metrc_gw_models/harvest_package_ingredient.go index 700cb69..ee7931e 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_package_ingredient.go +++ b/api/metrc-gw/metrc_gw_models/harvest_package_ingredient.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,15 +22,19 @@ import ( type HarvestPackageIngredient struct { // harvest Id + // Example: 2 HarvestID float64 `json:"HarvestId,omitempty"` // harvest name + // Example: _string_ HarvestName string `json:"HarvestName,omitempty"` // unit of weight + // Example: Grams UnitOfWeight string `json:"UnitOfWeight,omitempty"` // weight + // Example: 100.23 Weight float64 `json:"Weight,omitempty"` } @@ -37,6 +43,11 @@ func (m *HarvestPackageIngredient) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this harvest package ingredient based on context it is used +func (m *HarvestPackageIngredient) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *HarvestPackageIngredient) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_package_request.go b/api/metrc-gw/metrc_gw_models/harvest_package_request.go index 1624aa3..303b634 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_package_request.go +++ b/api/metrc-gw/metrc_gw_models/harvest_package_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *HarvestPackageRequest) Validate(formats strfmt.Registry) error { } func (m *HarvestPackageRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *HarvestPackageRequest) validateData(formats strfmt.Registry) error { } func (m *HarvestPackageRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *HarvestPackageRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this harvest package request based on the context it is used +func (m *HarvestPackageRequest) 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 *HarvestPackageRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HarvestPackageRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HarvestPackageRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_response.go b/api/metrc-gw/metrc_gw_models/harvest_response.go index 001a96d..4a7fbf9 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_response.go +++ b/api/metrc-gw/metrc_gw_models/harvest_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *HarvestResponse) Validate(formats strfmt.Registry) error { } func (m *HarvestResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *HarvestResponse) validateData(formats strfmt.Registry) error { } func (m *HarvestResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *HarvestResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this harvest response based on the context it is used +func (m *HarvestResponse) 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 *HarvestResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HarvestResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HarvestResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_update.go b/api/metrc-gw/metrc_gw_models/harvest_update.go index 4e79ae6..2f0f4d4 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_update.go +++ b/api/metrc-gw/metrc_gw_models/harvest_update.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,21 +22,27 @@ import ( type HarvestUpdate struct { // actual date + // Example: 2015-12-15 ActualDate string `json:"ActualDate,omitempty"` // Id + // Example: 34904 ID float64 `json:"Id,omitempty"` // unit of weight + // Example: Grams UnitOfWeight string `json:"UnitOfWeight,omitempty"` // waste type + // Example: Plant Material WasteType string `json:"WasteType,omitempty"` // waste weight + // Example: 10.05 WasteWeight float64 `json:"WasteWeight,omitempty"` // operation Id + // Example: removeWaste OperationID string `json:"operationId,omitempty"` } @@ -43,6 +51,11 @@ func (m *HarvestUpdate) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this harvest update based on context it is used +func (m *HarvestUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *HarvestUpdate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_update_request.go b/api/metrc-gw/metrc_gw_models/harvest_update_request.go index 9c403f1..dfdd26a 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_update_request.go +++ b/api/metrc-gw/metrc_gw_models/harvest_update_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *HarvestUpdateRequest) Validate(formats strfmt.Registry) error { } func (m *HarvestUpdateRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *HarvestUpdateRequest) validateData(formats strfmt.Registry) error { } func (m *HarvestUpdateRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *HarvestUpdateRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this harvest update request based on the context it is used +func (m *HarvestUpdateRequest) 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 *HarvestUpdateRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HarvestUpdateRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HarvestUpdateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_update_response.go b/api/metrc-gw/metrc_gw_models/harvest_update_response.go index 0252d52..8a48f90 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_update_response.go +++ b/api/metrc-gw/metrc_gw_models/harvest_update_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *HarvestUpdateResponse) Validate(formats strfmt.Registry) error { } func (m *HarvestUpdateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *HarvestUpdateResponse) validateData(formats strfmt.Registry) error { } func (m *HarvestUpdateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *HarvestUpdateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this harvest update response based on the context it is used +func (m *HarvestUpdateResponse) 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 *HarvestUpdateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HarvestUpdateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HarvestUpdateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_waste_type.go b/api/metrc-gw/metrc_gw_models/harvest_waste_type.go index d5facc9..416c370 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_waste_type.go +++ b/api/metrc-gw/metrc_gw_models/harvest_waste_type.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,6 +22,7 @@ import ( type HarvestWasteType struct { // name + // Example: Plant Material Name string `json:"Name,omitempty"` } @@ -28,6 +31,11 @@ func (m *HarvestWasteType) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this harvest waste type based on context it is used +func (m *HarvestWasteType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *HarvestWasteType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/harvest_waste_type_response.go b/api/metrc-gw/metrc_gw_models/harvest_waste_type_response.go index 115d336..8c3acdb 100644 --- a/api/metrc-gw/metrc_gw_models/harvest_waste_type_response.go +++ b/api/metrc-gw/metrc_gw_models/harvest_waste_type_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *HarvestWasteTypeResponse) Validate(formats strfmt.Registry) error { } func (m *HarvestWasteTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *HarvestWasteTypeResponse) validateData(formats strfmt.Registry) error { } func (m *HarvestWasteTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *HarvestWasteTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this harvest waste type response based on the context it is used +func (m *HarvestWasteTypeResponse) 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 *HarvestWasteTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HarvestWasteTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HarvestWasteTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/invalid_error.go b/api/metrc-gw/metrc_gw_models/invalid_error.go index 855ebef..9b2cd12 100644 --- a/api/metrc-gw/metrc_gw_models/invalid_error.go +++ b/api/metrc-gw/metrc_gw_models/invalid_error.go @@ -10,6 +10,8 @@ package metrc_gw_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/item.go b/api/metrc-gw/metrc_gw_models/item.go index 1b0e8f1..23c025d 100644 --- a/api/metrc-gw/metrc_gw_models/item.go +++ b/api/metrc-gw/metrc_gw_models/item.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -23,39 +25,49 @@ type Item struct { AdministrationMethod string `json:"AdministrationMethod,omitempty"` // approval status + // Example: Approved ApprovalStatus string `json:"ApprovalStatus,omitempty"` // default lab testing state + // Example: NotSubmitted DefaultLabTestingState string `json:"DefaultLabTestingState,omitempty"` // Id + // Example: 34904 ID float64 `json:"Id,omitempty"` // ingredients Ingredients string `json:"Ingredients,omitempty"` // name + // Example: Ak-47 Shatter 2 Name string `json:"Name,omitempty"` // product category name + // Example: Extracts (each) ProductCategoryName string `json:"ProductCategoryName,omitempty"` // product category type + // Example: Concentrate ProductCategoryType string `json:"ProductCategoryType,omitempty"` // quantity type + // Example: CountBased QuantityType string `json:"QuantityType,omitempty"` // serving size ServingSize string `json:"ServingSize,omitempty"` // unit of measure name + // Example: Each UnitOfMeasureName string `json:"UnitOfMeasureName,omitempty"` // unit weight + // Example: 50 UnitWeight float64 `json:"UnitWeight,omitempty"` // unit weight unit of measure name + // Example: Milligrams UnitWeightUnitOfMeasureName string `json:"UnitWeightUnitOfMeasureName,omitempty"` } @@ -64,6 +76,11 @@ func (m *Item) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this item based on context it is used +func (m *Item) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Item) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/item_request.go b/api/metrc-gw/metrc_gw_models/item_request.go index 6fc2df1..a4cfae1 100644 --- a/api/metrc-gw/metrc_gw_models/item_request.go +++ b/api/metrc-gw/metrc_gw_models/item_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ItemRequest) Validate(formats strfmt.Registry) error { } func (m *ItemRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ItemRequest) validateData(formats strfmt.Registry) error { } func (m *ItemRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ItemRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this item request based on the context it is used +func (m *ItemRequest) 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 *ItemRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ItemRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ItemRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/item_response.go b/api/metrc-gw/metrc_gw_models/item_response.go index 2d679a7..a063989 100644 --- a/api/metrc-gw/metrc_gw_models/item_response.go +++ b/api/metrc-gw/metrc_gw_models/item_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ItemResponse) Validate(formats strfmt.Registry) error { } func (m *ItemResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ItemResponse) validateData(formats strfmt.Registry) error { } func (m *ItemResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ItemResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this item response based on the context it is used +func (m *ItemResponse) 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 *ItemResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ItemResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ItemResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/lab_test_state.go b/api/metrc-gw/metrc_gw_models/lab_test_state.go index 68b5d70..dd38dac 100644 --- a/api/metrc-gw/metrc_gw_models/lab_test_state.go +++ b/api/metrc-gw/metrc_gw_models/lab_test_state.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *LabTestState) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this lab test state based on context it is used +func (m *LabTestState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LabTestState) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/lab_test_state_response.go b/api/metrc-gw/metrc_gw_models/lab_test_state_response.go index a46239b..ef14bb4 100644 --- a/api/metrc-gw/metrc_gw_models/lab_test_state_response.go +++ b/api/metrc-gw/metrc_gw_models/lab_test_state_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LabTestStateResponse) Validate(formats strfmt.Registry) error { } func (m *LabTestStateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LabTestStateResponse) validateData(formats strfmt.Registry) error { } func (m *LabTestStateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LabTestStateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this lab test state response based on the context it is used +func (m *LabTestStateResponse) 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 *LabTestStateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LabTestStateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LabTestStateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/lab_test_type.go b/api/metrc-gw/metrc_gw_models/lab_test_type.go index f05f73d..f08ba41 100644 --- a/api/metrc-gw/metrc_gw_models/lab_test_type.go +++ b/api/metrc-gw/metrc_gw_models/lab_test_type.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,18 +22,23 @@ import ( type LabTestType struct { // always passes + // Example: false AlwaysPasses bool `json:"AlwaysPasses,omitempty"` // dependency mode + // Example: 0 DependencyMode float64 `json:"DependencyMode,omitempty"` // Id + // Example: 1 ID float64 `json:"Id,omitempty"` // name + // Example: THC Name string `json:"Name,omitempty"` // requires test result + // Example: false RequiresTestResult bool `json:"RequiresTestResult,omitempty"` } @@ -40,6 +47,11 @@ func (m *LabTestType) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this lab test type based on context it is used +func (m *LabTestType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LabTestType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/lab_test_type_response.go b/api/metrc-gw/metrc_gw_models/lab_test_type_response.go index 41e5ad9..1e7a6d5 100644 --- a/api/metrc-gw/metrc_gw_models/lab_test_type_response.go +++ b/api/metrc-gw/metrc_gw_models/lab_test_type_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LabTestTypeResponse) Validate(formats strfmt.Registry) error { } func (m *LabTestTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LabTestTypeResponse) validateData(formats strfmt.Registry) error { } func (m *LabTestTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LabTestTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this lab test type response based on the context it is used +func (m *LabTestTypeResponse) 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 *LabTestTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LabTestTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LabTestTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/license.go b/api/metrc-gw/metrc_gw_models/license.go index e3fba1e..6b866bd 100644 --- a/api/metrc-gw/metrc_gw_models/license.go +++ b/api/metrc-gw/metrc_gw_models/license.go @@ -10,6 +10,8 @@ package metrc_gw_models // 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" @@ -22,18 +24,22 @@ import ( type License struct { // end date + // Example: 2020-09-28 // Required: true EndDate *string `json:"EndDate"` // license type + // Example: Recreational Wholesaler // Required: true LicenseType *string `json:"LicenseType"` // number + // Example: 060-X0001 // Required: true Number *string `json:"Number"` // start date + // Example: 2013-01-28 // Required: true StartDate *string `json:"StartDate"` } @@ -100,6 +106,11 @@ func (m *License) validateStartDate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this license based on context it is used +func (m *License) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *License) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/package.go b/api/metrc-gw/metrc_gw_models/package.go index 90adbcf..de829ab 100644 --- a/api/metrc-gw/metrc_gw_models/package.go +++ b/api/metrc-gw/metrc_gw_models/package.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,99 +22,131 @@ import ( type Package struct { // archived date + // Example: 2014-11-29 ArchivedDate string `json:"ArchivedDate,omitempty"` // contains remediated product + // Example: false ContainsRemediatedProduct bool `json:"ContainsRemediatedProduct,omitempty"` // finished date + // Example: 2014-11-29 FinishedDate string `json:"FinishedDate,omitempty"` // Id + // Example: 2 ID float64 `json:"Id,omitempty"` // initial lab testing state + // Example: NotSubmitted InitialLabTestingState string `json:"InitialLabTestingState,omitempty"` // is on hold + // Example: false IsOnHold bool `json:"IsOnHold,omitempty"` // is process validation testing sample + // Example: false IsProcessValidationTestingSample bool `json:"IsProcessValidationTestingSample,omitempty"` // is production batch + // Example: false IsProductionBatch bool `json:"IsProductionBatch,omitempty"` // is testing sample + // Example: false IsTestingSample bool `json:"IsTestingSample,omitempty"` // lab testing state + // Example: NotSubmitted LabTestingState string `json:"LabTestingState,omitempty"` // lab testing state date + // Example: 2014-11-29 LabTestingStateDate string `json:"LabTestingStateDate,omitempty"` // label + // Example: ABCDEF012345670000010042 Label string `json:"Label,omitempty"` // last modified + // Example: 2019-01-30T02:52:15.0599079+00:00 LastModified string `json:"LastModified,omitempty"` // package type + // Example: Product PackageType string `json:"PackageType,omitempty"` // packaged date + // Example: 2014-11-29 PackagedDate string `json:"PackagedDate,omitempty"` // patient license number + // Example: _string_ PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"` // product category name + // Example: Buds ProductCategoryName string `json:"ProductCategoryName,omitempty"` // product Id + // Example: 1 ProductID float64 `json:"ProductId,omitempty"` // product name + // Example: Buds ProductName string `json:"ProductName,omitempty"` // product requires remediation + // Example: false ProductRequiresRemediation bool `json:"ProductRequiresRemediation,omitempty"` // production batch number + // Example: _string_ ProductionBatchNumber string `json:"ProductionBatchNumber,omitempty"` // quantity + // Example: 1 Quantity float64 `json:"Quantity,omitempty"` // received date time + // Example: _string_ ReceivedDateTime string `json:"ReceivedDateTime,omitempty"` // received from facility license number + // Example: _string_ ReceivedFromFacilityLicenseNumber string `json:"ReceivedFromFacilityLicenseNumber,omitempty"` // received from facility name + // Example: _string_ ReceivedFromFacilityName string `json:"ReceivedFromFacilityName,omitempty"` // received from manifest number + // Example: _string_ ReceivedFromManifestNumber string `json:"ReceivedFromManifestNumber,omitempty"` // remediation date + // Example: 2014-11-29 RemediationDate string `json:"RemediationDate,omitempty"` // room Id + // Example: _string_ RoomID string `json:"RoomId,omitempty"` // room name + // Example: _string_ RoomName string `json:"RoomName,omitempty"` // source harvest names + // Example: _string_ SourceHarvestNames string `json:"SourceHarvestNames,omitempty"` // unit of measure abbreviation + // Example: oz UnitOfMeasureAbbreviation string `json:"UnitOfMeasureAbbreviation,omitempty"` // unit of measure name + // Example: Ounces UnitOfMeasureName string `json:"UnitOfMeasureName,omitempty"` } @@ -121,6 +155,11 @@ func (m *Package) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this package based on context it is used +func (m *Package) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Package) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/package_adjustment_reason.go b/api/metrc-gw/metrc_gw_models/package_adjustment_reason.go index e8ea6ce..dafc71d 100644 --- a/api/metrc-gw/metrc_gw_models/package_adjustment_reason.go +++ b/api/metrc-gw/metrc_gw_models/package_adjustment_reason.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *PackageAdjustmentReason) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this package adjustment reason based on context it is used +func (m *PackageAdjustmentReason) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PackageAdjustmentReason) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/package_adjustment_reason_response.go b/api/metrc-gw/metrc_gw_models/package_adjustment_reason_response.go index 5a0127b..4b8855f 100644 --- a/api/metrc-gw/metrc_gw_models/package_adjustment_reason_response.go +++ b/api/metrc-gw/metrc_gw_models/package_adjustment_reason_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PackageAdjustmentReasonResponse) Validate(formats strfmt.Registry) erro } func (m *PackageAdjustmentReasonResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PackageAdjustmentReasonResponse) validateData(formats strfmt.Registry) } func (m *PackageAdjustmentReasonResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PackageAdjustmentReasonResponse) validateMeta(formats strfmt.Registry) return nil } +// ContextValidate validate this package adjustment reason response based on the context it is used +func (m *PackageAdjustmentReasonResponse) 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 *PackageAdjustmentReasonResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PackageAdjustmentReasonResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PackageAdjustmentReasonResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/package_request.go b/api/metrc-gw/metrc_gw_models/package_request.go index 1e06fcf..4081476 100644 --- a/api/metrc-gw/metrc_gw_models/package_request.go +++ b/api/metrc-gw/metrc_gw_models/package_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PackageRequest) Validate(formats strfmt.Registry) error { } func (m *PackageRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PackageRequest) validateData(formats strfmt.Registry) error { } func (m *PackageRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PackageRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this package request based on the context it is used +func (m *PackageRequest) 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 *PackageRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PackageRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PackageRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/package_response.go b/api/metrc-gw/metrc_gw_models/package_response.go index 29bfee5..3807ee4 100644 --- a/api/metrc-gw/metrc_gw_models/package_response.go +++ b/api/metrc-gw/metrc_gw_models/package_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PackageResponse) Validate(formats strfmt.Registry) error { } func (m *PackageResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PackageResponse) validateData(formats strfmt.Registry) error { } func (m *PackageResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PackageResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this package response based on the context it is used +func (m *PackageResponse) 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 *PackageResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PackageResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PackageResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/package_type.go b/api/metrc-gw/metrc_gw_models/package_type.go index 7649dba..90bcfa5 100644 --- a/api/metrc-gw/metrc_gw_models/package_type.go +++ b/api/metrc-gw/metrc_gw_models/package_type.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *PackageType) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this package type based on context it is used +func (m *PackageType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PackageType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/package_type_response.go b/api/metrc-gw/metrc_gw_models/package_type_response.go index 7d54d9b..5c7f94b 100644 --- a/api/metrc-gw/metrc_gw_models/package_type_response.go +++ b/api/metrc-gw/metrc_gw_models/package_type_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PackageTypeResponse) Validate(formats strfmt.Registry) error { } func (m *PackageTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PackageTypeResponse) validateData(formats strfmt.Registry) error { } func (m *PackageTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PackageTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this package type response based on the context it is used +func (m *PackageTypeResponse) 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 *PackageTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PackageTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PackageTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/pagination.go b/api/metrc-gw/metrc_gw_models/pagination.go index c72e174..fdc2c40 100644 --- a/api/metrc-gw/metrc_gw_models/pagination.go +++ b/api/metrc-gw/metrc_gw_models/pagination.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant.go b/api/metrc-gw/metrc_gw_models/plant.go index ecdcec0..ff87c6e 100644 --- a/api/metrc-gw/metrc_gw_models/plant.go +++ b/api/metrc-gw/metrc_gw_models/plant.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -73,6 +75,11 @@ func (m *Plant) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this plant based on context it is used +func (m *Plant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Plant) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_batch.go b/api/metrc-gw/metrc_gw_models/plant_batch.go index 59f2701..b48edab 100644 --- a/api/metrc-gw/metrc_gw_models/plant_batch.go +++ b/api/metrc-gw/metrc_gw_models/plant_batch.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,66 +22,87 @@ import ( type PlantBatch struct { // count + // Example: 80 Count float64 `json:"Count,omitempty"` // destroyed count + // Example: 40 DestroyedCount float64 `json:"DestroyedCount,omitempty"` // harvested count + // Example: 0 HarvestedCount float64 `json:"HarvestedCount,omitempty"` // Id + // Example: 5 ID float64 `json:"Id,omitempty"` // last modified + // Example: 0001-01-01T00:00:00+00:00 LastModified string `json:"LastModified,omitempty"` // live count + // Example: 10 LiveCount float64 `json:"LiveCount,omitempty"` // name + // Example: Demo Plant Batch 1 Name string `json:"Name,omitempty"` // packaged count + // Example: 0 PackagedCount float64 `json:"PackagedCount,omitempty"` // patient license number + // Example: _string_ PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"` // planted date + // Example: 2014-10-10 PlantedDate string `json:"PlantedDate,omitempty"` // room Id + // Example: _string_ RoomID string `json:"RoomId,omitempty"` // room name + // Example: _string_ RoomName string `json:"RoomName,omitempty"` // source package Id + // Example: 0 SourcePackageID float64 `json:"SourcePackageId,omitempty"` // source package label + // Example: _string_ SourcePackageLabel string `json:"SourcePackageLabel,omitempty"` // source plant Id + // Example: 0 SourcePlantID float64 `json:"SourcePlantId,omitempty"` // source plant label + // Example: _string_ SourcePlantLabel string `json:"SourcePlantLabel,omitempty"` // strain Id + // Example: 1 StrainID float64 `json:"StrainId,omitempty"` // strain name + // Example: Spring Hill Kush StrainName string `json:"StrainName,omitempty"` // tracked count + // Example: 10 TrackedCount float64 `json:"TrackedCount,omitempty"` // type + // Example: Seed Type string `json:"Type,omitempty"` // untracked count + // Example: 80 UntrackedCount float64 `json:"UntrackedCount,omitempty"` } @@ -88,6 +111,11 @@ func (m *PlantBatch) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this plant batch based on context it is used +func (m *PlantBatch) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PlantBatch) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_batch_request.go b/api/metrc-gw/metrc_gw_models/plant_batch_request.go index 801ab4d..92abb93 100644 --- a/api/metrc-gw/metrc_gw_models/plant_batch_request.go +++ b/api/metrc-gw/metrc_gw_models/plant_batch_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlantBatchRequest) Validate(formats strfmt.Registry) error { } func (m *PlantBatchRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlantBatchRequest) validateData(formats strfmt.Registry) error { } func (m *PlantBatchRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlantBatchRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this plant batch request based on the context it is used +func (m *PlantBatchRequest) 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 *PlantBatchRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlantBatchRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlantBatchRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_batch_response.go b/api/metrc-gw/metrc_gw_models/plant_batch_response.go index 88fa818..c88de00 100644 --- a/api/metrc-gw/metrc_gw_models/plant_batch_response.go +++ b/api/metrc-gw/metrc_gw_models/plant_batch_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlantBatchResponse) Validate(formats strfmt.Registry) error { } func (m *PlantBatchResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlantBatchResponse) validateData(formats strfmt.Registry) error { } func (m *PlantBatchResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlantBatchResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this plant batch response based on the context it is used +func (m *PlantBatchResponse) 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 *PlantBatchResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlantBatchResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlantBatchResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_growth_phase.go b/api/metrc-gw/metrc_gw_models/plant_growth_phase.go index 9fc9670..230de44 100644 --- a/api/metrc-gw/metrc_gw_models/plant_growth_phase.go +++ b/api/metrc-gw/metrc_gw_models/plant_growth_phase.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *PlantGrowthPhase) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this plant growth phase based on context it is used +func (m *PlantGrowthPhase) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PlantGrowthPhase) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_growth_phase_response.go b/api/metrc-gw/metrc_gw_models/plant_growth_phase_response.go index 93a66f6..cf3120e 100644 --- a/api/metrc-gw/metrc_gw_models/plant_growth_phase_response.go +++ b/api/metrc-gw/metrc_gw_models/plant_growth_phase_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlantGrowthPhaseResponse) Validate(formats strfmt.Registry) error { } func (m *PlantGrowthPhaseResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlantGrowthPhaseResponse) validateData(formats strfmt.Registry) error { } func (m *PlantGrowthPhaseResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlantGrowthPhaseResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this plant growth phase response based on the context it is used +func (m *PlantGrowthPhaseResponse) 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 *PlantGrowthPhaseResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlantGrowthPhaseResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlantGrowthPhaseResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_request.go b/api/metrc-gw/metrc_gw_models/plant_request.go index 834bb3a..756e8af 100644 --- a/api/metrc-gw/metrc_gw_models/plant_request.go +++ b/api/metrc-gw/metrc_gw_models/plant_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlantRequest) Validate(formats strfmt.Registry) error { } func (m *PlantRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlantRequest) validateData(formats strfmt.Registry) error { } func (m *PlantRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlantRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this plant request based on the context it is used +func (m *PlantRequest) 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 *PlantRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlantRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlantRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_response.go b/api/metrc-gw/metrc_gw_models/plant_response.go index 488736f..fbfed74 100644 --- a/api/metrc-gw/metrc_gw_models/plant_response.go +++ b/api/metrc-gw/metrc_gw_models/plant_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlantResponse) Validate(formats strfmt.Registry) error { } func (m *PlantResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlantResponse) validateData(formats strfmt.Registry) error { } func (m *PlantResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlantResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this plant response based on the context it is used +func (m *PlantResponse) 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 *PlantResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlantResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlantResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_waste_method.go b/api/metrc-gw/metrc_gw_models/plant_waste_method.go index 79b1d12..358feb5 100644 --- a/api/metrc-gw/metrc_gw_models/plant_waste_method.go +++ b/api/metrc-gw/metrc_gw_models/plant_waste_method.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -28,6 +30,11 @@ func (m *PlantWasteMethod) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this plant waste method based on context it is used +func (m *PlantWasteMethod) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PlantWasteMethod) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_waste_method_response.go b/api/metrc-gw/metrc_gw_models/plant_waste_method_response.go index cc83d1c..e1257c8 100644 --- a/api/metrc-gw/metrc_gw_models/plant_waste_method_response.go +++ b/api/metrc-gw/metrc_gw_models/plant_waste_method_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlantWasteMethodResponse) Validate(formats strfmt.Registry) error { } func (m *PlantWasteMethodResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlantWasteMethodResponse) validateData(formats strfmt.Registry) error { } func (m *PlantWasteMethodResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlantWasteMethodResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this plant waste method response based on the context it is used +func (m *PlantWasteMethodResponse) 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 *PlantWasteMethodResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlantWasteMethodResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlantWasteMethodResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/plant_waste_reason_response.go b/api/metrc-gw/metrc_gw_models/plant_waste_reason_response.go index 489f7b8..d4fd922 100644 --- a/api/metrc-gw/metrc_gw_models/plant_waste_reason_response.go +++ b/api/metrc-gw/metrc_gw_models/plant_waste_reason_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlantWasteReasonResponse) Validate(formats strfmt.Registry) error { } func (m *PlantWasteReasonResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlantWasteReasonResponse) validateData(formats strfmt.Registry) error { } func (m *PlantWasteReasonResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlantWasteReasonResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this plant waste reason response based on the context it is used +func (m *PlantWasteReasonResponse) 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 *PlantWasteReasonResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlantWasteReasonResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlantWasteReasonResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/product_category.go b/api/metrc-gw/metrc_gw_models/product_category.go index c3939e0..932ab95 100644 --- a/api/metrc-gw/metrc_gw_models/product_category.go +++ b/api/metrc-gw/metrc_gw_models/product_category.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,57 +22,75 @@ import ( type ProductCategory struct { // can be remediated + // Example: true CanBeRemediated bool `json:"CanBeRemediated,omitempty"` // can contain seeds + // Example: true CanContainSeeds bool `json:"CanContainSeeds,omitempty"` // name + // Example: Buds Name string `json:"Name,omitempty"` // product category type + // Example: Buds ProductCategoryType string `json:"ProductCategoryType,omitempty"` // quantity type + // Example: WeightBased QuantityType string `json:"QuantityType,omitempty"` // requires administration method + // Example: false RequiresAdministrationMethod bool `json:"RequiresAdministrationMethod,omitempty"` // requires ingredients + // Example: false RequiresIngredients bool `json:"RequiresIngredients,omitempty"` // requires item brand + // Example: false RequiresItemBrand bool `json:"RequiresItemBrand,omitempty"` // requires product photo + // Example: false RequiresProductPhoto bool `json:"RequiresProductPhoto,omitempty"` // requires serving size + // Example: false RequiresServingSize bool `json:"RequiresServingSize,omitempty"` // requires strain + // Example: false RequiresStrain bool `json:"RequiresStrain,omitempty"` // requires supply duration days + // Example: false RequiresSupplyDurationDays bool `json:"RequiresSupplyDurationDays,omitempty"` // requires unit cbd content + // Example: false RequiresUnitCbdContent bool `json:"RequiresUnitCbdContent,omitempty"` // requires unit cbd percent + // Example: false RequiresUnitCbdPercent bool `json:"RequiresUnitCbdPercent,omitempty"` // requires unit thc content + // Example: false RequiresUnitThcContent bool `json:"RequiresUnitThcContent,omitempty"` // requires unit thc percent + // Example: false RequiresUnitThcPercent bool `json:"RequiresUnitThcPercent,omitempty"` // requires unit volume + // Example: false RequiresUnitVolume bool `json:"RequiresUnitVolume,omitempty"` // requires unit weight + // Example: false RequiresUnitWeight bool `json:"RequiresUnitWeight,omitempty"` } @@ -79,6 +99,11 @@ func (m *ProductCategory) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this product category based on context it is used +func (m *ProductCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ProductCategory) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/product_category_response.go b/api/metrc-gw/metrc_gw_models/product_category_response.go index 1a140c8..38e174f 100644 --- a/api/metrc-gw/metrc_gw_models/product_category_response.go +++ b/api/metrc-gw/metrc_gw_models/product_category_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ProductCategoryResponse) Validate(formats strfmt.Registry) error { } func (m *ProductCategoryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ProductCategoryResponse) validateData(formats strfmt.Registry) error { } func (m *ProductCategoryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ProductCategoryResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this product category response based on the context it is used +func (m *ProductCategoryResponse) 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 *ProductCategoryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductCategoryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductCategoryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/request_meta.go b/api/metrc-gw/metrc_gw_models/request_meta.go index 418c2f5..e1150da 100644 --- a/api/metrc-gw/metrc_gw_models/request_meta.go +++ b/api/metrc-gw/metrc_gw_models/request_meta.go @@ -10,6 +10,8 @@ package metrc_gw_models // 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" @@ -22,6 +24,7 @@ import ( type RequestMeta struct { // license + // Example: A12-0000015-LIC // Required: true License *string `json:"license"` @@ -33,23 +36,29 @@ type RequestMeta struct { Production *bool `json:"production"` // reseller + // Example: \u003c\u003cunique key\u003e\u003e // Required: true Reseller *string `json:"reseller"` // state + // Example: CA // Required: true State *string `json:"state"` // Taxnexus Account Number for recording transactions + // Example: T0000001 TaxnexusAccount string `json:"taxnexus_account,omitempty"` // test only + // Example: true TestOnly bool `json:"test_only,omitempty"` // transaction date + // Example: 2019-01-01 TransactionDate string `json:"transaction_date,omitempty"` // user + // Example: \u003c\u003cunique key\u003e\u003e // Required: true User *string `json:"user"` } @@ -129,6 +138,11 @@ func (m *RequestMeta) validateUser(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/response_meta.go b/api/metrc-gw/metrc_gw_models/response_meta.go index 22e8b71..92bc0ed 100644 --- a/api/metrc-gw/metrc_gw_models/response_meta.go +++ b/api/metrc-gw/metrc_gw_models/response_meta.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -58,6 +60,11 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this response meta based on context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/room.go b/api/metrc-gw/metrc_gw_models/room.go index 4cabb26..4d4f007 100644 --- a/api/metrc-gw/metrc_gw_models/room.go +++ b/api/metrc-gw/metrc_gw_models/room.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *Room) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this room based on context it is used +func (m *Room) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Room) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/room_request.go b/api/metrc-gw/metrc_gw_models/room_request.go index edc3923..b0b17bd 100644 --- a/api/metrc-gw/metrc_gw_models/room_request.go +++ b/api/metrc-gw/metrc_gw_models/room_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *RoomRequest) Validate(formats strfmt.Registry) error { } func (m *RoomRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *RoomRequest) validateData(formats strfmt.Registry) error { } func (m *RoomRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *RoomRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this room request based on the context it is used +func (m *RoomRequest) 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 *RoomRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RoomRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *RoomRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/room_response.go b/api/metrc-gw/metrc_gw_models/room_response.go index 2b75d0b..6bea1b1 100644 --- a/api/metrc-gw/metrc_gw_models/room_response.go +++ b/api/metrc-gw/metrc_gw_models/room_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *RoomResponse) Validate(formats strfmt.Registry) error { } func (m *RoomResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *RoomResponse) validateData(formats strfmt.Registry) error { } func (m *RoomResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *RoomResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this room response based on the context it is used +func (m *RoomResponse) 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 *RoomResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RoomResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *RoomResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_delivery.go b/api/metrc-gw/metrc_gw_models/sales_delivery.go index 1606e0c..e3def76 100644 --- a/api/metrc-gw/metrc_gw_models/sales_delivery.go +++ b/api/metrc-gw/metrc_gw_models/sales_delivery.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,60 +24,78 @@ import ( type SalesDelivery struct { // driver name + // Example: John Doe DriverName string `json:"DriverName,omitempty"` // driver occupational license number + // Example: 1 DriverOccupationalLicenseNumber string `json:"DriverOccupationalLicenseNumber,omitempty"` // driver vehicle license number + // Example: 1 DriverVehicleLicenseNumber string `json:"DriverVehicleLicenseNumber,omitempty"` // estimated arrival date time + // Example: 2017-04-04T13:00:00.000 EstimatedArrivalDateTime string `json:"EstimatedArrivalDateTime,omitempty"` // estimated departure date time + // Example: 2017-04-04T11:00:00.000 EstimatedDepartureDateTime string `json:"EstimatedDepartureDateTime,omitempty"` // Id + // Example: 51 ID float64 `json:"Id,omitempty"` // phone number for questions + // Example: +1-123-456-7890 PhoneNumberForQuestions string `json:"PhoneNumberForQuestions,omitempty"` // planned route + // Example: Drive to destination. PlannedRoute string `json:"PlannedRoute,omitempty"` // recipient address city + // Example: Denver RecipientAddressCity string `json:"RecipientAddressCity,omitempty"` // recipient address postal code + // Example: 11111 RecipientAddressPostalCode string `json:"RecipientAddressPostalCode,omitempty"` // recipient address state + // Example: CO RecipientAddressState string `json:"RecipientAddressState,omitempty"` // recipient address street1 + // Example: 1 Someplace Road RecipientAddressStreet1 string `json:"RecipientAddressStreet1,omitempty"` // recipient address street2 + // Example: Ste 9 RecipientAddressStreet2 string `json:"RecipientAddressStreet2,omitempty"` // sales customer type + // Example: Consumer SalesCustomerType string `json:"SalesCustomerType,omitempty"` // sales date time + // Example: 2017-04-04T10:10:19.000 SalesDateTime string `json:"SalesDateTime,omitempty"` // transactions Transactions []*Transaction `json:"Transactions"` // vehicle license plate number + // Example: 000000 VehicleLicensePlateNumber string `json:"VehicleLicensePlateNumber,omitempty"` // vehicle make + // Example: Car VehicleMake string `json:"VehicleMake,omitempty"` // vehicle model + // Example: Small VehicleModel string `json:"VehicleModel,omitempty"` } @@ -95,7 +114,6 @@ func (m *SalesDelivery) Validate(formats strfmt.Registry) error { } func (m *SalesDelivery) validateTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.Transactions) { // not required return nil } @@ -119,6 +137,38 @@ func (m *SalesDelivery) validateTransactions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this sales delivery based on the context it is used +func (m *SalesDelivery) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SalesDelivery) contextValidateTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Transactions); i++ { + + if m.Transactions[i] != nil { + if err := m.Transactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Transactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesDelivery) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_delivery_request.go b/api/metrc-gw/metrc_gw_models/sales_delivery_request.go index 7da1981..741e70d 100644 --- a/api/metrc-gw/metrc_gw_models/sales_delivery_request.go +++ b/api/metrc-gw/metrc_gw_models/sales_delivery_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SalesDeliveryRequest) Validate(formats strfmt.Registry) error { } func (m *SalesDeliveryRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SalesDeliveryRequest) validateData(formats strfmt.Registry) error { } func (m *SalesDeliveryRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SalesDeliveryRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this sales delivery request based on the context it is used +func (m *SalesDeliveryRequest) 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 *SalesDeliveryRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SalesDeliveryRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesDeliveryRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_delivery_response.go b/api/metrc-gw/metrc_gw_models/sales_delivery_response.go index d21a125..45ddffb 100644 --- a/api/metrc-gw/metrc_gw_models/sales_delivery_response.go +++ b/api/metrc-gw/metrc_gw_models/sales_delivery_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SalesDeliveryResponse) Validate(formats strfmt.Registry) error { } func (m *SalesDeliveryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SalesDeliveryResponse) validateData(formats strfmt.Registry) error { } func (m *SalesDeliveryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SalesDeliveryResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this sales delivery response based on the context it is used +func (m *SalesDeliveryResponse) 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 *SalesDeliveryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SalesDeliveryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesDeliveryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason.go b/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason.go index cb99a42..61ef847 100644 --- a/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason.go +++ b/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *SalesDeliveryReturnReason) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this sales delivery return reason based on context it is used +func (m *SalesDeliveryReturnReason) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SalesDeliveryReturnReason) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason_response.go b/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason_response.go index 1935fee..2a25035 100644 --- a/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason_response.go +++ b/api/metrc-gw/metrc_gw_models/sales_delivery_return_reason_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SalesDeliveryReturnReasonResponse) Validate(formats strfmt.Registry) er } func (m *SalesDeliveryReturnReasonResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SalesDeliveryReturnReasonResponse) validateData(formats strfmt.Registry } func (m *SalesDeliveryReturnReasonResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SalesDeliveryReturnReasonResponse) validateMeta(formats strfmt.Registry return nil } +// ContextValidate validate this sales delivery return reason response based on the context it is used +func (m *SalesDeliveryReturnReasonResponse) 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 *SalesDeliveryReturnReasonResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SalesDeliveryReturnReasonResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesDeliveryReturnReasonResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_receipt.go b/api/metrc-gw/metrc_gw_models/sales_receipt.go index f59f7ac..e253396 100644 --- a/api/metrc-gw/metrc_gw_models/sales_receipt.go +++ b/api/metrc-gw/metrc_gw_models/sales_receipt.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -23,39 +24,48 @@ import ( type SalesReceipt struct { // archived date + // Example: string ArchivedDate string `json:"ArchivedDate,omitempty"` // caregiver license number CaregiverLicenseNumber string `json:"CaregiverLicenseNumber,omitempty"` // Id + // Example: 38304110 ID float64 `json:"Id,omitempty"` // identification method IdentificationMethod string `json:"IdentificationMethod,omitempty"` // is final + // Example: false IsFinal bool `json:"IsFinal,omitempty"` // last modified + // Example: 2019-02-14T23:52:31+00:00 LastModified string `json:"LastModified,omitempty"` // patient license number PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"` // receipt number + // Example: 38304110 ReceiptNumber string `json:"ReceiptNumber,omitempty"` // sales customer type + // Example: Consumer SalesCustomerType string `json:"SalesCustomerType,omitempty"` // sales date time + // Example: 2019-02-14T15:50:45.000 SalesDateTime string `json:"SalesDateTime,omitempty"` // total packages + // Example: 3 TotalPackages float64 `json:"TotalPackages,omitempty"` // total price + // Example: 60.83 TotalPrice float64 `json:"TotalPrice,omitempty"` // transactions @@ -77,7 +87,6 @@ func (m *SalesReceipt) Validate(formats strfmt.Registry) error { } func (m *SalesReceipt) validateTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.Transactions) { // not required return nil } @@ -101,6 +110,38 @@ func (m *SalesReceipt) validateTransactions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this sales receipt based on the context it is used +func (m *SalesReceipt) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SalesReceipt) contextValidateTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Transactions); i++ { + + if m.Transactions[i] != nil { + if err := m.Transactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Transactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesReceipt) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_receipt_request.go b/api/metrc-gw/metrc_gw_models/sales_receipt_request.go index 671bd47..07bfffe 100644 --- a/api/metrc-gw/metrc_gw_models/sales_receipt_request.go +++ b/api/metrc-gw/metrc_gw_models/sales_receipt_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SalesReceiptRequest) Validate(formats strfmt.Registry) error { } func (m *SalesReceiptRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SalesReceiptRequest) validateData(formats strfmt.Registry) error { } func (m *SalesReceiptRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SalesReceiptRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this sales receipt request based on the context it is used +func (m *SalesReceiptRequest) 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 *SalesReceiptRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SalesReceiptRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesReceiptRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_receipt_response.go b/api/metrc-gw/metrc_gw_models/sales_receipt_response.go index 13980ed..25b0077 100644 --- a/api/metrc-gw/metrc_gw_models/sales_receipt_response.go +++ b/api/metrc-gw/metrc_gw_models/sales_receipt_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SalesReceiptResponse) Validate(formats strfmt.Registry) error { } func (m *SalesReceiptResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SalesReceiptResponse) validateData(formats strfmt.Registry) error { } func (m *SalesReceiptResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SalesReceiptResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this sales receipt response based on the context it is used +func (m *SalesReceiptResponse) 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 *SalesReceiptResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SalesReceiptResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesReceiptResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/sales_transaction_date_response.go b/api/metrc-gw/metrc_gw_models/sales_transaction_date_response.go index cde76c8..52108fc 100644 --- a/api/metrc-gw/metrc_gw_models/sales_transaction_date_response.go +++ b/api/metrc-gw/metrc_gw_models/sales_transaction_date_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SalesTransactionDateResponse) Validate(formats strfmt.Registry) error { } func (m *SalesTransactionDateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SalesTransactionDateResponse) validateData(formats strfmt.Registry) err } func (m *SalesTransactionDateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SalesTransactionDateResponse) validateMeta(formats strfmt.Registry) err return nil } +// ContextValidate validate this sales transaction date response based on the context it is used +func (m *SalesTransactionDateResponse) 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 *SalesTransactionDateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SalesTransactionDateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SalesTransactionDateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/strain.go b/api/metrc-gw/metrc_gw_models/strain.go index 9df33c7..7c70982 100644 --- a/api/metrc-gw/metrc_gw_models/strain.go +++ b/api/metrc-gw/metrc_gw_models/strain.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,21 +22,27 @@ import ( type Strain struct { // genetics + // Example: 100% Sativa Genetics string `json:"Genetics,omitempty"` // Id + // Example: 2426 ID float64 `json:"Id,omitempty"` // indica percentage + // Example: 0 IndicaPercentage float64 `json:"IndicaPercentage,omitempty"` // name + // Example: 0 Test Name string `json:"Name,omitempty"` // sativa percentage + // Example: 100 SativaPercentage float64 `json:"SativaPercentage,omitempty"` // testing status + // Example: None TestingStatus string `json:"TestingStatus,omitempty"` } @@ -43,6 +51,11 @@ func (m *Strain) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this strain based on context it is used +func (m *Strain) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Strain) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/strain_request.go b/api/metrc-gw/metrc_gw_models/strain_request.go index 82fad91..a606ef2 100644 --- a/api/metrc-gw/metrc_gw_models/strain_request.go +++ b/api/metrc-gw/metrc_gw_models/strain_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *StrainRequest) Validate(formats strfmt.Registry) error { } func (m *StrainRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *StrainRequest) validateData(formats strfmt.Registry) error { } func (m *StrainRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *StrainRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this strain request based on the context it is used +func (m *StrainRequest) 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 *StrainRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StrainRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *StrainRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/strain_response.go b/api/metrc-gw/metrc_gw_models/strain_response.go index 841bbe5..89706c9 100644 --- a/api/metrc-gw/metrc_gw_models/strain_response.go +++ b/api/metrc-gw/metrc_gw_models/strain_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *StrainResponse) Validate(formats strfmt.Registry) error { } func (m *StrainResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *StrainResponse) validateData(formats strfmt.Registry) error { } func (m *StrainResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *StrainResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this strain response based on the context it is used +func (m *StrainResponse) 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 *StrainResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StrainResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *StrainResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/transaction.go b/api/metrc-gw/metrc_gw_models/transaction.go index a9d9de6..cb9c530 100644 --- a/api/metrc-gw/metrc_gw_models/transaction.go +++ b/api/metrc-gw/metrc_gw_models/transaction.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,33 +22,43 @@ import ( type Transaction struct { // archived date + // Example: string ArchivedDate string `json:"ArchivedDate,omitempty"` // last modified + // Example: 2019-02-14T23:52:31+00:00 LastModified string `json:"LastModified,omitempty"` // package Id + // Example: 4081625 PackageID float64 `json:"PackageId,omitempty"` // package label + // Example: 1A401030001AD55000000426 PackageLabel string `json:"PackageLabel,omitempty"` // product name + // Example: Platinum Yeti ProductName string `json:"ProductName,omitempty"` // quantity sold + // Example: 4 QuantitySold float64 `json:"QuantitySold,omitempty"` // sales delivery state + // Example: string SalesDeliveryState string `json:"SalesDeliveryState,omitempty"` // total price + // Example: 20 TotalPrice float64 `json:"TotalPrice,omitempty"` // unit of measure abbreviation + // Example: g UnitOfMeasureAbbreviation string `json:"UnitOfMeasureAbbreviation,omitempty"` // unit of measure name + // Example: Grams UnitOfMeasureName string `json:"UnitOfMeasureName,omitempty"` } @@ -55,6 +67,11 @@ func (m *Transaction) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this transaction based on context it is used +func (m *Transaction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Transaction) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/transaction_request.go b/api/metrc-gw/metrc_gw_models/transaction_request.go index fe3d169..a9aa976 100644 --- a/api/metrc-gw/metrc_gw_models/transaction_request.go +++ b/api/metrc-gw/metrc_gw_models/transaction_request.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TransactionRequest) Validate(formats strfmt.Registry) error { } func (m *TransactionRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TransactionRequest) validateData(formats strfmt.Registry) error { } func (m *TransactionRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TransactionRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this transaction request based on the context it is used +func (m *TransactionRequest) 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 *TransactionRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/transaction_response.go b/api/metrc-gw/metrc_gw_models/transaction_response.go index b4b9eeb..886832a 100644 --- a/api/metrc-gw/metrc_gw_models/transaction_response.go +++ b/api/metrc-gw/metrc_gw_models/transaction_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TransactionResponse) Validate(formats strfmt.Registry) error { } func (m *TransactionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TransactionResponse) validateData(formats strfmt.Registry) error { } func (m *TransactionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TransactionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this transaction response based on the context it is used +func (m *TransactionResponse) 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 *TransactionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/transfer.go b/api/metrc-gw/metrc_gw_models/transfer.go index 7646bb7..f5ff278 100644 --- a/api/metrc-gw/metrc_gw_models/transfer.go +++ b/api/metrc-gw/metrc_gw_models/transfer.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,117 +22,155 @@ import ( type Transfer struct { // actual arrival date time + // Example: _string_ ActualArrivalDateTime string `json:"ActualArrivalDateTime,omitempty"` // actual departure date time + // Example: _string_ ActualDepartureDateTime string `json:"ActualDepartureDateTime,omitempty"` // contains plant package + // Example: false ContainsPlantPackage bool `json:"ContainsPlantPackage,omitempty"` // contains product package + // Example: false ContainsProductPackage bool `json:"ContainsProductPackage,omitempty"` // contains product requires remediation + // Example: false ContainsProductRequiresRemediation bool `json:"ContainsProductRequiresRemediation,omitempty"` // contains remediated product package + // Example: false ContainsRemediatedProductPackage bool `json:"ContainsRemediatedProductPackage,omitempty"` // contains testing sample + // Example: false ContainsTestingSample bool `json:"ContainsTestingSample,omitempty"` // created by user name + // Example: _string_ CreatedByUserName string `json:"CreatedByUserName,omitempty"` // created date time + // Example: 2016-10-10T08:20:45-07:00 CreatedDateTime string `json:"CreatedDateTime,omitempty"` // delivery count + // Example: 0 DeliveryCount float64 `json:"DeliveryCount,omitempty"` // delivery Id + // Example: 1 DeliveryID float64 `json:"DeliveryId,omitempty"` // delivery package count + // Example: 7 DeliveryPackageCount float64 `json:"DeliveryPackageCount,omitempty"` // delivery received package count + // Example: 0 DeliveryReceivedPackageCount float64 `json:"DeliveryReceivedPackageCount,omitempty"` // driver name + // Example: _string_ DriverName string `json:"DriverName,omitempty"` // driver occupational license number + // Example: _string_ DriverOccupationalLicenseNumber string `json:"DriverOccupationalLicenseNumber,omitempty"` // driver vehicle license number + // Example: _string_ DriverVehicleLicenseNumber string `json:"DriverVehicleLicenseNumber,omitempty"` // estimated arrival date time + // Example: 2016-10-11T16:50:00.000 EstimatedArrivalDateTime string `json:"EstimatedArrivalDateTime,omitempty"` // estimated departure date time + // Example: 2016-10-11T14:48:30.000 EstimatedDepartureDateTime string `json:"EstimatedDepartureDateTime,omitempty"` // Id + // Example: 1 ID float64 `json:"Id,omitempty"` // last modified + // Example: 0001-01-01T00:00:00+00:00 LastModified string `json:"LastModified,omitempty"` // manifest number + // Example: 0000000001 ManifestNumber string `json:"ManifestNumber,omitempty"` // name + // Example: _string_ Name string `json:"Name,omitempty"` // package count + // Example: 7 PackageCount float64 `json:"PackageCount,omitempty"` // received date time + // Example: 2016-10-11T16:42:19-07:00 ReceivedDateTime string `json:"ReceivedDateTime,omitempty"` // received delivery count + // Example: 0 ReceivedDeliveryCount float64 `json:"ReceivedDeliveryCount,omitempty"` // received package count + // Example: 0 ReceivedPackageCount float64 `json:"ReceivedPackageCount,omitempty"` // recipient facility license number + // Example: 123-ABC RecipientFacilityLicenseNumber string `json:"RecipientFacilityLicenseNumber,omitempty"` // recipient facility name + // Example: Lofty Med-Cultivation A RecipientFacilityName string `json:"RecipientFacilityName,omitempty"` // shipment license type + // Example: 0 ShipmentLicenseType float64 `json:"ShipmentLicenseType,omitempty"` // shipment transaction type + // Example: Standard ShipmentTransactionType string `json:"ShipmentTransactionType,omitempty"` // shipment type name + // Example: Transfer ShipmentTypeName string `json:"ShipmentTypeName,omitempty"` // shipper facility license number + // Example: 123-ABC ShipperFacilityLicenseNumber string `json:"ShipperFacilityLicenseNumber,omitempty"` // shipper facility name + // Example: Lofty Med-Cultivation B ShipperFacilityName string `json:"ShipperFacilityName,omitempty"` // transporter facility license number + // Example: 123-BCD TransporterFacilityLicenseNumber string `json:"TransporterFacilityLicenseNumber,omitempty"` // transporter facility name + // Example: Lofty Med-Dispensary TransporterFacilityName string `json:"TransporterFacilityName,omitempty"` // vehicle license plate number + // Example: _string_ VehicleLicensePlateNumber string `json:"VehicleLicensePlateNumber,omitempty"` // vehicle make + // Example: _string_ VehicleMake string `json:"VehicleMake,omitempty"` // vehicle model + // Example: _string_ VehicleModel string `json:"VehicleModel,omitempty"` } @@ -139,6 +179,11 @@ func (m *Transfer) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this transfer based on context it is used +func (m *Transfer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Transfer) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/transfer_response.go b/api/metrc-gw/metrc_gw_models/transfer_response.go index 1398078..a7602f5 100644 --- a/api/metrc-gw/metrc_gw_models/transfer_response.go +++ b/api/metrc-gw/metrc_gw_models/transfer_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TransferResponse) Validate(formats strfmt.Registry) error { } func (m *TransferResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TransferResponse) validateData(formats strfmt.Registry) error { } func (m *TransferResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TransferResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this transfer response based on the context it is used +func (m *TransferResponse) 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 *TransferResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransferResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransferResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/units_of_measure.go b/api/metrc-gw/metrc_gw_models/units_of_measure.go index e6ba000..836297b 100644 --- a/api/metrc-gw/metrc_gw_models/units_of_measure.go +++ b/api/metrc-gw/metrc_gw_models/units_of_measure.go @@ -10,6 +10,8 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,12 +22,15 @@ import ( type UnitsOfMeasure struct { // abbreviation + // Example: ea Abbreviation string `json:"Abbreviation,omitempty"` // name + // Example: Each Name string `json:"Name,omitempty"` // quantity type + // Example: CountBased QuantityType string `json:"QuantityType,omitempty"` } @@ -34,6 +39,11 @@ func (m *UnitsOfMeasure) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this units of measure based on context it is used +func (m *UnitsOfMeasure) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UnitsOfMeasure) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/metrc-gw/metrc_gw_models/units_of_measure_response.go b/api/metrc-gw/metrc_gw_models/units_of_measure_response.go index fc4f501..aab4eca 100644 --- a/api/metrc-gw/metrc_gw_models/units_of_measure_response.go +++ b/api/metrc-gw/metrc_gw_models/units_of_measure_response.go @@ -10,6 +10,7 @@ package metrc_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *UnitsOfMeasureResponse) Validate(formats strfmt.Registry) error { } func (m *UnitsOfMeasureResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *UnitsOfMeasureResponse) validateData(formats strfmt.Registry) error { } func (m *UnitsOfMeasureResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *UnitsOfMeasureResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this units of measure response based on the context it is used +func (m *UnitsOfMeasureResponse) 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 *UnitsOfMeasureResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UnitsOfMeasureResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *UnitsOfMeasureResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_client/cash_receipt/cash_receipt_client.go b/api/ops/ops_client/cash_receipt/cash_receipt_client.go index 198e1e0..c908fe0 100644 --- a/api/ops/ops_client/cash_receipt/cash_receipt_client.go +++ b/api/ops/ops_client/cash_receipt/cash_receipt_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteCashReceipt(params *DeleteCashReceiptParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCashReceiptOK, error) + DeleteCashReceipt(params *DeleteCashReceiptParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCashReceiptOK, error) - GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCashReceiptsOK, error) + GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCashReceiptsOK, error) - PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCashReceiptsOK, error) + PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCashReceiptsOK, error) - PutCashReceipts(params *PutCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCashReceiptsOK, error) + PutCashReceipts(params *PutCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCashReceiptsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete cash receipt by ID */ -func (a *Client) DeleteCashReceipt(params *DeleteCashReceiptParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCashReceiptOK, error) { +func (a *Client) DeleteCashReceipt(params *DeleteCashReceiptParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCashReceiptOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteCashReceiptParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteCashReceipt", Method: "DELETE", PathPattern: "/cashreceipts", @@ -65,7 +67,12 @@ func (a *Client) DeleteCashReceipt(params *DeleteCashReceiptParams, authInfo run 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteCashReceipt(params *DeleteCashReceiptParams, authInfo run Return a list of available Taxnexus Cash Receipts */ -func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCashReceiptsOK, error) { +func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCashReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCashReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCashReceipts", Method: "GET", PathPattern: "/cashreceipts", @@ -102,7 +108,12 @@ func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime 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 } @@ -121,13 +132,12 @@ func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime Create New Cash Receipts */ -func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCashReceiptsOK, error) { +func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCashReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCashReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCashReceipts", Method: "POST", PathPattern: "/cashreceipts", @@ -139,7 +149,12 @@ func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runti 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 } @@ -158,13 +173,12 @@ func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runti Put a list of Cash Receipts */ -func (a *Client) PutCashReceipts(params *PutCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCashReceiptsOK, error) { +func (a *Client) PutCashReceipts(params *PutCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCashReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutCashReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putCashReceipts", Method: "PUT", PathPattern: "/cashreceipts", @@ -176,7 +190,12 @@ func (a *Client) PutCashReceipts(params *PutCashReceiptsParams, authInfo runtime 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 } diff --git a/api/ops/ops_client/cash_receipt/delete_cash_receipt_parameters.go b/api/ops/ops_client/cash_receipt/delete_cash_receipt_parameters.go index 9641c90..5a84f96 100644 --- a/api/ops/ops_client/cash_receipt/delete_cash_receipt_parameters.go +++ b/api/ops/ops_client/cash_receipt/delete_cash_receipt_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteCashReceiptParams creates a new DeleteCashReceiptParams object -// with the default values initialized. +// NewDeleteCashReceiptParams creates a new DeleteCashReceiptParams 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 NewDeleteCashReceiptParams() *DeleteCashReceiptParams { - var () return &DeleteCashReceiptParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteCashReceiptParamsWithTimeout creates a new DeleteCashReceiptParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteCashReceiptParamsWithTimeout(timeout time.Duration) *DeleteCashReceiptParams { - var () return &DeleteCashReceiptParams{ - timeout: timeout, } } // NewDeleteCashReceiptParamsWithContext creates a new DeleteCashReceiptParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteCashReceiptParamsWithContext(ctx context.Context) *DeleteCashReceiptParams { - var () return &DeleteCashReceiptParams{ - Context: ctx, } } // NewDeleteCashReceiptParamsWithHTTPClient creates a new DeleteCashReceiptParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteCashReceiptParamsWithHTTPClient(client *http.Client) *DeleteCashReceiptParams { - var () return &DeleteCashReceiptParams{ HTTPClient: client, } } -/*DeleteCashReceiptParams contains all the parameters to send to the API endpoint -for the delete cash receipt operation typically these are written to a http.Request +/* DeleteCashReceiptParams contains all the parameters to send to the API endpoint + for the delete cash receipt operation. + + Typically these are written to a http.Request. */ type DeleteCashReceiptParams struct { - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + Taxnexus Id of the record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeleteCashReceiptParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete cash receipt params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteCashReceiptParams) WithDefaults() *DeleteCashReceiptParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete cash receipt params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteCashReceiptParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete cash receipt params func (o *DeleteCashReceiptParams) WithTimeout(timeout time.Duration) *DeleteCashReceiptParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteCashReceiptParams) WriteToRequest(r runtime.ClientRequest, reg st // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/cash_receipt/delete_cash_receipt_responses.go b/api/ops/ops_client/cash_receipt/delete_cash_receipt_responses.go index 682c1bd..599253c 100644 --- a/api/ops/ops_client/cash_receipt/delete_cash_receipt_responses.go +++ b/api/ops/ops_client/cash_receipt/delete_cash_receipt_responses.go @@ -63,9 +63,8 @@ func (o *DeleteCashReceiptReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteCashReceiptOK() *DeleteCashReceiptOK { return &DeleteCashReceiptOK{} } -/*DeleteCashReceiptOK handles this case with default header values. +/* DeleteCashReceiptOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteCashReceiptOK struct { func (o *DeleteCashReceiptOK) Error() string { return fmt.Sprintf("[DELETE /cashreceipts][%d] deleteCashReceiptOK %+v", 200, o.Payload) } - func (o *DeleteCashReceiptOK) GetPayload() *ops_models.DeleteResponse { return o.Payload } func (o *DeleteCashReceiptOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteCashReceiptUnauthorized() *DeleteCashReceiptUnauthorized { return &DeleteCashReceiptUnauthorized{} } -/*DeleteCashReceiptUnauthorized handles this case with default header values. +/* DeleteCashReceiptUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteCashReceiptUnauthorized struct { func (o *DeleteCashReceiptUnauthorized) Error() string { return fmt.Sprintf("[DELETE /cashreceipts][%d] deleteCashReceiptUnauthorized %+v", 401, o.Payload) } - func (o *DeleteCashReceiptUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteCashReceiptUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewDeleteCashReceiptForbidden() *DeleteCashReceiptForbidden { return &DeleteCashReceiptForbidden{} } -/*DeleteCashReceiptForbidden handles this case with default header values. +/* DeleteCashReceiptForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteCashReceiptForbidden struct { func (o *DeleteCashReceiptForbidden) Error() string { return fmt.Sprintf("[DELETE /cashreceipts][%d] deleteCashReceiptForbidden %+v", 403, o.Payload) } - func (o *DeleteCashReceiptForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteCashReceiptForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewDeleteCashReceiptNotFound() *DeleteCashReceiptNotFound { return &DeleteCashReceiptNotFound{} } -/*DeleteCashReceiptNotFound handles this case with default header values. +/* DeleteCashReceiptNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteCashReceiptNotFound struct { func (o *DeleteCashReceiptNotFound) Error() string { return fmt.Sprintf("[DELETE /cashreceipts][%d] deleteCashReceiptNotFound %+v", 404, o.Payload) } - func (o *DeleteCashReceiptNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteCashReceiptNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewDeleteCashReceiptUnprocessableEntity() *DeleteCashReceiptUnprocessableEn return &DeleteCashReceiptUnprocessableEntity{} } -/*DeleteCashReceiptUnprocessableEntity handles this case with default header values. +/* DeleteCashReceiptUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteCashReceiptUnprocessableEntity struct { func (o *DeleteCashReceiptUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /cashreceipts][%d] deleteCashReceiptUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteCashReceiptUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteCashReceiptUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewDeleteCashReceiptInternalServerError() *DeleteCashReceiptInternalServerE return &DeleteCashReceiptInternalServerError{} } -/*DeleteCashReceiptInternalServerError handles this case with default header values. +/* DeleteCashReceiptInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteCashReceiptInternalServerError struct { func (o *DeleteCashReceiptInternalServerError) Error() string { return fmt.Sprintf("[DELETE /cashreceipts][%d] deleteCashReceiptInternalServerError %+v", 500, o.Payload) } - func (o *DeleteCashReceiptInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteCashReceiptInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/cash_receipt/get_cash_receipts_parameters.go b/api/ops/ops_client/cash_receipt/get_cash_receipts_parameters.go index c04cf54..221cd8c 100644 --- a/api/ops/ops_client/cash_receipt/get_cash_receipts_parameters.go +++ b/api/ops/ops_client/cash_receipt/get_cash_receipts_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCashReceiptsParams creates a new GetCashReceiptsParams object -// with the default values initialized. +// NewGetCashReceiptsParams creates a new GetCashReceiptsParams 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 NewGetCashReceiptsParams() *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCashReceiptsParamsWithTimeout creates a new GetCashReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCashReceiptsParamsWithTimeout(timeout time.Duration) *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ - timeout: timeout, } } // NewGetCashReceiptsParamsWithContext creates a new GetCashReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCashReceiptsParamsWithContext(ctx context.Context) *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ - Context: ctx, } } // NewGetCashReceiptsParamsWithHTTPClient creates a new GetCashReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCashReceiptsParamsWithHTTPClient(client *http.Client) *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ HTTPClient: client, } } -/*GetCashReceiptsParams contains all the parameters to send to the API endpoint -for the get cash receipts operation typically these are written to a http.Request +/* GetCashReceiptsParams contains all the parameters to send to the API endpoint + for the get cash receipts operation. + + Typically these are written to a http.Request. */ type GetCashReceiptsParams struct { - /*CashReceiptID - Taxnexus Record Id of a Cash Receipt + /* CashReceiptID. + Taxnexus Record Id of a Cash Receipt */ CashReceiptID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetCashReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCashReceiptsParams) WithDefaults() *GetCashReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCashReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get cash receipts params func (o *GetCashReceiptsParams) WithTimeout(timeout time.Duration) *GetCashReceiptsParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetCashReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param cashReceiptId var qrCashReceiptID string + if o.CashReceiptID != nil { qrCashReceiptID = *o.CashReceiptID } qCashReceiptID := qrCashReceiptID if qCashReceiptID != "" { + if err := r.SetQueryParam("cashReceiptId", qCashReceiptID); 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 { diff --git a/api/ops/ops_client/cash_receipt/get_cash_receipts_responses.go b/api/ops/ops_client/cash_receipt/get_cash_receipts_responses.go index 1e9cdab..9e2b972 100644 --- a/api/ops/ops_client/cash_receipt/get_cash_receipts_responses.go +++ b/api/ops/ops_client/cash_receipt/get_cash_receipts_responses.go @@ -63,9 +63,8 @@ func (o *GetCashReceiptsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetCashReceiptsOK() *GetCashReceiptsOK { return &GetCashReceiptsOK{} } -/*GetCashReceiptsOK handles this case with default header values. +/* GetCashReceiptsOK describes a response with status code 200, with default header values. Taxnexus Response with Cash Receipt objects */ type GetCashReceiptsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.CashReceiptResponse } @@ -89,18 +87,25 @@ type GetCashReceiptsOK struct { func (o *GetCashReceiptsOK) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsOK %+v", 200, o.Payload) } - func (o *GetCashReceiptsOK) GetPayload() *ops_models.CashReceiptResponse { return o.Payload } func (o *GetCashReceiptsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.CashReceiptResponse) @@ -117,7 +122,7 @@ func NewGetCashReceiptsUnauthorized() *GetCashReceiptsUnauthorized { return &GetCashReceiptsUnauthorized{} } -/*GetCashReceiptsUnauthorized handles this case with default header values. +/* GetCashReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetCashReceiptsUnauthorized struct { func (o *GetCashReceiptsUnauthorized) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *GetCashReceiptsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetCashReceiptsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetCashReceiptsForbidden() *GetCashReceiptsForbidden { return &GetCashReceiptsForbidden{} } -/*GetCashReceiptsForbidden handles this case with default header values. +/* GetCashReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetCashReceiptsForbidden struct { func (o *GetCashReceiptsForbidden) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsForbidden %+v", 403, o.Payload) } - func (o *GetCashReceiptsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetCashReceiptsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetCashReceiptsNotFound() *GetCashReceiptsNotFound { return &GetCashReceiptsNotFound{} } -/*GetCashReceiptsNotFound handles this case with default header values. +/* GetCashReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetCashReceiptsNotFound struct { func (o *GetCashReceiptsNotFound) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsNotFound %+v", 404, o.Payload) } - func (o *GetCashReceiptsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetCashReceiptsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetCashReceiptsUnprocessableEntity() *GetCashReceiptsUnprocessableEntity return &GetCashReceiptsUnprocessableEntity{} } -/*GetCashReceiptsUnprocessableEntity handles this case with default header values. +/* GetCashReceiptsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetCashReceiptsUnprocessableEntity struct { func (o *GetCashReceiptsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCashReceiptsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetCashReceiptsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetCashReceiptsInternalServerError() *GetCashReceiptsInternalServerError return &GetCashReceiptsInternalServerError{} } -/*GetCashReceiptsInternalServerError handles this case with default header values. +/* GetCashReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetCashReceiptsInternalServerError struct { func (o *GetCashReceiptsInternalServerError) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *GetCashReceiptsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetCashReceiptsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/cash_receipt/post_cash_receipts_parameters.go b/api/ops/ops_client/cash_receipt/post_cash_receipts_parameters.go index 202b677..78a113b 100644 --- a/api/ops/ops_client/cash_receipt/post_cash_receipts_parameters.go +++ b/api/ops/ops_client/cash_receipt/post_cash_receipts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostCashReceiptsParams creates a new PostCashReceiptsParams object -// with the default values initialized. +// NewPostCashReceiptsParams creates a new PostCashReceiptsParams 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 NewPostCashReceiptsParams() *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewPostCashReceiptsParamsWithTimeout creates a new PostCashReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCashReceiptsParamsWithTimeout(timeout time.Duration) *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ - timeout: timeout, } } // NewPostCashReceiptsParamsWithContext creates a new PostCashReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCashReceiptsParamsWithContext(ctx context.Context) *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ - Context: ctx, } } // NewPostCashReceiptsParamsWithHTTPClient creates a new PostCashReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCashReceiptsParamsWithHTTPClient(client *http.Client) *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ HTTPClient: client, } } -/*PostCashReceiptsParams contains all the parameters to send to the API endpoint -for the post cash receipts operation typically these are written to a http.Request +/* PostCashReceiptsParams contains all the parameters to send to the API endpoint + for the post cash receipts operation. + + Typically these are written to a http.Request. */ type PostCashReceiptsParams struct { - /*CashReceiptRequest - A request with an array of Cash Receipot Objects + /* CashReceiptRequest. + A request with an array of Cash Receipot Objects */ CashReceiptRequest *ops_models.CashReceiptRequest @@ -77,6 +76,21 @@ type PostCashReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCashReceiptsParams) WithDefaults() *PostCashReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCashReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post cash receipts params func (o *PostCashReceiptsParams) WithTimeout(timeout time.Duration) *PostCashReceiptsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostCashReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.CashReceiptRequest != nil { if err := r.SetBodyParam(o.CashReceiptRequest); err != nil { return err diff --git a/api/ops/ops_client/cash_receipt/post_cash_receipts_responses.go b/api/ops/ops_client/cash_receipt/post_cash_receipts_responses.go index ea4e7ec..4f775e8 100644 --- a/api/ops/ops_client/cash_receipt/post_cash_receipts_responses.go +++ b/api/ops/ops_client/cash_receipt/post_cash_receipts_responses.go @@ -63,9 +63,8 @@ func (o *PostCashReceiptsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostCashReceiptsOK() *PostCashReceiptsOK { return &PostCashReceiptsOK{} } -/*PostCashReceiptsOK handles this case with default header values. +/* PostCashReceiptsOK describes a response with status code 200, with default header values. Taxnexus Response with Cash Receipt objects */ type PostCashReceiptsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.CashReceiptResponse } @@ -89,18 +87,25 @@ type PostCashReceiptsOK struct { func (o *PostCashReceiptsOK) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsOK %+v", 200, o.Payload) } - func (o *PostCashReceiptsOK) GetPayload() *ops_models.CashReceiptResponse { return o.Payload } func (o *PostCashReceiptsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.CashReceiptResponse) @@ -117,7 +122,7 @@ func NewPostCashReceiptsUnauthorized() *PostCashReceiptsUnauthorized { return &PostCashReceiptsUnauthorized{} } -/*PostCashReceiptsUnauthorized handles this case with default header values. +/* PostCashReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostCashReceiptsUnauthorized struct { func (o *PostCashReceiptsUnauthorized) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *PostCashReceiptsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostCashReceiptsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostCashReceiptsForbidden() *PostCashReceiptsForbidden { return &PostCashReceiptsForbidden{} } -/*PostCashReceiptsForbidden handles this case with default header values. +/* PostCashReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostCashReceiptsForbidden struct { func (o *PostCashReceiptsForbidden) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsForbidden %+v", 403, o.Payload) } - func (o *PostCashReceiptsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostCashReceiptsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostCashReceiptsNotFound() *PostCashReceiptsNotFound { return &PostCashReceiptsNotFound{} } -/*PostCashReceiptsNotFound handles this case with default header values. +/* PostCashReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostCashReceiptsNotFound struct { func (o *PostCashReceiptsNotFound) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsNotFound %+v", 404, o.Payload) } - func (o *PostCashReceiptsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostCashReceiptsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostCashReceiptsUnprocessableEntity() *PostCashReceiptsUnprocessableEnti return &PostCashReceiptsUnprocessableEntity{} } -/*PostCashReceiptsUnprocessableEntity handles this case with default header values. +/* PostCashReceiptsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostCashReceiptsUnprocessableEntity struct { func (o *PostCashReceiptsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostCashReceiptsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostCashReceiptsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostCashReceiptsInternalServerError() *PostCashReceiptsInternalServerErr return &PostCashReceiptsInternalServerError{} } -/*PostCashReceiptsInternalServerError handles this case with default header values. +/* PostCashReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostCashReceiptsInternalServerError struct { func (o *PostCashReceiptsInternalServerError) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *PostCashReceiptsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostCashReceiptsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/cash_receipt/put_cash_receipts_parameters.go b/api/ops/ops_client/cash_receipt/put_cash_receipts_parameters.go index 438b8fb..462f7e7 100644 --- a/api/ops/ops_client/cash_receipt/put_cash_receipts_parameters.go +++ b/api/ops/ops_client/cash_receipt/put_cash_receipts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutCashReceiptsParams creates a new PutCashReceiptsParams object -// with the default values initialized. +// NewPutCashReceiptsParams creates a new PutCashReceiptsParams 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 NewPutCashReceiptsParams() *PutCashReceiptsParams { - var () return &PutCashReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewPutCashReceiptsParamsWithTimeout creates a new PutCashReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutCashReceiptsParamsWithTimeout(timeout time.Duration) *PutCashReceiptsParams { - var () return &PutCashReceiptsParams{ - timeout: timeout, } } // NewPutCashReceiptsParamsWithContext creates a new PutCashReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutCashReceiptsParamsWithContext(ctx context.Context) *PutCashReceiptsParams { - var () return &PutCashReceiptsParams{ - Context: ctx, } } // NewPutCashReceiptsParamsWithHTTPClient creates a new PutCashReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutCashReceiptsParamsWithHTTPClient(client *http.Client) *PutCashReceiptsParams { - var () return &PutCashReceiptsParams{ HTTPClient: client, } } -/*PutCashReceiptsParams contains all the parameters to send to the API endpoint -for the put cash receipts operation typically these are written to a http.Request +/* PutCashReceiptsParams contains all the parameters to send to the API endpoint + for the put cash receipts operation. + + Typically these are written to a http.Request. */ type PutCashReceiptsParams struct { - /*CashReceiptRequest - A request with an array of Cash Receipot Objects + /* CashReceiptRequest. + A request with an array of Cash Receipot Objects */ CashReceiptRequest *ops_models.CashReceiptRequest @@ -77,6 +76,21 @@ type PutCashReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutCashReceiptsParams) WithDefaults() *PutCashReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutCashReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put cash receipts params func (o *PutCashReceiptsParams) WithTimeout(timeout time.Duration) *PutCashReceiptsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutCashReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.CashReceiptRequest != nil { if err := r.SetBodyParam(o.CashReceiptRequest); err != nil { return err diff --git a/api/ops/ops_client/cash_receipt/put_cash_receipts_responses.go b/api/ops/ops_client/cash_receipt/put_cash_receipts_responses.go index 0a1c6ef..2650c92 100644 --- a/api/ops/ops_client/cash_receipt/put_cash_receipts_responses.go +++ b/api/ops/ops_client/cash_receipt/put_cash_receipts_responses.go @@ -63,9 +63,8 @@ func (o *PutCashReceiptsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutCashReceiptsOK() *PutCashReceiptsOK { return &PutCashReceiptsOK{} } -/*PutCashReceiptsOK handles this case with default header values. +/* PutCashReceiptsOK describes a response with status code 200, with default header values. Taxnexus Response with Cash Receipt objects */ type PutCashReceiptsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.CashReceiptResponse } @@ -89,18 +87,25 @@ type PutCashReceiptsOK struct { func (o *PutCashReceiptsOK) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsOK %+v", 200, o.Payload) } - func (o *PutCashReceiptsOK) GetPayload() *ops_models.CashReceiptResponse { return o.Payload } func (o *PutCashReceiptsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.CashReceiptResponse) @@ -117,7 +122,7 @@ func NewPutCashReceiptsUnauthorized() *PutCashReceiptsUnauthorized { return &PutCashReceiptsUnauthorized{} } -/*PutCashReceiptsUnauthorized handles this case with default header values. +/* PutCashReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutCashReceiptsUnauthorized struct { func (o *PutCashReceiptsUnauthorized) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *PutCashReceiptsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutCashReceiptsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPutCashReceiptsForbidden() *PutCashReceiptsForbidden { return &PutCashReceiptsForbidden{} } -/*PutCashReceiptsForbidden handles this case with default header values. +/* PutCashReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutCashReceiptsForbidden struct { func (o *PutCashReceiptsForbidden) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsForbidden %+v", 403, o.Payload) } - func (o *PutCashReceiptsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutCashReceiptsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPutCashReceiptsNotFound() *PutCashReceiptsNotFound { return &PutCashReceiptsNotFound{} } -/*PutCashReceiptsNotFound handles this case with default header values. +/* PutCashReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutCashReceiptsNotFound struct { func (o *PutCashReceiptsNotFound) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsNotFound %+v", 404, o.Payload) } - func (o *PutCashReceiptsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutCashReceiptsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPutCashReceiptsUnprocessableEntity() *PutCashReceiptsUnprocessableEntity return &PutCashReceiptsUnprocessableEntity{} } -/*PutCashReceiptsUnprocessableEntity handles this case with default header values. +/* PutCashReceiptsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutCashReceiptsUnprocessableEntity struct { func (o *PutCashReceiptsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutCashReceiptsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutCashReceiptsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPutCashReceiptsInternalServerError() *PutCashReceiptsInternalServerError return &PutCashReceiptsInternalServerError{} } -/*PutCashReceiptsInternalServerError handles this case with default header values. +/* PutCashReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutCashReceiptsInternalServerError struct { func (o *PutCashReceiptsInternalServerError) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *PutCashReceiptsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutCashReceiptsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/charge/charge_client.go b/api/ops/ops_client/charge/charge_client.go index 8d3daf4..1ca64ef 100644 --- a/api/ops/ops_client/charge/charge_client.go +++ b/api/ops/ops_client/charge/charge_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteCharge(params *DeleteChargeParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteChargeOK, error) + DeleteCharge(params *DeleteChargeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteChargeOK, error) - GetCharges(params *GetChargesParams, authInfo runtime.ClientAuthInfoWriter) (*GetChargesOK, error) + GetCharges(params *GetChargesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetChargesOK, error) - PostCharges(params *PostChargesParams, authInfo runtime.ClientAuthInfoWriter) (*PostChargesOK, error) + PostCharges(params *PostChargesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostChargesOK, error) - PutCharges(params *PutChargesParams, authInfo runtime.ClientAuthInfoWriter) (*PutChargesOK, error) + PutCharges(params *PutChargesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutChargesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete a Charge by ID */ -func (a *Client) DeleteCharge(params *DeleteChargeParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteChargeOK, error) { +func (a *Client) DeleteCharge(params *DeleteChargeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteChargeOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteChargeParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteCharge", Method: "DELETE", PathPattern: "/charges", @@ -65,7 +67,12 @@ func (a *Client) DeleteCharge(params *DeleteChargeParams, authInfo runtime.Clien 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteCharge(params *DeleteChargeParams, authInfo runtime.Clien Return a list of available Taxnexus Charges */ -func (a *Client) GetCharges(params *GetChargesParams, authInfo runtime.ClientAuthInfoWriter) (*GetChargesOK, error) { +func (a *Client) GetCharges(params *GetChargesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetChargesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetChargesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCharges", Method: "GET", PathPattern: "/charges", @@ -102,7 +108,12 @@ func (a *Client) GetCharges(params *GetChargesParams, authInfo runtime.ClientAut 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 } @@ -121,13 +132,12 @@ func (a *Client) GetCharges(params *GetChargesParams, authInfo runtime.ClientAut Create New Charges */ -func (a *Client) PostCharges(params *PostChargesParams, authInfo runtime.ClientAuthInfoWriter) (*PostChargesOK, error) { +func (a *Client) PostCharges(params *PostChargesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostChargesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostChargesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCharges", Method: "POST", PathPattern: "/charges", @@ -139,7 +149,12 @@ func (a *Client) PostCharges(params *PostChargesParams, authInfo runtime.ClientA 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 } @@ -158,13 +173,12 @@ func (a *Client) PostCharges(params *PostChargesParams, authInfo runtime.ClientA Put a list of Charges */ -func (a *Client) PutCharges(params *PutChargesParams, authInfo runtime.ClientAuthInfoWriter) (*PutChargesOK, error) { +func (a *Client) PutCharges(params *PutChargesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutChargesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutChargesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putCharges", Method: "PUT", PathPattern: "/charges", @@ -176,7 +190,12 @@ func (a *Client) PutCharges(params *PutChargesParams, authInfo runtime.ClientAut 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 } diff --git a/api/ops/ops_client/charge/delete_charge_parameters.go b/api/ops/ops_client/charge/delete_charge_parameters.go index 061287d..dce3b7a 100644 --- a/api/ops/ops_client/charge/delete_charge_parameters.go +++ b/api/ops/ops_client/charge/delete_charge_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteChargeParams creates a new DeleteChargeParams object -// with the default values initialized. +// NewDeleteChargeParams creates a new DeleteChargeParams 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 NewDeleteChargeParams() *DeleteChargeParams { - var () return &DeleteChargeParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteChargeParamsWithTimeout creates a new DeleteChargeParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteChargeParamsWithTimeout(timeout time.Duration) *DeleteChargeParams { - var () return &DeleteChargeParams{ - timeout: timeout, } } // NewDeleteChargeParamsWithContext creates a new DeleteChargeParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteChargeParamsWithContext(ctx context.Context) *DeleteChargeParams { - var () return &DeleteChargeParams{ - Context: ctx, } } // NewDeleteChargeParamsWithHTTPClient creates a new DeleteChargeParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteChargeParamsWithHTTPClient(client *http.Client) *DeleteChargeParams { - var () return &DeleteChargeParams{ HTTPClient: client, } } -/*DeleteChargeParams contains all the parameters to send to the API endpoint -for the delete charge operation typically these are written to a http.Request +/* DeleteChargeParams contains all the parameters to send to the API endpoint + for the delete charge operation. + + Typically these are written to a http.Request. */ type DeleteChargeParams struct { - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + Taxnexus Id of the record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeleteChargeParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete charge params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteChargeParams) WithDefaults() *DeleteChargeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete charge params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteChargeParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete charge params func (o *DeleteChargeParams) WithTimeout(timeout time.Duration) *DeleteChargeParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteChargeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/charge/delete_charge_responses.go b/api/ops/ops_client/charge/delete_charge_responses.go index 8f7c143..d0e4f57 100644 --- a/api/ops/ops_client/charge/delete_charge_responses.go +++ b/api/ops/ops_client/charge/delete_charge_responses.go @@ -63,9 +63,8 @@ func (o *DeleteChargeReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteChargeOK() *DeleteChargeOK { return &DeleteChargeOK{} } -/*DeleteChargeOK handles this case with default header values. +/* DeleteChargeOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteChargeOK struct { func (o *DeleteChargeOK) Error() string { return fmt.Sprintf("[DELETE /charges][%d] deleteChargeOK %+v", 200, o.Payload) } - func (o *DeleteChargeOK) GetPayload() *ops_models.DeleteResponse { return o.Payload } func (o *DeleteChargeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteChargeUnauthorized() *DeleteChargeUnauthorized { return &DeleteChargeUnauthorized{} } -/*DeleteChargeUnauthorized handles this case with default header values. +/* DeleteChargeUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteChargeUnauthorized struct { func (o *DeleteChargeUnauthorized) Error() string { return fmt.Sprintf("[DELETE /charges][%d] deleteChargeUnauthorized %+v", 401, o.Payload) } - func (o *DeleteChargeUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteChargeUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewDeleteChargeForbidden() *DeleteChargeForbidden { return &DeleteChargeForbidden{} } -/*DeleteChargeForbidden handles this case with default header values. +/* DeleteChargeForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteChargeForbidden struct { func (o *DeleteChargeForbidden) Error() string { return fmt.Sprintf("[DELETE /charges][%d] deleteChargeForbidden %+v", 403, o.Payload) } - func (o *DeleteChargeForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteChargeForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewDeleteChargeNotFound() *DeleteChargeNotFound { return &DeleteChargeNotFound{} } -/*DeleteChargeNotFound handles this case with default header values. +/* DeleteChargeNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteChargeNotFound struct { func (o *DeleteChargeNotFound) Error() string { return fmt.Sprintf("[DELETE /charges][%d] deleteChargeNotFound %+v", 404, o.Payload) } - func (o *DeleteChargeNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteChargeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewDeleteChargeUnprocessableEntity() *DeleteChargeUnprocessableEntity { return &DeleteChargeUnprocessableEntity{} } -/*DeleteChargeUnprocessableEntity handles this case with default header values. +/* DeleteChargeUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteChargeUnprocessableEntity struct { func (o *DeleteChargeUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /charges][%d] deleteChargeUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteChargeUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteChargeUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewDeleteChargeInternalServerError() *DeleteChargeInternalServerError { return &DeleteChargeInternalServerError{} } -/*DeleteChargeInternalServerError handles this case with default header values. +/* DeleteChargeInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteChargeInternalServerError struct { func (o *DeleteChargeInternalServerError) Error() string { return fmt.Sprintf("[DELETE /charges][%d] deleteChargeInternalServerError %+v", 500, o.Payload) } - func (o *DeleteChargeInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteChargeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/charge/get_charges_parameters.go b/api/ops/ops_client/charge/get_charges_parameters.go index aedc4fb..727333b 100644 --- a/api/ops/ops_client/charge/get_charges_parameters.go +++ b/api/ops/ops_client/charge/get_charges_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetChargesParams creates a new GetChargesParams object -// with the default values initialized. +// NewGetChargesParams creates a new GetChargesParams 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 NewGetChargesParams() *GetChargesParams { - var () return &GetChargesParams{ - timeout: cr.DefaultTimeout, } } // NewGetChargesParamsWithTimeout creates a new GetChargesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetChargesParamsWithTimeout(timeout time.Duration) *GetChargesParams { - var () return &GetChargesParams{ - timeout: timeout, } } // NewGetChargesParamsWithContext creates a new GetChargesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetChargesParamsWithContext(ctx context.Context) *GetChargesParams { - var () return &GetChargesParams{ - Context: ctx, } } // NewGetChargesParamsWithHTTPClient creates a new GetChargesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetChargesParamsWithHTTPClient(client *http.Client) *GetChargesParams { - var () return &GetChargesParams{ HTTPClient: client, } } -/*GetChargesParams contains all the parameters to send to the API endpoint -for the get charges operation typically these are written to a http.Request +/* GetChargesParams contains all the parameters to send to the API endpoint + for the get charges operation. + + Typically these are written to a http.Request. */ type GetChargesParams struct { - /*ChargeID - Taxnexus Record Id of a Charge + /* ChargeID. + Taxnexus Record Id of a Charge */ ChargeID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetChargesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get charges params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetChargesParams) WithDefaults() *GetChargesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get charges params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetChargesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get charges params func (o *GetChargesParams) WithTimeout(timeout time.Duration) *GetChargesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetChargesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param chargeId var qrChargeID string + if o.ChargeID != nil { qrChargeID = *o.ChargeID } qChargeID := qrChargeID if qChargeID != "" { + if err := r.SetQueryParam("chargeId", qChargeID); 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 { diff --git a/api/ops/ops_client/charge/get_charges_responses.go b/api/ops/ops_client/charge/get_charges_responses.go index 2a1bd94..2ad34f7 100644 --- a/api/ops/ops_client/charge/get_charges_responses.go +++ b/api/ops/ops_client/charge/get_charges_responses.go @@ -63,9 +63,8 @@ func (o *GetChargesReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetChargesOK() *GetChargesOK { return &GetChargesOK{} } -/*GetChargesOK handles this case with default header values. +/* GetChargesOK describes a response with status code 200, with default header values. Taxnexus Response with Charge objects */ type GetChargesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.ChargeResponse } @@ -89,18 +87,25 @@ type GetChargesOK struct { func (o *GetChargesOK) Error() string { return fmt.Sprintf("[GET /charges][%d] getChargesOK %+v", 200, o.Payload) } - func (o *GetChargesOK) GetPayload() *ops_models.ChargeResponse { return o.Payload } func (o *GetChargesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.ChargeResponse) @@ -117,7 +122,7 @@ func NewGetChargesUnauthorized() *GetChargesUnauthorized { return &GetChargesUnauthorized{} } -/*GetChargesUnauthorized handles this case with default header values. +/* GetChargesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetChargesUnauthorized struct { func (o *GetChargesUnauthorized) Error() string { return fmt.Sprintf("[GET /charges][%d] getChargesUnauthorized %+v", 401, o.Payload) } - func (o *GetChargesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetChargesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetChargesForbidden() *GetChargesForbidden { return &GetChargesForbidden{} } -/*GetChargesForbidden handles this case with default header values. +/* GetChargesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetChargesForbidden struct { func (o *GetChargesForbidden) Error() string { return fmt.Sprintf("[GET /charges][%d] getChargesForbidden %+v", 403, o.Payload) } - func (o *GetChargesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetChargesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetChargesNotFound() *GetChargesNotFound { return &GetChargesNotFound{} } -/*GetChargesNotFound handles this case with default header values. +/* GetChargesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetChargesNotFound struct { func (o *GetChargesNotFound) Error() string { return fmt.Sprintf("[GET /charges][%d] getChargesNotFound %+v", 404, o.Payload) } - func (o *GetChargesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetChargesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetChargesUnprocessableEntity() *GetChargesUnprocessableEntity { return &GetChargesUnprocessableEntity{} } -/*GetChargesUnprocessableEntity handles this case with default header values. +/* GetChargesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetChargesUnprocessableEntity struct { func (o *GetChargesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /charges][%d] getChargesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetChargesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetChargesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetChargesInternalServerError() *GetChargesInternalServerError { return &GetChargesInternalServerError{} } -/*GetChargesInternalServerError handles this case with default header values. +/* GetChargesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetChargesInternalServerError struct { func (o *GetChargesInternalServerError) Error() string { return fmt.Sprintf("[GET /charges][%d] getChargesInternalServerError %+v", 500, o.Payload) } - func (o *GetChargesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetChargesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/charge/post_charges_parameters.go b/api/ops/ops_client/charge/post_charges_parameters.go index 8e6a74b..62794b4 100644 --- a/api/ops/ops_client/charge/post_charges_parameters.go +++ b/api/ops/ops_client/charge/post_charges_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostChargesParams creates a new PostChargesParams object -// with the default values initialized. +// NewPostChargesParams creates a new PostChargesParams 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 NewPostChargesParams() *PostChargesParams { - var () return &PostChargesParams{ - timeout: cr.DefaultTimeout, } } // NewPostChargesParamsWithTimeout creates a new PostChargesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostChargesParamsWithTimeout(timeout time.Duration) *PostChargesParams { - var () return &PostChargesParams{ - timeout: timeout, } } // NewPostChargesParamsWithContext creates a new PostChargesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostChargesParamsWithContext(ctx context.Context) *PostChargesParams { - var () return &PostChargesParams{ - Context: ctx, } } // NewPostChargesParamsWithHTTPClient creates a new PostChargesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostChargesParamsWithHTTPClient(client *http.Client) *PostChargesParams { - var () return &PostChargesParams{ HTTPClient: client, } } -/*PostChargesParams contains all the parameters to send to the API endpoint -for the post charges operation typically these are written to a http.Request +/* PostChargesParams contains all the parameters to send to the API endpoint + for the post charges operation. + + Typically these are written to a http.Request. */ type PostChargesParams struct { - /*ChargeRequest - A request with an array of Charge Objects + /* ChargeRequest. + A request with an array of Charge Objects */ ChargeRequest *ops_models.ChargeRequest @@ -77,6 +76,21 @@ type PostChargesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post charges params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostChargesParams) WithDefaults() *PostChargesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post charges params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostChargesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post charges params func (o *PostChargesParams) WithTimeout(timeout time.Duration) *PostChargesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostChargesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ChargeRequest != nil { if err := r.SetBodyParam(o.ChargeRequest); err != nil { return err diff --git a/api/ops/ops_client/charge/post_charges_responses.go b/api/ops/ops_client/charge/post_charges_responses.go index 460e15f..551a6b9 100644 --- a/api/ops/ops_client/charge/post_charges_responses.go +++ b/api/ops/ops_client/charge/post_charges_responses.go @@ -63,9 +63,8 @@ func (o *PostChargesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostChargesOK() *PostChargesOK { return &PostChargesOK{} } -/*PostChargesOK handles this case with default header values. +/* PostChargesOK describes a response with status code 200, with default header values. Taxnexus Response with Charge objects */ type PostChargesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.ChargeResponse } @@ -89,18 +87,25 @@ type PostChargesOK struct { func (o *PostChargesOK) Error() string { return fmt.Sprintf("[POST /charges][%d] postChargesOK %+v", 200, o.Payload) } - func (o *PostChargesOK) GetPayload() *ops_models.ChargeResponse { return o.Payload } func (o *PostChargesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.ChargeResponse) @@ -117,7 +122,7 @@ func NewPostChargesUnauthorized() *PostChargesUnauthorized { return &PostChargesUnauthorized{} } -/*PostChargesUnauthorized handles this case with default header values. +/* PostChargesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostChargesUnauthorized struct { func (o *PostChargesUnauthorized) Error() string { return fmt.Sprintf("[POST /charges][%d] postChargesUnauthorized %+v", 401, o.Payload) } - func (o *PostChargesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostChargesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostChargesForbidden() *PostChargesForbidden { return &PostChargesForbidden{} } -/*PostChargesForbidden handles this case with default header values. +/* PostChargesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostChargesForbidden struct { func (o *PostChargesForbidden) Error() string { return fmt.Sprintf("[POST /charges][%d] postChargesForbidden %+v", 403, o.Payload) } - func (o *PostChargesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostChargesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostChargesNotFound() *PostChargesNotFound { return &PostChargesNotFound{} } -/*PostChargesNotFound handles this case with default header values. +/* PostChargesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostChargesNotFound struct { func (o *PostChargesNotFound) Error() string { return fmt.Sprintf("[POST /charges][%d] postChargesNotFound %+v", 404, o.Payload) } - func (o *PostChargesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostChargesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostChargesUnprocessableEntity() *PostChargesUnprocessableEntity { return &PostChargesUnprocessableEntity{} } -/*PostChargesUnprocessableEntity handles this case with default header values. +/* PostChargesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostChargesUnprocessableEntity struct { func (o *PostChargesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /charges][%d] postChargesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostChargesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostChargesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostChargesInternalServerError() *PostChargesInternalServerError { return &PostChargesInternalServerError{} } -/*PostChargesInternalServerError handles this case with default header values. +/* PostChargesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostChargesInternalServerError struct { func (o *PostChargesInternalServerError) Error() string { return fmt.Sprintf("[POST /charges][%d] postChargesInternalServerError %+v", 500, o.Payload) } - func (o *PostChargesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostChargesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/charge/put_charges_parameters.go b/api/ops/ops_client/charge/put_charges_parameters.go index 2f0da71..6f91ed1 100644 --- a/api/ops/ops_client/charge/put_charges_parameters.go +++ b/api/ops/ops_client/charge/put_charges_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutChargesParams creates a new PutChargesParams object -// with the default values initialized. +// NewPutChargesParams creates a new PutChargesParams 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 NewPutChargesParams() *PutChargesParams { - var () return &PutChargesParams{ - timeout: cr.DefaultTimeout, } } // NewPutChargesParamsWithTimeout creates a new PutChargesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutChargesParamsWithTimeout(timeout time.Duration) *PutChargesParams { - var () return &PutChargesParams{ - timeout: timeout, } } // NewPutChargesParamsWithContext creates a new PutChargesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutChargesParamsWithContext(ctx context.Context) *PutChargesParams { - var () return &PutChargesParams{ - Context: ctx, } } // NewPutChargesParamsWithHTTPClient creates a new PutChargesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutChargesParamsWithHTTPClient(client *http.Client) *PutChargesParams { - var () return &PutChargesParams{ HTTPClient: client, } } -/*PutChargesParams contains all the parameters to send to the API endpoint -for the put charges operation typically these are written to a http.Request +/* PutChargesParams contains all the parameters to send to the API endpoint + for the put charges operation. + + Typically these are written to a http.Request. */ type PutChargesParams struct { - /*ChargeRequest - A request with an array of Charge Objects + /* ChargeRequest. + A request with an array of Charge Objects */ ChargeRequest *ops_models.ChargeRequest @@ -77,6 +76,21 @@ type PutChargesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put charges params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutChargesParams) WithDefaults() *PutChargesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put charges params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutChargesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put charges params func (o *PutChargesParams) WithTimeout(timeout time.Duration) *PutChargesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutChargesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.ChargeRequest != nil { if err := r.SetBodyParam(o.ChargeRequest); err != nil { return err diff --git a/api/ops/ops_client/charge/put_charges_responses.go b/api/ops/ops_client/charge/put_charges_responses.go index 3116236..cb5063b 100644 --- a/api/ops/ops_client/charge/put_charges_responses.go +++ b/api/ops/ops_client/charge/put_charges_responses.go @@ -63,9 +63,8 @@ func (o *PutChargesReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutChargesOK() *PutChargesOK { return &PutChargesOK{} } -/*PutChargesOK handles this case with default header values. +/* PutChargesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Message objects in response to a PUT */ @@ -87,15 +86,18 @@ type PutChargesOK struct { func (o *PutChargesOK) Error() string { return fmt.Sprintf("[PUT /charges][%d] putChargesOK %+v", 200, o.Payload) } - func (o *PutChargesOK) GetPayload() *ops_models.PutResponse { return o.Payload } func (o *PutChargesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.PutResponse) @@ -112,7 +114,7 @@ func NewPutChargesUnauthorized() *PutChargesUnauthorized { return &PutChargesUnauthorized{} } -/*PutChargesUnauthorized handles this case with default header values. +/* PutChargesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PutChargesUnauthorized struct { func (o *PutChargesUnauthorized) Error() string { return fmt.Sprintf("[PUT /charges][%d] putChargesUnauthorized %+v", 401, o.Payload) } - func (o *PutChargesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutChargesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewPutChargesForbidden() *PutChargesForbidden { return &PutChargesForbidden{} } -/*PutChargesForbidden handles this case with default header values. +/* PutChargesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PutChargesForbidden struct { func (o *PutChargesForbidden) Error() string { return fmt.Sprintf("[PUT /charges][%d] putChargesForbidden %+v", 403, o.Payload) } - func (o *PutChargesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutChargesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewPutChargesNotFound() *PutChargesNotFound { return &PutChargesNotFound{} } -/*PutChargesNotFound handles this case with default header values. +/* PutChargesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PutChargesNotFound struct { func (o *PutChargesNotFound) Error() string { return fmt.Sprintf("[PUT /charges][%d] putChargesNotFound %+v", 404, o.Payload) } - func (o *PutChargesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutChargesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewPutChargesUnprocessableEntity() *PutChargesUnprocessableEntity { return &PutChargesUnprocessableEntity{} } -/*PutChargesUnprocessableEntity handles this case with default header values. +/* PutChargesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PutChargesUnprocessableEntity struct { func (o *PutChargesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /charges][%d] putChargesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutChargesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutChargesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewPutChargesInternalServerError() *PutChargesInternalServerError { return &PutChargesInternalServerError{} } -/*PutChargesInternalServerError handles this case with default header values. +/* PutChargesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PutChargesInternalServerError struct { func (o *PutChargesInternalServerError) Error() string { return fmt.Sprintf("[PUT /charges][%d] putChargesInternalServerError %+v", 500, o.Payload) } - func (o *PutChargesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutChargesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/cors/cash_receipt_options_parameters.go b/api/ops/ops_client/cors/cash_receipt_options_parameters.go index 484c509..8ed36f6 100644 --- a/api/ops/ops_client/cors/cash_receipt_options_parameters.go +++ b/api/ops/ops_client/cors/cash_receipt_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewCashReceiptOptionsParams creates a new CashReceiptOptionsParams object -// with the default values initialized. +// NewCashReceiptOptionsParams creates a new CashReceiptOptionsParams 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 NewCashReceiptOptionsParams() *CashReceiptOptionsParams { - return &CashReceiptOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewCashReceiptOptionsParamsWithTimeout creates a new CashReceiptOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewCashReceiptOptionsParamsWithTimeout(timeout time.Duration) *CashReceiptOptionsParams { - return &CashReceiptOptionsParams{ - timeout: timeout, } } // NewCashReceiptOptionsParamsWithContext creates a new CashReceiptOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewCashReceiptOptionsParamsWithContext(ctx context.Context) *CashReceiptOptionsParams { - return &CashReceiptOptionsParams{ - Context: ctx, } } // NewCashReceiptOptionsParamsWithHTTPClient creates a new CashReceiptOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewCashReceiptOptionsParamsWithHTTPClient(client *http.Client) *CashReceiptOptionsParams { - return &CashReceiptOptionsParams{ HTTPClient: client, } } -/*CashReceiptOptionsParams contains all the parameters to send to the API endpoint -for the cash receipt options operation typically these are written to a http.Request +/* CashReceiptOptionsParams contains all the parameters to send to the API endpoint + for the cash receipt options operation. + + Typically these are written to a http.Request. */ type CashReceiptOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type CashReceiptOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the cash receipt options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CashReceiptOptionsParams) WithDefaults() *CashReceiptOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the cash receipt options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CashReceiptOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the cash receipt options params func (o *CashReceiptOptionsParams) WithTimeout(timeout time.Duration) *CashReceiptOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/cash_receipt_options_responses.go b/api/ops/ops_client/cors/cash_receipt_options_responses.go index 73b61f4..8e33f87 100644 --- a/api/ops/ops_client/cors/cash_receipt_options_responses.go +++ b/api/ops/ops_client/cors/cash_receipt_options_responses.go @@ -30,9 +30,8 @@ func (o *CashReceiptOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewCashReceiptOptionsOK() *CashReceiptOptionsOK { return &CashReceiptOptionsOK{} } -/*CashReceiptOptionsOK handles this case with default header values. +/* CashReceiptOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type CashReceiptOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *CashReceiptOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *CashReceiptOptionsOK) Error() string { func (o *CashReceiptOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/charge_options_parameters.go b/api/ops/ops_client/cors/charge_options_parameters.go index 80b1ad7..ecb2289 100644 --- a/api/ops/ops_client/cors/charge_options_parameters.go +++ b/api/ops/ops_client/cors/charge_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewChargeOptionsParams creates a new ChargeOptionsParams object -// with the default values initialized. +// NewChargeOptionsParams creates a new ChargeOptionsParams 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 NewChargeOptionsParams() *ChargeOptionsParams { - return &ChargeOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewChargeOptionsParamsWithTimeout creates a new ChargeOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewChargeOptionsParamsWithTimeout(timeout time.Duration) *ChargeOptionsParams { - return &ChargeOptionsParams{ - timeout: timeout, } } // NewChargeOptionsParamsWithContext creates a new ChargeOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewChargeOptionsParamsWithContext(ctx context.Context) *ChargeOptionsParams { - return &ChargeOptionsParams{ - Context: ctx, } } // NewChargeOptionsParamsWithHTTPClient creates a new ChargeOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewChargeOptionsParamsWithHTTPClient(client *http.Client) *ChargeOptionsParams { - return &ChargeOptionsParams{ HTTPClient: client, } } -/*ChargeOptionsParams contains all the parameters to send to the API endpoint -for the charge options operation typically these are written to a http.Request +/* ChargeOptionsParams contains all the parameters to send to the API endpoint + for the charge options operation. + + Typically these are written to a http.Request. */ type ChargeOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ChargeOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the charge options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ChargeOptionsParams) WithDefaults() *ChargeOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the charge options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ChargeOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the charge options params func (o *ChargeOptionsParams) WithTimeout(timeout time.Duration) *ChargeOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/charge_options_responses.go b/api/ops/ops_client/cors/charge_options_responses.go index a3936a6..aa66a8e 100644 --- a/api/ops/ops_client/cors/charge_options_responses.go +++ b/api/ops/ops_client/cors/charge_options_responses.go @@ -30,9 +30,8 @@ func (o *ChargeOptionsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewChargeOptionsOK() *ChargeOptionsOK { return &ChargeOptionsOK{} } -/*ChargeOptionsOK handles this case with default header values. +/* ChargeOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ChargeOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ChargeOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *ChargeOptionsOK) Error() string { func (o *ChargeOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/cors_client.go b/api/ops/ops_client/cors/cors_client.go index 6a2dfb3..2f76389 100644 --- a/api/ops/ops_client/cors/cors_client.go +++ b/api/ops/ops_client/cors/cors_client.go @@ -29,35 +29,38 @@ type Client struct { 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 { - CashReceiptOptions(params *CashReceiptOptionsParams) (*CashReceiptOptionsOK, error) + CashReceiptOptions(params *CashReceiptOptionsParams, opts ...ClientOption) (*CashReceiptOptionsOK, error) - ChargeOptions(params *ChargeOptionsParams) (*ChargeOptionsOK, error) + ChargeOptions(params *ChargeOptionsParams, opts ...ClientOption) (*ChargeOptionsOK, error) - EftOptions(params *EftOptionsParams) (*EftOptionsOK, error) + EftOptions(params *EftOptionsParams, opts ...ClientOption) (*EftOptionsOK, error) - InvoiceOptions(params *InvoiceOptionsParams) (*InvoiceOptionsOK, error) + InvoiceOptions(params *InvoiceOptionsParams, opts ...ClientOption) (*InvoiceOptionsOK, error) - OrdersOptions(params *OrdersOptionsParams) (*OrdersOptionsOK, error) + OrdersOptions(params *OrdersOptionsParams, opts ...ClientOption) (*OrdersOptionsOK, error) - PaymentMethodOptions(params *PaymentMethodOptionsParams) (*PaymentMethodOptionsOK, error) + PaymentMethodOptions(params *PaymentMethodOptionsParams, opts ...ClientOption) (*PaymentMethodOptionsOK, error) - PoOptions(params *PoOptionsParams) (*PoOptionsOK, error) + PoOptions(params *PoOptionsParams, opts ...ClientOption) (*PoOptionsOK, error) - ProductOptions(params *ProductOptionsParams) (*ProductOptionsOK, error) + ProductOptions(params *ProductOptionsParams, opts ...ClientOption) (*ProductOptionsOK, error) - ProductOptionsObservable(params *ProductOptionsObservableParams) (*ProductOptionsObservableOK, error) + ProductOptionsObservable(params *ProductOptionsObservableParams, opts ...ClientOption) (*ProductOptionsObservableOK, error) - QuoteOptions(params *QuoteOptionsParams) (*QuoteOptionsOK, error) + QuoteOptions(params *QuoteOptionsParams, opts ...ClientOption) (*QuoteOptionsOK, error) - TaxInvoiceOptions(params *TaxInvoiceOptionsParams) (*TaxInvoiceOptionsOK, error) + TaxInvoiceOptions(params *TaxInvoiceOptionsParams, opts ...ClientOption) (*TaxInvoiceOptionsOK, error) - TaxOrderOptions(params *TaxOrderOptionsParams) (*TaxOrderOptionsOK, error) + TaxOrderOptions(params *TaxOrderOptionsParams, opts ...ClientOption) (*TaxOrderOptionsOK, error) - TaxPoOptions(params *TaxPoOptionsParams) (*TaxPoOptionsOK, error) + TaxPoOptions(params *TaxPoOptionsParams, opts ...ClientOption) (*TaxPoOptionsOK, error) - TaxQuoteOptions(params *TaxQuoteOptionsParams) (*TaxQuoteOptionsOK, error) + TaxQuoteOptions(params *TaxQuoteOptionsParams, opts ...ClientOption) (*TaxQuoteOptionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -65,13 +68,12 @@ type ClientService interface { /* CashReceiptOptions CORS support */ -func (a *Client) CashReceiptOptions(params *CashReceiptOptionsParams) (*CashReceiptOptionsOK, error) { +func (a *Client) CashReceiptOptions(params *CashReceiptOptionsParams, opts ...ClientOption) (*CashReceiptOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewCashReceiptOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "cashReceiptOptions", Method: "OPTIONS", PathPattern: "/cashreceipts", @@ -82,7 +84,12 @@ func (a *Client) CashReceiptOptions(params *CashReceiptOptionsParams) (*CashRece Reader: &CashReceiptOptionsReader{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 } @@ -99,13 +106,12 @@ func (a *Client) CashReceiptOptions(params *CashReceiptOptionsParams) (*CashRece /* ChargeOptions CORS support */ -func (a *Client) ChargeOptions(params *ChargeOptionsParams) (*ChargeOptionsOK, error) { +func (a *Client) ChargeOptions(params *ChargeOptionsParams, opts ...ClientOption) (*ChargeOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewChargeOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "chargeOptions", Method: "OPTIONS", PathPattern: "/charges", @@ -116,7 +122,12 @@ func (a *Client) ChargeOptions(params *ChargeOptionsParams) (*ChargeOptionsOK, e Reader: &ChargeOptionsReader{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 } @@ -133,13 +144,12 @@ func (a *Client) ChargeOptions(params *ChargeOptionsParams) (*ChargeOptionsOK, e /* EftOptions CORS support */ -func (a *Client) EftOptions(params *EftOptionsParams) (*EftOptionsOK, error) { +func (a *Client) EftOptions(params *EftOptionsParams, opts ...ClientOption) (*EftOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewEftOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "eftOptions", Method: "OPTIONS", PathPattern: "/efts", @@ -150,7 +160,12 @@ func (a *Client) EftOptions(params *EftOptionsParams) (*EftOptionsOK, error) { Reader: &EftOptionsReader{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 } @@ -167,13 +182,12 @@ func (a *Client) EftOptions(params *EftOptionsParams) (*EftOptionsOK, error) { /* InvoiceOptions CORS support */ -func (a *Client) InvoiceOptions(params *InvoiceOptionsParams) (*InvoiceOptionsOK, error) { +func (a *Client) InvoiceOptions(params *InvoiceOptionsParams, opts ...ClientOption) (*InvoiceOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewInvoiceOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "invoiceOptions", Method: "OPTIONS", PathPattern: "/invoices", @@ -184,7 +198,12 @@ func (a *Client) InvoiceOptions(params *InvoiceOptionsParams) (*InvoiceOptionsOK Reader: &InvoiceOptionsReader{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 } @@ -201,13 +220,12 @@ func (a *Client) InvoiceOptions(params *InvoiceOptionsParams) (*InvoiceOptionsOK /* OrdersOptions CORS support */ -func (a *Client) OrdersOptions(params *OrdersOptionsParams) (*OrdersOptionsOK, error) { +func (a *Client) OrdersOptions(params *OrdersOptionsParams, opts ...ClientOption) (*OrdersOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOrdersOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "ordersOptions", Method: "OPTIONS", PathPattern: "/orders", @@ -218,7 +236,12 @@ func (a *Client) OrdersOptions(params *OrdersOptionsParams) (*OrdersOptionsOK, e Reader: &OrdersOptionsReader{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 } @@ -235,13 +258,12 @@ func (a *Client) OrdersOptions(params *OrdersOptionsParams) (*OrdersOptionsOK, e /* PaymentMethodOptions CORS support */ -func (a *Client) PaymentMethodOptions(params *PaymentMethodOptionsParams) (*PaymentMethodOptionsOK, error) { +func (a *Client) PaymentMethodOptions(params *PaymentMethodOptionsParams, opts ...ClientOption) (*PaymentMethodOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPaymentMethodOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "paymentMethodOptions", Method: "OPTIONS", PathPattern: "/paymentmethods", @@ -252,7 +274,12 @@ func (a *Client) PaymentMethodOptions(params *PaymentMethodOptionsParams) (*Paym Reader: &PaymentMethodOptionsReader{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 } @@ -269,13 +296,12 @@ func (a *Client) PaymentMethodOptions(params *PaymentMethodOptionsParams) (*Paym /* PoOptions CORS support */ -func (a *Client) PoOptions(params *PoOptionsParams) (*PoOptionsOK, error) { +func (a *Client) PoOptions(params *PoOptionsParams, opts ...ClientOption) (*PoOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPoOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "poOptions", Method: "OPTIONS", PathPattern: "/pos", @@ -286,7 +312,12 @@ func (a *Client) PoOptions(params *PoOptionsParams) (*PoOptionsOK, error) { Reader: &PoOptionsReader{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 } @@ -303,13 +334,12 @@ func (a *Client) PoOptions(params *PoOptionsParams) (*PoOptionsOK, error) { /* ProductOptions CORS support */ -func (a *Client) ProductOptions(params *ProductOptionsParams) (*ProductOptionsOK, error) { +func (a *Client) ProductOptions(params *ProductOptionsParams, opts ...ClientOption) (*ProductOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewProductOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "productOptions", Method: "OPTIONS", PathPattern: "/products", @@ -320,7 +350,12 @@ func (a *Client) ProductOptions(params *ProductOptionsParams) (*ProductOptionsOK Reader: &ProductOptionsReader{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 } @@ -337,13 +372,12 @@ func (a *Client) ProductOptions(params *ProductOptionsParams) (*ProductOptionsOK /* ProductOptionsObservable CORS support */ -func (a *Client) ProductOptionsObservable(params *ProductOptionsObservableParams) (*ProductOptionsObservableOK, error) { +func (a *Client) ProductOptionsObservable(params *ProductOptionsObservableParams, opts ...ClientOption) (*ProductOptionsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewProductOptionsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "productOptionsObservable", Method: "OPTIONS", PathPattern: "/products/observable", @@ -354,7 +388,12 @@ func (a *Client) ProductOptionsObservable(params *ProductOptionsObservableParams Reader: &ProductOptionsObservableReader{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 } @@ -371,13 +410,12 @@ func (a *Client) ProductOptionsObservable(params *ProductOptionsObservableParams /* QuoteOptions CORS support */ -func (a *Client) QuoteOptions(params *QuoteOptionsParams) (*QuoteOptionsOK, error) { +func (a *Client) QuoteOptions(params *QuoteOptionsParams, opts ...ClientOption) (*QuoteOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewQuoteOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "quoteOptions", Method: "OPTIONS", PathPattern: "/quotes", @@ -388,7 +426,12 @@ func (a *Client) QuoteOptions(params *QuoteOptionsParams) (*QuoteOptionsOK, erro Reader: &QuoteOptionsReader{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 } @@ -405,13 +448,12 @@ func (a *Client) QuoteOptions(params *QuoteOptionsParams) (*QuoteOptionsOK, erro /* TaxInvoiceOptions CORS support */ -func (a *Client) TaxInvoiceOptions(params *TaxInvoiceOptionsParams) (*TaxInvoiceOptionsOK, error) { +func (a *Client) TaxInvoiceOptions(params *TaxInvoiceOptionsParams, opts ...ClientOption) (*TaxInvoiceOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTaxInvoiceOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "taxInvoiceOptions", Method: "OPTIONS", PathPattern: "/taxes/invoices", @@ -422,7 +464,12 @@ func (a *Client) TaxInvoiceOptions(params *TaxInvoiceOptionsParams) (*TaxInvoice Reader: &TaxInvoiceOptionsReader{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 } @@ -439,13 +486,12 @@ func (a *Client) TaxInvoiceOptions(params *TaxInvoiceOptionsParams) (*TaxInvoice /* TaxOrderOptions CORS support */ -func (a *Client) TaxOrderOptions(params *TaxOrderOptionsParams) (*TaxOrderOptionsOK, error) { +func (a *Client) TaxOrderOptions(params *TaxOrderOptionsParams, opts ...ClientOption) (*TaxOrderOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTaxOrderOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "taxOrderOptions", Method: "OPTIONS", PathPattern: "/taxes/orders", @@ -456,7 +502,12 @@ func (a *Client) TaxOrderOptions(params *TaxOrderOptionsParams) (*TaxOrderOption Reader: &TaxOrderOptionsReader{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 } @@ -473,13 +524,12 @@ func (a *Client) TaxOrderOptions(params *TaxOrderOptionsParams) (*TaxOrderOption /* TaxPoOptions CORS support */ -func (a *Client) TaxPoOptions(params *TaxPoOptionsParams) (*TaxPoOptionsOK, error) { +func (a *Client) TaxPoOptions(params *TaxPoOptionsParams, opts ...ClientOption) (*TaxPoOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTaxPoOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "taxPoOptions", Method: "OPTIONS", PathPattern: "/taxes/pos", @@ -490,7 +540,12 @@ func (a *Client) TaxPoOptions(params *TaxPoOptionsParams) (*TaxPoOptionsOK, erro Reader: &TaxPoOptionsReader{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 } @@ -507,13 +562,12 @@ func (a *Client) TaxPoOptions(params *TaxPoOptionsParams) (*TaxPoOptionsOK, erro /* TaxQuoteOptions CORS support */ -func (a *Client) TaxQuoteOptions(params *TaxQuoteOptionsParams) (*TaxQuoteOptionsOK, error) { +func (a *Client) TaxQuoteOptions(params *TaxQuoteOptionsParams, opts ...ClientOption) (*TaxQuoteOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTaxQuoteOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "taxQuoteOptions", Method: "OPTIONS", PathPattern: "/taxes/quotes", @@ -524,7 +578,12 @@ func (a *Client) TaxQuoteOptions(params *TaxQuoteOptionsParams) (*TaxQuoteOption Reader: &TaxQuoteOptionsReader{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 } diff --git a/api/ops/ops_client/cors/eft_options_parameters.go b/api/ops/ops_client/cors/eft_options_parameters.go index c8df362..aeb7ec0 100644 --- a/api/ops/ops_client/cors/eft_options_parameters.go +++ b/api/ops/ops_client/cors/eft_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewEftOptionsParams creates a new EftOptionsParams object -// with the default values initialized. +// NewEftOptionsParams creates a new EftOptionsParams 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 NewEftOptionsParams() *EftOptionsParams { - return &EftOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewEftOptionsParamsWithTimeout creates a new EftOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewEftOptionsParamsWithTimeout(timeout time.Duration) *EftOptionsParams { - return &EftOptionsParams{ - timeout: timeout, } } // NewEftOptionsParamsWithContext creates a new EftOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewEftOptionsParamsWithContext(ctx context.Context) *EftOptionsParams { - return &EftOptionsParams{ - Context: ctx, } } // NewEftOptionsParamsWithHTTPClient creates a new EftOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewEftOptionsParamsWithHTTPClient(client *http.Client) *EftOptionsParams { - return &EftOptionsParams{ HTTPClient: client, } } -/*EftOptionsParams contains all the parameters to send to the API endpoint -for the eft options operation typically these are written to a http.Request +/* EftOptionsParams contains all the parameters to send to the API endpoint + for the eft options operation. + + Typically these are written to a http.Request. */ type EftOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type EftOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the eft options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EftOptionsParams) WithDefaults() *EftOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the eft options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EftOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the eft options params func (o *EftOptionsParams) WithTimeout(timeout time.Duration) *EftOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/eft_options_responses.go b/api/ops/ops_client/cors/eft_options_responses.go index 19bd459..9ce9f07 100644 --- a/api/ops/ops_client/cors/eft_options_responses.go +++ b/api/ops/ops_client/cors/eft_options_responses.go @@ -30,9 +30,8 @@ func (o *EftOptionsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewEftOptionsOK() *EftOptionsOK { return &EftOptionsOK{} } -/*EftOptionsOK handles this case with default header values. +/* EftOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type EftOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *EftOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *EftOptionsOK) Error() string { func (o *EftOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/invoice_options_parameters.go b/api/ops/ops_client/cors/invoice_options_parameters.go index 0a9d5d4..776165d 100644 --- a/api/ops/ops_client/cors/invoice_options_parameters.go +++ b/api/ops/ops_client/cors/invoice_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewInvoiceOptionsParams creates a new InvoiceOptionsParams object -// with the default values initialized. +// NewInvoiceOptionsParams creates a new InvoiceOptionsParams 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 NewInvoiceOptionsParams() *InvoiceOptionsParams { - return &InvoiceOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewInvoiceOptionsParamsWithTimeout creates a new InvoiceOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewInvoiceOptionsParamsWithTimeout(timeout time.Duration) *InvoiceOptionsParams { - return &InvoiceOptionsParams{ - timeout: timeout, } } // NewInvoiceOptionsParamsWithContext creates a new InvoiceOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewInvoiceOptionsParamsWithContext(ctx context.Context) *InvoiceOptionsParams { - return &InvoiceOptionsParams{ - Context: ctx, } } // NewInvoiceOptionsParamsWithHTTPClient creates a new InvoiceOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewInvoiceOptionsParamsWithHTTPClient(client *http.Client) *InvoiceOptionsParams { - return &InvoiceOptionsParams{ HTTPClient: client, } } -/*InvoiceOptionsParams contains all the parameters to send to the API endpoint -for the invoice options operation typically these are written to a http.Request +/* InvoiceOptionsParams contains all the parameters to send to the API endpoint + for the invoice options operation. + + Typically these are written to a http.Request. */ type InvoiceOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type InvoiceOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the invoice options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InvoiceOptionsParams) WithDefaults() *InvoiceOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the invoice options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InvoiceOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the invoice options params func (o *InvoiceOptionsParams) WithTimeout(timeout time.Duration) *InvoiceOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/invoice_options_responses.go b/api/ops/ops_client/cors/invoice_options_responses.go index aa2fd5b..d6c7bf4 100644 --- a/api/ops/ops_client/cors/invoice_options_responses.go +++ b/api/ops/ops_client/cors/invoice_options_responses.go @@ -30,9 +30,8 @@ func (o *InvoiceOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewInvoiceOptionsOK() *InvoiceOptionsOK { return &InvoiceOptionsOK{} } -/*InvoiceOptionsOK handles this case with default header values. +/* InvoiceOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type InvoiceOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *InvoiceOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *InvoiceOptionsOK) Error() string { func (o *InvoiceOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/orders_options_parameters.go b/api/ops/ops_client/cors/orders_options_parameters.go index 04f1ea9..1500451 100644 --- a/api/ops/ops_client/cors/orders_options_parameters.go +++ b/api/ops/ops_client/cors/orders_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewOrdersOptionsParams creates a new OrdersOptionsParams object -// with the default values initialized. +// NewOrdersOptionsParams creates a new OrdersOptionsParams 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 NewOrdersOptionsParams() *OrdersOptionsParams { - return &OrdersOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewOrdersOptionsParamsWithTimeout creates a new OrdersOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOrdersOptionsParamsWithTimeout(timeout time.Duration) *OrdersOptionsParams { - return &OrdersOptionsParams{ - timeout: timeout, } } // NewOrdersOptionsParamsWithContext creates a new OrdersOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOrdersOptionsParamsWithContext(ctx context.Context) *OrdersOptionsParams { - return &OrdersOptionsParams{ - Context: ctx, } } // NewOrdersOptionsParamsWithHTTPClient creates a new OrdersOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOrdersOptionsParamsWithHTTPClient(client *http.Client) *OrdersOptionsParams { - return &OrdersOptionsParams{ HTTPClient: client, } } -/*OrdersOptionsParams contains all the parameters to send to the API endpoint -for the orders options operation typically these are written to a http.Request +/* OrdersOptionsParams contains all the parameters to send to the API endpoint + for the orders options operation. + + Typically these are written to a http.Request. */ type OrdersOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type OrdersOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the orders options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OrdersOptionsParams) WithDefaults() *OrdersOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the orders options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OrdersOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the orders options params func (o *OrdersOptionsParams) WithTimeout(timeout time.Duration) *OrdersOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/orders_options_responses.go b/api/ops/ops_client/cors/orders_options_responses.go index 9f22ac9..1a290d3 100644 --- a/api/ops/ops_client/cors/orders_options_responses.go +++ b/api/ops/ops_client/cors/orders_options_responses.go @@ -30,9 +30,8 @@ func (o *OrdersOptionsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewOrdersOptionsOK() *OrdersOptionsOK { return &OrdersOptionsOK{} } -/*OrdersOptionsOK handles this case with default header values. +/* OrdersOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type OrdersOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *OrdersOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *OrdersOptionsOK) Error() string { func (o *OrdersOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/payment_method_options_parameters.go b/api/ops/ops_client/cors/payment_method_options_parameters.go index f5c1414..5d8327c 100644 --- a/api/ops/ops_client/cors/payment_method_options_parameters.go +++ b/api/ops/ops_client/cors/payment_method_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewPaymentMethodOptionsParams creates a new PaymentMethodOptionsParams object -// with the default values initialized. +// NewPaymentMethodOptionsParams creates a new PaymentMethodOptionsParams 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 NewPaymentMethodOptionsParams() *PaymentMethodOptionsParams { - return &PaymentMethodOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewPaymentMethodOptionsParamsWithTimeout creates a new PaymentMethodOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPaymentMethodOptionsParamsWithTimeout(timeout time.Duration) *PaymentMethodOptionsParams { - return &PaymentMethodOptionsParams{ - timeout: timeout, } } // NewPaymentMethodOptionsParamsWithContext creates a new PaymentMethodOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPaymentMethodOptionsParamsWithContext(ctx context.Context) *PaymentMethodOptionsParams { - return &PaymentMethodOptionsParams{ - Context: ctx, } } // NewPaymentMethodOptionsParamsWithHTTPClient creates a new PaymentMethodOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPaymentMethodOptionsParamsWithHTTPClient(client *http.Client) *PaymentMethodOptionsParams { - return &PaymentMethodOptionsParams{ HTTPClient: client, } } -/*PaymentMethodOptionsParams contains all the parameters to send to the API endpoint -for the payment method options operation typically these are written to a http.Request +/* PaymentMethodOptionsParams contains all the parameters to send to the API endpoint + for the payment method options operation. + + Typically these are written to a http.Request. */ type PaymentMethodOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type PaymentMethodOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the payment method options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PaymentMethodOptionsParams) WithDefaults() *PaymentMethodOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the payment method options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PaymentMethodOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the payment method options params func (o *PaymentMethodOptionsParams) WithTimeout(timeout time.Duration) *PaymentMethodOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/payment_method_options_responses.go b/api/ops/ops_client/cors/payment_method_options_responses.go index abacb25..2b19cc2 100644 --- a/api/ops/ops_client/cors/payment_method_options_responses.go +++ b/api/ops/ops_client/cors/payment_method_options_responses.go @@ -30,9 +30,8 @@ func (o *PaymentMethodOptionsReader) ReadResponse(response runtime.ClientRespons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewPaymentMethodOptionsOK() *PaymentMethodOptionsOK { return &PaymentMethodOptionsOK{} } -/*PaymentMethodOptionsOK handles this case with default header values. +/* PaymentMethodOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type PaymentMethodOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *PaymentMethodOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *PaymentMethodOptionsOK) Error() string { func (o *PaymentMethodOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/po_options_parameters.go b/api/ops/ops_client/cors/po_options_parameters.go index 82bd806..a4491d6 100644 --- a/api/ops/ops_client/cors/po_options_parameters.go +++ b/api/ops/ops_client/cors/po_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewPoOptionsParams creates a new PoOptionsParams object -// with the default values initialized. +// NewPoOptionsParams creates a new PoOptionsParams 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 NewPoOptionsParams() *PoOptionsParams { - return &PoOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewPoOptionsParamsWithTimeout creates a new PoOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPoOptionsParamsWithTimeout(timeout time.Duration) *PoOptionsParams { - return &PoOptionsParams{ - timeout: timeout, } } // NewPoOptionsParamsWithContext creates a new PoOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPoOptionsParamsWithContext(ctx context.Context) *PoOptionsParams { - return &PoOptionsParams{ - Context: ctx, } } // NewPoOptionsParamsWithHTTPClient creates a new PoOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPoOptionsParamsWithHTTPClient(client *http.Client) *PoOptionsParams { - return &PoOptionsParams{ HTTPClient: client, } } -/*PoOptionsParams contains all the parameters to send to the API endpoint -for the po options operation typically these are written to a http.Request +/* PoOptionsParams contains all the parameters to send to the API endpoint + for the po options operation. + + Typically these are written to a http.Request. */ type PoOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type PoOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the po options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoOptionsParams) WithDefaults() *PoOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the po options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the po options params func (o *PoOptionsParams) WithTimeout(timeout time.Duration) *PoOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/po_options_responses.go b/api/ops/ops_client/cors/po_options_responses.go index 9583184..33b1f23 100644 --- a/api/ops/ops_client/cors/po_options_responses.go +++ b/api/ops/ops_client/cors/po_options_responses.go @@ -30,9 +30,8 @@ func (o *PoOptionsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewPoOptionsOK() *PoOptionsOK { return &PoOptionsOK{} } -/*PoOptionsOK handles this case with default header values. +/* PoOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type PoOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *PoOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *PoOptionsOK) Error() string { func (o *PoOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/product_options_observable_parameters.go b/api/ops/ops_client/cors/product_options_observable_parameters.go index b1a9cdc..5d7f572 100644 --- a/api/ops/ops_client/cors/product_options_observable_parameters.go +++ b/api/ops/ops_client/cors/product_options_observable_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewProductOptionsObservableParams creates a new ProductOptionsObservableParams object -// with the default values initialized. +// NewProductOptionsObservableParams creates a new ProductOptionsObservableParams 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 NewProductOptionsObservableParams() *ProductOptionsObservableParams { - return &ProductOptionsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewProductOptionsObservableParamsWithTimeout creates a new ProductOptionsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewProductOptionsObservableParamsWithTimeout(timeout time.Duration) *ProductOptionsObservableParams { - return &ProductOptionsObservableParams{ - timeout: timeout, } } // NewProductOptionsObservableParamsWithContext creates a new ProductOptionsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewProductOptionsObservableParamsWithContext(ctx context.Context) *ProductOptionsObservableParams { - return &ProductOptionsObservableParams{ - Context: ctx, } } // NewProductOptionsObservableParamsWithHTTPClient creates a new ProductOptionsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewProductOptionsObservableParamsWithHTTPClient(client *http.Client) *ProductOptionsObservableParams { - return &ProductOptionsObservableParams{ HTTPClient: client, } } -/*ProductOptionsObservableParams contains all the parameters to send to the API endpoint -for the product options observable operation typically these are written to a http.Request +/* ProductOptionsObservableParams contains all the parameters to send to the API endpoint + for the product options observable operation. + + Typically these are written to a http.Request. */ type ProductOptionsObservableParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ProductOptionsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the product options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ProductOptionsObservableParams) WithDefaults() *ProductOptionsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the product options observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ProductOptionsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the product options observable params func (o *ProductOptionsObservableParams) WithTimeout(timeout time.Duration) *ProductOptionsObservableParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/product_options_observable_responses.go b/api/ops/ops_client/cors/product_options_observable_responses.go index a17415c..20f23ff 100644 --- a/api/ops/ops_client/cors/product_options_observable_responses.go +++ b/api/ops/ops_client/cors/product_options_observable_responses.go @@ -30,9 +30,8 @@ func (o *ProductOptionsObservableReader) ReadResponse(response runtime.ClientRes return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewProductOptionsObservableOK() *ProductOptionsObservableOK { return &ProductOptionsObservableOK{} } -/*ProductOptionsObservableOK handles this case with default header values. +/* ProductOptionsObservableOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ProductOptionsObservableOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ProductOptionsObservableOK) Error() string { @@ -67,26 +60,54 @@ func (o *ProductOptionsObservableOK) Error() string { func (o *ProductOptionsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/product_options_parameters.go b/api/ops/ops_client/cors/product_options_parameters.go index a2b252c..de2f547 100644 --- a/api/ops/ops_client/cors/product_options_parameters.go +++ b/api/ops/ops_client/cors/product_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewProductOptionsParams creates a new ProductOptionsParams object -// with the default values initialized. +// NewProductOptionsParams creates a new ProductOptionsParams 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 NewProductOptionsParams() *ProductOptionsParams { - return &ProductOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewProductOptionsParamsWithTimeout creates a new ProductOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewProductOptionsParamsWithTimeout(timeout time.Duration) *ProductOptionsParams { - return &ProductOptionsParams{ - timeout: timeout, } } // NewProductOptionsParamsWithContext creates a new ProductOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewProductOptionsParamsWithContext(ctx context.Context) *ProductOptionsParams { - return &ProductOptionsParams{ - Context: ctx, } } // NewProductOptionsParamsWithHTTPClient creates a new ProductOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewProductOptionsParamsWithHTTPClient(client *http.Client) *ProductOptionsParams { - return &ProductOptionsParams{ HTTPClient: client, } } -/*ProductOptionsParams contains all the parameters to send to the API endpoint -for the product options operation typically these are written to a http.Request +/* ProductOptionsParams contains all the parameters to send to the API endpoint + for the product options operation. + + Typically these are written to a http.Request. */ type ProductOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type ProductOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the product options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ProductOptionsParams) WithDefaults() *ProductOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the product options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ProductOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the product options params func (o *ProductOptionsParams) WithTimeout(timeout time.Duration) *ProductOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/product_options_responses.go b/api/ops/ops_client/cors/product_options_responses.go index dda308e..e3ade13 100644 --- a/api/ops/ops_client/cors/product_options_responses.go +++ b/api/ops/ops_client/cors/product_options_responses.go @@ -30,9 +30,8 @@ func (o *ProductOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewProductOptionsOK() *ProductOptionsOK { return &ProductOptionsOK{} } -/*ProductOptionsOK handles this case with default header values. +/* ProductOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type ProductOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *ProductOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *ProductOptionsOK) Error() string { func (o *ProductOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/quote_options_parameters.go b/api/ops/ops_client/cors/quote_options_parameters.go index 635a599..6a377f1 100644 --- a/api/ops/ops_client/cors/quote_options_parameters.go +++ b/api/ops/ops_client/cors/quote_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewQuoteOptionsParams creates a new QuoteOptionsParams object -// with the default values initialized. +// NewQuoteOptionsParams creates a new QuoteOptionsParams 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 NewQuoteOptionsParams() *QuoteOptionsParams { - return &QuoteOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewQuoteOptionsParamsWithTimeout creates a new QuoteOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewQuoteOptionsParamsWithTimeout(timeout time.Duration) *QuoteOptionsParams { - return &QuoteOptionsParams{ - timeout: timeout, } } // NewQuoteOptionsParamsWithContext creates a new QuoteOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewQuoteOptionsParamsWithContext(ctx context.Context) *QuoteOptionsParams { - return &QuoteOptionsParams{ - Context: ctx, } } // NewQuoteOptionsParamsWithHTTPClient creates a new QuoteOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewQuoteOptionsParamsWithHTTPClient(client *http.Client) *QuoteOptionsParams { - return &QuoteOptionsParams{ HTTPClient: client, } } -/*QuoteOptionsParams contains all the parameters to send to the API endpoint -for the quote options operation typically these are written to a http.Request +/* QuoteOptionsParams contains all the parameters to send to the API endpoint + for the quote options operation. + + Typically these are written to a http.Request. */ type QuoteOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type QuoteOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the quote options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *QuoteOptionsParams) WithDefaults() *QuoteOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the quote options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *QuoteOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the quote options params func (o *QuoteOptionsParams) WithTimeout(timeout time.Duration) *QuoteOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/quote_options_responses.go b/api/ops/ops_client/cors/quote_options_responses.go index 6ed3f7d..e33eebe 100644 --- a/api/ops/ops_client/cors/quote_options_responses.go +++ b/api/ops/ops_client/cors/quote_options_responses.go @@ -30,9 +30,8 @@ func (o *QuoteOptionsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewQuoteOptionsOK() *QuoteOptionsOK { return &QuoteOptionsOK{} } -/*QuoteOptionsOK handles this case with default header values. +/* QuoteOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type QuoteOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *QuoteOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *QuoteOptionsOK) Error() string { func (o *QuoteOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/tax_invoice_options_parameters.go b/api/ops/ops_client/cors/tax_invoice_options_parameters.go index 0019af5..98257fd 100644 --- a/api/ops/ops_client/cors/tax_invoice_options_parameters.go +++ b/api/ops/ops_client/cors/tax_invoice_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTaxInvoiceOptionsParams creates a new TaxInvoiceOptionsParams object -// with the default values initialized. +// NewTaxInvoiceOptionsParams creates a new TaxInvoiceOptionsParams 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 NewTaxInvoiceOptionsParams() *TaxInvoiceOptionsParams { - return &TaxInvoiceOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTaxInvoiceOptionsParamsWithTimeout creates a new TaxInvoiceOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTaxInvoiceOptionsParamsWithTimeout(timeout time.Duration) *TaxInvoiceOptionsParams { - return &TaxInvoiceOptionsParams{ - timeout: timeout, } } // NewTaxInvoiceOptionsParamsWithContext creates a new TaxInvoiceOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTaxInvoiceOptionsParamsWithContext(ctx context.Context) *TaxInvoiceOptionsParams { - return &TaxInvoiceOptionsParams{ - Context: ctx, } } // NewTaxInvoiceOptionsParamsWithHTTPClient creates a new TaxInvoiceOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTaxInvoiceOptionsParamsWithHTTPClient(client *http.Client) *TaxInvoiceOptionsParams { - return &TaxInvoiceOptionsParams{ HTTPClient: client, } } -/*TaxInvoiceOptionsParams contains all the parameters to send to the API endpoint -for the tax invoice options operation typically these are written to a http.Request +/* TaxInvoiceOptionsParams contains all the parameters to send to the API endpoint + for the tax invoice options operation. + + Typically these are written to a http.Request. */ type TaxInvoiceOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TaxInvoiceOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tax invoice options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxInvoiceOptionsParams) WithDefaults() *TaxInvoiceOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tax invoice options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxInvoiceOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tax invoice options params func (o *TaxInvoiceOptionsParams) WithTimeout(timeout time.Duration) *TaxInvoiceOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/tax_invoice_options_responses.go b/api/ops/ops_client/cors/tax_invoice_options_responses.go index a60684e..f398c69 100644 --- a/api/ops/ops_client/cors/tax_invoice_options_responses.go +++ b/api/ops/ops_client/cors/tax_invoice_options_responses.go @@ -30,9 +30,8 @@ func (o *TaxInvoiceOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTaxInvoiceOptionsOK() *TaxInvoiceOptionsOK { return &TaxInvoiceOptionsOK{} } -/*TaxInvoiceOptionsOK handles this case with default header values. +/* TaxInvoiceOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TaxInvoiceOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TaxInvoiceOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TaxInvoiceOptionsOK) Error() string { func (o *TaxInvoiceOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/tax_order_options_parameters.go b/api/ops/ops_client/cors/tax_order_options_parameters.go index 5903dbc..c5d948e 100644 --- a/api/ops/ops_client/cors/tax_order_options_parameters.go +++ b/api/ops/ops_client/cors/tax_order_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTaxOrderOptionsParams creates a new TaxOrderOptionsParams object -// with the default values initialized. +// NewTaxOrderOptionsParams creates a new TaxOrderOptionsParams 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 NewTaxOrderOptionsParams() *TaxOrderOptionsParams { - return &TaxOrderOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTaxOrderOptionsParamsWithTimeout creates a new TaxOrderOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTaxOrderOptionsParamsWithTimeout(timeout time.Duration) *TaxOrderOptionsParams { - return &TaxOrderOptionsParams{ - timeout: timeout, } } // NewTaxOrderOptionsParamsWithContext creates a new TaxOrderOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTaxOrderOptionsParamsWithContext(ctx context.Context) *TaxOrderOptionsParams { - return &TaxOrderOptionsParams{ - Context: ctx, } } // NewTaxOrderOptionsParamsWithHTTPClient creates a new TaxOrderOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTaxOrderOptionsParamsWithHTTPClient(client *http.Client) *TaxOrderOptionsParams { - return &TaxOrderOptionsParams{ HTTPClient: client, } } -/*TaxOrderOptionsParams contains all the parameters to send to the API endpoint -for the tax order options operation typically these are written to a http.Request +/* TaxOrderOptionsParams contains all the parameters to send to the API endpoint + for the tax order options operation. + + Typically these are written to a http.Request. */ type TaxOrderOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TaxOrderOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tax order options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxOrderOptionsParams) WithDefaults() *TaxOrderOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tax order options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxOrderOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tax order options params func (o *TaxOrderOptionsParams) WithTimeout(timeout time.Duration) *TaxOrderOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/tax_order_options_responses.go b/api/ops/ops_client/cors/tax_order_options_responses.go index ff9459f..a2144a6 100644 --- a/api/ops/ops_client/cors/tax_order_options_responses.go +++ b/api/ops/ops_client/cors/tax_order_options_responses.go @@ -30,9 +30,8 @@ func (o *TaxOrderOptionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTaxOrderOptionsOK() *TaxOrderOptionsOK { return &TaxOrderOptionsOK{} } -/*TaxOrderOptionsOK handles this case with default header values. +/* TaxOrderOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TaxOrderOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TaxOrderOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TaxOrderOptionsOK) Error() string { func (o *TaxOrderOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/tax_po_options_parameters.go b/api/ops/ops_client/cors/tax_po_options_parameters.go index 5e62fe1..b788064 100644 --- a/api/ops/ops_client/cors/tax_po_options_parameters.go +++ b/api/ops/ops_client/cors/tax_po_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTaxPoOptionsParams creates a new TaxPoOptionsParams object -// with the default values initialized. +// NewTaxPoOptionsParams creates a new TaxPoOptionsParams 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 NewTaxPoOptionsParams() *TaxPoOptionsParams { - return &TaxPoOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTaxPoOptionsParamsWithTimeout creates a new TaxPoOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTaxPoOptionsParamsWithTimeout(timeout time.Duration) *TaxPoOptionsParams { - return &TaxPoOptionsParams{ - timeout: timeout, } } // NewTaxPoOptionsParamsWithContext creates a new TaxPoOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTaxPoOptionsParamsWithContext(ctx context.Context) *TaxPoOptionsParams { - return &TaxPoOptionsParams{ - Context: ctx, } } // NewTaxPoOptionsParamsWithHTTPClient creates a new TaxPoOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTaxPoOptionsParamsWithHTTPClient(client *http.Client) *TaxPoOptionsParams { - return &TaxPoOptionsParams{ HTTPClient: client, } } -/*TaxPoOptionsParams contains all the parameters to send to the API endpoint -for the tax po options operation typically these are written to a http.Request +/* TaxPoOptionsParams contains all the parameters to send to the API endpoint + for the tax po options operation. + + Typically these are written to a http.Request. */ type TaxPoOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TaxPoOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tax po options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxPoOptionsParams) WithDefaults() *TaxPoOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tax po options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxPoOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tax po options params func (o *TaxPoOptionsParams) WithTimeout(timeout time.Duration) *TaxPoOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/tax_po_options_responses.go b/api/ops/ops_client/cors/tax_po_options_responses.go index 780069e..1735023 100644 --- a/api/ops/ops_client/cors/tax_po_options_responses.go +++ b/api/ops/ops_client/cors/tax_po_options_responses.go @@ -30,9 +30,8 @@ func (o *TaxPoOptionsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTaxPoOptionsOK() *TaxPoOptionsOK { return &TaxPoOptionsOK{} } -/*TaxPoOptionsOK handles this case with default header values. +/* TaxPoOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TaxPoOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TaxPoOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TaxPoOptionsOK) Error() string { func (o *TaxPoOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/cors/tax_quote_options_parameters.go b/api/ops/ops_client/cors/tax_quote_options_parameters.go index 94b5953..7f7ded2 100644 --- a/api/ops/ops_client/cors/tax_quote_options_parameters.go +++ b/api/ops/ops_client/cors/tax_quote_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTaxQuoteOptionsParams creates a new TaxQuoteOptionsParams object -// with the default values initialized. +// NewTaxQuoteOptionsParams creates a new TaxQuoteOptionsParams 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 NewTaxQuoteOptionsParams() *TaxQuoteOptionsParams { - return &TaxQuoteOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTaxQuoteOptionsParamsWithTimeout creates a new TaxQuoteOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTaxQuoteOptionsParamsWithTimeout(timeout time.Duration) *TaxQuoteOptionsParams { - return &TaxQuoteOptionsParams{ - timeout: timeout, } } // NewTaxQuoteOptionsParamsWithContext creates a new TaxQuoteOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTaxQuoteOptionsParamsWithContext(ctx context.Context) *TaxQuoteOptionsParams { - return &TaxQuoteOptionsParams{ - Context: ctx, } } // NewTaxQuoteOptionsParamsWithHTTPClient creates a new TaxQuoteOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTaxQuoteOptionsParamsWithHTTPClient(client *http.Client) *TaxQuoteOptionsParams { - return &TaxQuoteOptionsParams{ HTTPClient: client, } } -/*TaxQuoteOptionsParams contains all the parameters to send to the API endpoint -for the tax quote options operation typically these are written to a http.Request +/* TaxQuoteOptionsParams contains all the parameters to send to the API endpoint + for the tax quote options operation. + + Typically these are written to a http.Request. */ type TaxQuoteOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TaxQuoteOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tax quote options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxQuoteOptionsParams) WithDefaults() *TaxQuoteOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tax quote options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxQuoteOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tax quote options params func (o *TaxQuoteOptionsParams) WithTimeout(timeout time.Duration) *TaxQuoteOptionsParams { o.SetTimeout(timeout) diff --git a/api/ops/ops_client/cors/tax_quote_options_responses.go b/api/ops/ops_client/cors/tax_quote_options_responses.go index 3b0714b..fed0271 100644 --- a/api/ops/ops_client/cors/tax_quote_options_responses.go +++ b/api/ops/ops_client/cors/tax_quote_options_responses.go @@ -30,9 +30,8 @@ func (o *TaxQuoteOptionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTaxQuoteOptionsOK() *TaxQuoteOptionsOK { return &TaxQuoteOptionsOK{} } -/*TaxQuoteOptionsOK handles this case with default header values. +/* TaxQuoteOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TaxQuoteOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TaxQuoteOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TaxQuoteOptionsOK) Error() string { func (o *TaxQuoteOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/ops/ops_client/eft/eft_client.go b/api/ops/ops_client/eft/eft_client.go index 06d6826..d5849e7 100644 --- a/api/ops/ops_client/eft/eft_client.go +++ b/api/ops/ops_client/eft/eft_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetEfts(params *GetEftsParams, authInfo runtime.ClientAuthInfoWriter) (*GetEftsOK, error) + GetEfts(params *GetEftsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEftsOK, error) - PostEfts(params *PostEftsParams, authInfo runtime.ClientAuthInfoWriter) (*PostEftsOK, error) + PostEfts(params *PostEftsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostEftsOK, error) - PutEfts(params *PutEftsParams, authInfo runtime.ClientAuthInfoWriter) (*PutEftsOK, error) + PutEfts(params *PutEftsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutEftsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Taxnexus Efts */ -func (a *Client) GetEfts(params *GetEftsParams, authInfo runtime.ClientAuthInfoWriter) (*GetEftsOK, error) { +func (a *Client) GetEfts(params *GetEftsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEftsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetEftsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getEfts", Method: "GET", PathPattern: "/efts", @@ -63,7 +65,12 @@ func (a *Client) GetEfts(params *GetEftsParams, authInfo runtime.ClientAuthInfoW 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 } @@ -82,13 +89,12 @@ func (a *Client) GetEfts(params *GetEftsParams, authInfo runtime.ClientAuthInfoW Create New Efts */ -func (a *Client) PostEfts(params *PostEftsParams, authInfo runtime.ClientAuthInfoWriter) (*PostEftsOK, error) { +func (a *Client) PostEfts(params *PostEftsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostEftsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostEftsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postEfts", Method: "POST", PathPattern: "/efts", @@ -100,7 +106,12 @@ func (a *Client) PostEfts(params *PostEftsParams, authInfo runtime.ClientAuthInf 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 } @@ -119,13 +130,12 @@ func (a *Client) PostEfts(params *PostEftsParams, authInfo runtime.ClientAuthInf Put a list of Efts */ -func (a *Client) PutEfts(params *PutEftsParams, authInfo runtime.ClientAuthInfoWriter) (*PutEftsOK, error) { +func (a *Client) PutEfts(params *PutEftsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutEftsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutEftsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putEfts", Method: "PUT", PathPattern: "/efts", @@ -137,7 +147,12 @@ func (a *Client) PutEfts(params *PutEftsParams, authInfo runtime.ClientAuthInfoW 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 } diff --git a/api/ops/ops_client/eft/get_efts_parameters.go b/api/ops/ops_client/eft/get_efts_parameters.go index 6deff16..f5c9254 100644 --- a/api/ops/ops_client/eft/get_efts_parameters.go +++ b/api/ops/ops_client/eft/get_efts_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetEftsParams creates a new GetEftsParams object -// with the default values initialized. +// NewGetEftsParams creates a new GetEftsParams 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 NewGetEftsParams() *GetEftsParams { - var () return &GetEftsParams{ - timeout: cr.DefaultTimeout, } } // NewGetEftsParamsWithTimeout creates a new GetEftsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetEftsParamsWithTimeout(timeout time.Duration) *GetEftsParams { - var () return &GetEftsParams{ - timeout: timeout, } } // NewGetEftsParamsWithContext creates a new GetEftsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetEftsParamsWithContext(ctx context.Context) *GetEftsParams { - var () return &GetEftsParams{ - Context: ctx, } } // NewGetEftsParamsWithHTTPClient creates a new GetEftsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetEftsParamsWithHTTPClient(client *http.Client) *GetEftsParams { - var () return &GetEftsParams{ HTTPClient: client, } } -/*GetEftsParams contains all the parameters to send to the API endpoint -for the get efts operation typically these are written to a http.Request +/* GetEftsParams contains all the parameters to send to the API endpoint + for the get efts operation. + + Typically these are written to a http.Request. */ type GetEftsParams struct { - /*EftID - Taxnexus Record Id of a EFT + /* EftID. + Taxnexus Record Id of a EFT */ EftID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetEftsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get efts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEftsParams) WithDefaults() *GetEftsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get efts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEftsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get efts params func (o *GetEftsParams) WithTimeout(timeout time.Duration) *GetEftsParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetEftsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis // query param eftId var qrEftID string + if o.EftID != nil { qrEftID = *o.EftID } qEftID := qrEftID if qEftID != "" { + if err := r.SetQueryParam("eftId", qEftID); 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 { diff --git a/api/ops/ops_client/eft/get_efts_responses.go b/api/ops/ops_client/eft/get_efts_responses.go index c48679a..22b78c1 100644 --- a/api/ops/ops_client/eft/get_efts_responses.go +++ b/api/ops/ops_client/eft/get_efts_responses.go @@ -63,9 +63,8 @@ func (o *GetEftsReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetEftsOK() *GetEftsOK { return &GetEftsOK{} } -/*GetEftsOK handles this case with default header values. +/* GetEftsOK describes a response with status code 200, with default header values. Taxnexus Response with EFT objects */ type GetEftsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.EftResponse } @@ -89,18 +87,25 @@ type GetEftsOK struct { func (o *GetEftsOK) Error() string { return fmt.Sprintf("[GET /efts][%d] getEftsOK %+v", 200, o.Payload) } - func (o *GetEftsOK) GetPayload() *ops_models.EftResponse { return o.Payload } func (o *GetEftsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.EftResponse) @@ -117,7 +122,7 @@ func NewGetEftsUnauthorized() *GetEftsUnauthorized { return &GetEftsUnauthorized{} } -/*GetEftsUnauthorized handles this case with default header values. +/* GetEftsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetEftsUnauthorized struct { func (o *GetEftsUnauthorized) Error() string { return fmt.Sprintf("[GET /efts][%d] getEftsUnauthorized %+v", 401, o.Payload) } - func (o *GetEftsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetEftsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetEftsForbidden() *GetEftsForbidden { return &GetEftsForbidden{} } -/*GetEftsForbidden handles this case with default header values. +/* GetEftsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetEftsForbidden struct { func (o *GetEftsForbidden) Error() string { return fmt.Sprintf("[GET /efts][%d] getEftsForbidden %+v", 403, o.Payload) } - func (o *GetEftsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetEftsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetEftsNotFound() *GetEftsNotFound { return &GetEftsNotFound{} } -/*GetEftsNotFound handles this case with default header values. +/* GetEftsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetEftsNotFound struct { func (o *GetEftsNotFound) Error() string { return fmt.Sprintf("[GET /efts][%d] getEftsNotFound %+v", 404, o.Payload) } - func (o *GetEftsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetEftsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetEftsUnprocessableEntity() *GetEftsUnprocessableEntity { return &GetEftsUnprocessableEntity{} } -/*GetEftsUnprocessableEntity handles this case with default header values. +/* GetEftsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetEftsUnprocessableEntity struct { func (o *GetEftsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /efts][%d] getEftsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetEftsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetEftsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetEftsInternalServerError() *GetEftsInternalServerError { return &GetEftsInternalServerError{} } -/*GetEftsInternalServerError handles this case with default header values. +/* GetEftsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetEftsInternalServerError struct { func (o *GetEftsInternalServerError) Error() string { return fmt.Sprintf("[GET /efts][%d] getEftsInternalServerError %+v", 500, o.Payload) } - func (o *GetEftsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetEftsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/eft/post_efts_parameters.go b/api/ops/ops_client/eft/post_efts_parameters.go index 5efc943..0b7a5bf 100644 --- a/api/ops/ops_client/eft/post_efts_parameters.go +++ b/api/ops/ops_client/eft/post_efts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostEftsParams creates a new PostEftsParams object -// with the default values initialized. +// NewPostEftsParams creates a new PostEftsParams 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 NewPostEftsParams() *PostEftsParams { - var () return &PostEftsParams{ - timeout: cr.DefaultTimeout, } } // NewPostEftsParamsWithTimeout creates a new PostEftsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostEftsParamsWithTimeout(timeout time.Duration) *PostEftsParams { - var () return &PostEftsParams{ - timeout: timeout, } } // NewPostEftsParamsWithContext creates a new PostEftsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostEftsParamsWithContext(ctx context.Context) *PostEftsParams { - var () return &PostEftsParams{ - Context: ctx, } } // NewPostEftsParamsWithHTTPClient creates a new PostEftsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostEftsParamsWithHTTPClient(client *http.Client) *PostEftsParams { - var () return &PostEftsParams{ HTTPClient: client, } } -/*PostEftsParams contains all the parameters to send to the API endpoint -for the post efts operation typically these are written to a http.Request +/* PostEftsParams contains all the parameters to send to the API endpoint + for the post efts operation. + + Typically these are written to a http.Request. */ type PostEftsParams struct { - /*EftRequest - A request with an array of EFT Objects + /* EftRequest. + A request with an array of EFT Objects */ EftRequest *ops_models.EftRequest @@ -77,6 +76,21 @@ type PostEftsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post efts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostEftsParams) WithDefaults() *PostEftsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post efts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostEftsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post efts params func (o *PostEftsParams) WithTimeout(timeout time.Duration) *PostEftsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostEftsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.EftRequest != nil { if err := r.SetBodyParam(o.EftRequest); err != nil { return err diff --git a/api/ops/ops_client/eft/post_efts_responses.go b/api/ops/ops_client/eft/post_efts_responses.go index 0b64c95..241985f 100644 --- a/api/ops/ops_client/eft/post_efts_responses.go +++ b/api/ops/ops_client/eft/post_efts_responses.go @@ -63,9 +63,8 @@ func (o *PostEftsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostEftsOK() *PostEftsOK { return &PostEftsOK{} } -/*PostEftsOK handles this case with default header values. +/* PostEftsOK describes a response with status code 200, with default header values. Taxnexus Response with EFT objects */ type PostEftsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.EftResponse } @@ -89,18 +87,25 @@ type PostEftsOK struct { func (o *PostEftsOK) Error() string { return fmt.Sprintf("[POST /efts][%d] postEftsOK %+v", 200, o.Payload) } - func (o *PostEftsOK) GetPayload() *ops_models.EftResponse { return o.Payload } func (o *PostEftsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.EftResponse) @@ -117,7 +122,7 @@ func NewPostEftsUnauthorized() *PostEftsUnauthorized { return &PostEftsUnauthorized{} } -/*PostEftsUnauthorized handles this case with default header values. +/* PostEftsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostEftsUnauthorized struct { func (o *PostEftsUnauthorized) Error() string { return fmt.Sprintf("[POST /efts][%d] postEftsUnauthorized %+v", 401, o.Payload) } - func (o *PostEftsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostEftsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostEftsForbidden() *PostEftsForbidden { return &PostEftsForbidden{} } -/*PostEftsForbidden handles this case with default header values. +/* PostEftsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostEftsForbidden struct { func (o *PostEftsForbidden) Error() string { return fmt.Sprintf("[POST /efts][%d] postEftsForbidden %+v", 403, o.Payload) } - func (o *PostEftsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostEftsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostEftsNotFound() *PostEftsNotFound { return &PostEftsNotFound{} } -/*PostEftsNotFound handles this case with default header values. +/* PostEftsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostEftsNotFound struct { func (o *PostEftsNotFound) Error() string { return fmt.Sprintf("[POST /efts][%d] postEftsNotFound %+v", 404, o.Payload) } - func (o *PostEftsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostEftsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostEftsUnprocessableEntity() *PostEftsUnprocessableEntity { return &PostEftsUnprocessableEntity{} } -/*PostEftsUnprocessableEntity handles this case with default header values. +/* PostEftsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostEftsUnprocessableEntity struct { func (o *PostEftsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /efts][%d] postEftsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostEftsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostEftsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostEftsInternalServerError() *PostEftsInternalServerError { return &PostEftsInternalServerError{} } -/*PostEftsInternalServerError handles this case with default header values. +/* PostEftsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostEftsInternalServerError struct { func (o *PostEftsInternalServerError) Error() string { return fmt.Sprintf("[POST /efts][%d] postEftsInternalServerError %+v", 500, o.Payload) } - func (o *PostEftsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostEftsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/eft/put_efts_parameters.go b/api/ops/ops_client/eft/put_efts_parameters.go index 0913e89..fdc50fb 100644 --- a/api/ops/ops_client/eft/put_efts_parameters.go +++ b/api/ops/ops_client/eft/put_efts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutEftsParams creates a new PutEftsParams object -// with the default values initialized. +// NewPutEftsParams creates a new PutEftsParams 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 NewPutEftsParams() *PutEftsParams { - var () return &PutEftsParams{ - timeout: cr.DefaultTimeout, } } // NewPutEftsParamsWithTimeout creates a new PutEftsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutEftsParamsWithTimeout(timeout time.Duration) *PutEftsParams { - var () return &PutEftsParams{ - timeout: timeout, } } // NewPutEftsParamsWithContext creates a new PutEftsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutEftsParamsWithContext(ctx context.Context) *PutEftsParams { - var () return &PutEftsParams{ - Context: ctx, } } // NewPutEftsParamsWithHTTPClient creates a new PutEftsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutEftsParamsWithHTTPClient(client *http.Client) *PutEftsParams { - var () return &PutEftsParams{ HTTPClient: client, } } -/*PutEftsParams contains all the parameters to send to the API endpoint -for the put efts operation typically these are written to a http.Request +/* PutEftsParams contains all the parameters to send to the API endpoint + for the put efts operation. + + Typically these are written to a http.Request. */ type PutEftsParams struct { - /*EftRequest - A request with an array of EFT Objects + /* EftRequest. + A request with an array of EFT Objects */ EftRequest *ops_models.EftRequest @@ -77,6 +76,21 @@ type PutEftsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put efts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutEftsParams) WithDefaults() *PutEftsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put efts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutEftsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put efts params func (o *PutEftsParams) WithTimeout(timeout time.Duration) *PutEftsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutEftsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis return err } var res []error - if o.EftRequest != nil { if err := r.SetBodyParam(o.EftRequest); err != nil { return err diff --git a/api/ops/ops_client/eft/put_efts_responses.go b/api/ops/ops_client/eft/put_efts_responses.go index 4d44bfd..87610e1 100644 --- a/api/ops/ops_client/eft/put_efts_responses.go +++ b/api/ops/ops_client/eft/put_efts_responses.go @@ -63,9 +63,8 @@ func (o *PutEftsReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutEftsOK() *PutEftsOK { return &PutEftsOK{} } -/*PutEftsOK handles this case with default header values. +/* PutEftsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Message objects in response to a PUT */ @@ -87,15 +86,18 @@ type PutEftsOK struct { func (o *PutEftsOK) Error() string { return fmt.Sprintf("[PUT /efts][%d] putEftsOK %+v", 200, o.Payload) } - func (o *PutEftsOK) GetPayload() *ops_models.PutResponse { return o.Payload } func (o *PutEftsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.PutResponse) @@ -112,7 +114,7 @@ func NewPutEftsUnauthorized() *PutEftsUnauthorized { return &PutEftsUnauthorized{} } -/*PutEftsUnauthorized handles this case with default header values. +/* PutEftsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PutEftsUnauthorized struct { func (o *PutEftsUnauthorized) Error() string { return fmt.Sprintf("[PUT /efts][%d] putEftsUnauthorized %+v", 401, o.Payload) } - func (o *PutEftsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutEftsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewPutEftsForbidden() *PutEftsForbidden { return &PutEftsForbidden{} } -/*PutEftsForbidden handles this case with default header values. +/* PutEftsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PutEftsForbidden struct { func (o *PutEftsForbidden) Error() string { return fmt.Sprintf("[PUT /efts][%d] putEftsForbidden %+v", 403, o.Payload) } - func (o *PutEftsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutEftsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewPutEftsNotFound() *PutEftsNotFound { return &PutEftsNotFound{} } -/*PutEftsNotFound handles this case with default header values. +/* PutEftsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PutEftsNotFound struct { func (o *PutEftsNotFound) Error() string { return fmt.Sprintf("[PUT /efts][%d] putEftsNotFound %+v", 404, o.Payload) } - func (o *PutEftsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutEftsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewPutEftsUnprocessableEntity() *PutEftsUnprocessableEntity { return &PutEftsUnprocessableEntity{} } -/*PutEftsUnprocessableEntity handles this case with default header values. +/* PutEftsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PutEftsUnprocessableEntity struct { func (o *PutEftsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /efts][%d] putEftsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutEftsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutEftsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewPutEftsInternalServerError() *PutEftsInternalServerError { return &PutEftsInternalServerError{} } -/*PutEftsInternalServerError handles this case with default header values. +/* PutEftsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PutEftsInternalServerError struct { func (o *PutEftsInternalServerError) Error() string { return fmt.Sprintf("[PUT /efts][%d] putEftsInternalServerError %+v", 500, o.Payload) } - func (o *PutEftsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutEftsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/invoice/delete_invoice_parameters.go b/api/ops/ops_client/invoice/delete_invoice_parameters.go index 412392a..3479ac1 100644 --- a/api/ops/ops_client/invoice/delete_invoice_parameters.go +++ b/api/ops/ops_client/invoice/delete_invoice_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteInvoiceParams creates a new DeleteInvoiceParams object -// with the default values initialized. +// NewDeleteInvoiceParams creates a new DeleteInvoiceParams 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 NewDeleteInvoiceParams() *DeleteInvoiceParams { - var () return &DeleteInvoiceParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteInvoiceParamsWithTimeout creates a new DeleteInvoiceParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteInvoiceParamsWithTimeout(timeout time.Duration) *DeleteInvoiceParams { - var () return &DeleteInvoiceParams{ - timeout: timeout, } } // NewDeleteInvoiceParamsWithContext creates a new DeleteInvoiceParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteInvoiceParamsWithContext(ctx context.Context) *DeleteInvoiceParams { - var () return &DeleteInvoiceParams{ - Context: ctx, } } // NewDeleteInvoiceParamsWithHTTPClient creates a new DeleteInvoiceParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteInvoiceParamsWithHTTPClient(client *http.Client) *DeleteInvoiceParams { - var () return &DeleteInvoiceParams{ HTTPClient: client, } } -/*DeleteInvoiceParams contains all the parameters to send to the API endpoint -for the delete invoice operation typically these are written to a http.Request +/* DeleteInvoiceParams contains all the parameters to send to the API endpoint + for the delete invoice operation. + + Typically these are written to a http.Request. */ type DeleteInvoiceParams struct { - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + Taxnexus Id of the record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeleteInvoiceParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete invoice params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteInvoiceParams) WithDefaults() *DeleteInvoiceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete invoice params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteInvoiceParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete invoice params func (o *DeleteInvoiceParams) WithTimeout(timeout time.Duration) *DeleteInvoiceParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteInvoiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/invoice/delete_invoice_responses.go b/api/ops/ops_client/invoice/delete_invoice_responses.go index 5cf6eec..53d567c 100644 --- a/api/ops/ops_client/invoice/delete_invoice_responses.go +++ b/api/ops/ops_client/invoice/delete_invoice_responses.go @@ -63,9 +63,8 @@ func (o *DeleteInvoiceReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteInvoiceOK() *DeleteInvoiceOK { return &DeleteInvoiceOK{} } -/*DeleteInvoiceOK handles this case with default header values. +/* DeleteInvoiceOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteInvoiceOK struct { func (o *DeleteInvoiceOK) Error() string { return fmt.Sprintf("[DELETE /invoices][%d] deleteInvoiceOK %+v", 200, o.Payload) } - func (o *DeleteInvoiceOK) GetPayload() *ops_models.DeleteResponse { return o.Payload } func (o *DeleteInvoiceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteInvoiceUnauthorized() *DeleteInvoiceUnauthorized { return &DeleteInvoiceUnauthorized{} } -/*DeleteInvoiceUnauthorized handles this case with default header values. +/* DeleteInvoiceUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteInvoiceUnauthorized struct { func (o *DeleteInvoiceUnauthorized) Error() string { return fmt.Sprintf("[DELETE /invoices][%d] deleteInvoiceUnauthorized %+v", 401, o.Payload) } - func (o *DeleteInvoiceUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteInvoiceUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewDeleteInvoiceForbidden() *DeleteInvoiceForbidden { return &DeleteInvoiceForbidden{} } -/*DeleteInvoiceForbidden handles this case with default header values. +/* DeleteInvoiceForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteInvoiceForbidden struct { func (o *DeleteInvoiceForbidden) Error() string { return fmt.Sprintf("[DELETE /invoices][%d] deleteInvoiceForbidden %+v", 403, o.Payload) } - func (o *DeleteInvoiceForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteInvoiceForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewDeleteInvoiceNotFound() *DeleteInvoiceNotFound { return &DeleteInvoiceNotFound{} } -/*DeleteInvoiceNotFound handles this case with default header values. +/* DeleteInvoiceNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteInvoiceNotFound struct { func (o *DeleteInvoiceNotFound) Error() string { return fmt.Sprintf("[DELETE /invoices][%d] deleteInvoiceNotFound %+v", 404, o.Payload) } - func (o *DeleteInvoiceNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteInvoiceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewDeleteInvoiceUnprocessableEntity() *DeleteInvoiceUnprocessableEntity { return &DeleteInvoiceUnprocessableEntity{} } -/*DeleteInvoiceUnprocessableEntity handles this case with default header values. +/* DeleteInvoiceUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteInvoiceUnprocessableEntity struct { func (o *DeleteInvoiceUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /invoices][%d] deleteInvoiceUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteInvoiceUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteInvoiceUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewDeleteInvoiceInternalServerError() *DeleteInvoiceInternalServerError { return &DeleteInvoiceInternalServerError{} } -/*DeleteInvoiceInternalServerError handles this case with default header values. +/* DeleteInvoiceInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteInvoiceInternalServerError struct { func (o *DeleteInvoiceInternalServerError) Error() string { return fmt.Sprintf("[DELETE /invoices][%d] deleteInvoiceInternalServerError %+v", 500, o.Payload) } - func (o *DeleteInvoiceInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteInvoiceInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/invoice/get_invoices_parameters.go b/api/ops/ops_client/invoice/get_invoices_parameters.go index 8072a2b..93c7abe 100644 --- a/api/ops/ops_client/invoice/get_invoices_parameters.go +++ b/api/ops/ops_client/invoice/get_invoices_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetInvoicesParams creates a new GetInvoicesParams object -// with the default values initialized. +// NewGetInvoicesParams creates a new GetInvoicesParams 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 NewGetInvoicesParams() *GetInvoicesParams { - var () return &GetInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewGetInvoicesParamsWithTimeout creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetInvoicesParamsWithTimeout(timeout time.Duration) *GetInvoicesParams { - var () return &GetInvoicesParams{ - timeout: timeout, } } // NewGetInvoicesParamsWithContext creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetInvoicesParamsWithContext(ctx context.Context) *GetInvoicesParams { - var () return &GetInvoicesParams{ - Context: ctx, } } // NewGetInvoicesParamsWithHTTPClient creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetInvoicesParamsWithHTTPClient(client *http.Client) *GetInvoicesParams { - var () return &GetInvoicesParams{ HTTPClient: client, } } -/*GetInvoicesParams contains all the parameters to send to the API endpoint -for the get invoices operation typically these are written to a http.Request +/* GetInvoicesParams contains all the parameters to send to the API endpoint + for the get invoices operation. + + Typically these are written to a http.Request. */ type GetInvoicesParams struct { - /*InvoiceID - Taxnexus Record Id of an Invoice + /* InvoiceID. + Taxnexus Record Id of an Invoice */ InvoiceID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInvoicesParams) WithDefaults() *GetInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get invoices params func (o *GetInvoicesParams) WithTimeout(timeout time.Duration) *GetInvoicesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param invoiceId var qrInvoiceID string + if o.InvoiceID != nil { qrInvoiceID = *o.InvoiceID } qInvoiceID := qrInvoiceID if qInvoiceID != "" { + if err := r.SetQueryParam("invoiceId", qInvoiceID); 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 { diff --git a/api/ops/ops_client/invoice/get_invoices_responses.go b/api/ops/ops_client/invoice/get_invoices_responses.go index 9f508ca..e24bb6f 100644 --- a/api/ops/ops_client/invoice/get_invoices_responses.go +++ b/api/ops/ops_client/invoice/get_invoices_responses.go @@ -63,9 +63,8 @@ func (o *GetInvoicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetInvoicesOK() *GetInvoicesOK { return &GetInvoicesOK{} } -/*GetInvoicesOK handles this case with default header values. +/* GetInvoicesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Invoice (full) objects */ type GetInvoicesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.InvoiceResponse } @@ -89,18 +87,25 @@ type GetInvoicesOK struct { func (o *GetInvoicesOK) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesOK %+v", 200, o.Payload) } - func (o *GetInvoicesOK) GetPayload() *ops_models.InvoiceResponse { return o.Payload } func (o *GetInvoicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.InvoiceResponse) @@ -117,7 +122,7 @@ func NewGetInvoicesUnauthorized() *GetInvoicesUnauthorized { return &GetInvoicesUnauthorized{} } -/*GetInvoicesUnauthorized handles this case with default header values. +/* GetInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetInvoicesUnauthorized struct { func (o *GetInvoicesUnauthorized) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *GetInvoicesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetInvoicesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetInvoicesForbidden() *GetInvoicesForbidden { return &GetInvoicesForbidden{} } -/*GetInvoicesForbidden handles this case with default header values. +/* GetInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetInvoicesForbidden struct { func (o *GetInvoicesForbidden) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesForbidden %+v", 403, o.Payload) } - func (o *GetInvoicesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetInvoicesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetInvoicesNotFound() *GetInvoicesNotFound { return &GetInvoicesNotFound{} } -/*GetInvoicesNotFound handles this case with default header values. +/* GetInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetInvoicesNotFound struct { func (o *GetInvoicesNotFound) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesNotFound %+v", 404, o.Payload) } - func (o *GetInvoicesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetInvoicesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetInvoicesUnprocessableEntity() *GetInvoicesUnprocessableEntity { return &GetInvoicesUnprocessableEntity{} } -/*GetInvoicesUnprocessableEntity handles this case with default header values. +/* GetInvoicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetInvoicesUnprocessableEntity struct { func (o *GetInvoicesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetInvoicesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetInvoicesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetInvoicesInternalServerError() *GetInvoicesInternalServerError { return &GetInvoicesInternalServerError{} } -/*GetInvoicesInternalServerError handles this case with default header values. +/* GetInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetInvoicesInternalServerError struct { func (o *GetInvoicesInternalServerError) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *GetInvoicesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetInvoicesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/invoice/invoice_client.go b/api/ops/ops_client/invoice/invoice_client.go index d653db9..085e6bc 100644 --- a/api/ops/ops_client/invoice/invoice_client.go +++ b/api/ops/ops_client/invoice/invoice_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteInvoice(params *DeleteInvoiceParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteInvoiceOK, error) + DeleteInvoice(params *DeleteInvoiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteInvoiceOK, error) - GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoicesOK, error) + GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvoicesOK, error) - PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostInvoicesOK, error) + PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostInvoicesOK, error) - PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutInvoicesOK, error) + PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutInvoicesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete an invoice by ID */ -func (a *Client) DeleteInvoice(params *DeleteInvoiceParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteInvoiceOK, error) { +func (a *Client) DeleteInvoice(params *DeleteInvoiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteInvoiceOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteInvoiceParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteInvoice", Method: "DELETE", PathPattern: "/invoices", @@ -65,7 +67,12 @@ func (a *Client) DeleteInvoice(params *DeleteInvoiceParams, authInfo runtime.Cli 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteInvoice(params *DeleteInvoiceParams, authInfo runtime.Cli Return a list of available Taxnexus Invoices */ -func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoicesOK, error) { +func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getInvoices", Method: "GET", PathPattern: "/invoices", @@ -102,7 +108,12 @@ func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientA 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 } @@ -121,13 +132,12 @@ func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientA Create New Invoices */ -func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostInvoicesOK, error) { +func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postInvoices", Method: "POST", PathPattern: "/invoices", @@ -139,7 +149,12 @@ func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.Clien 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 } @@ -158,13 +173,12 @@ func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.Clien Put a list of Invoices */ -func (a *Client) PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutInvoicesOK, error) { +func (a *Client) PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putInvoices", Method: "PUT", PathPattern: "/invoices", @@ -176,7 +190,12 @@ func (a *Client) PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientA 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 } diff --git a/api/ops/ops_client/invoice/post_invoices_parameters.go b/api/ops/ops_client/invoice/post_invoices_parameters.go index e399057..c336692 100644 --- a/api/ops/ops_client/invoice/post_invoices_parameters.go +++ b/api/ops/ops_client/invoice/post_invoices_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostInvoicesParams creates a new PostInvoicesParams object -// with the default values initialized. +// NewPostInvoicesParams creates a new PostInvoicesParams 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 NewPostInvoicesParams() *PostInvoicesParams { - var () return &PostInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewPostInvoicesParamsWithTimeout creates a new PostInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostInvoicesParamsWithTimeout(timeout time.Duration) *PostInvoicesParams { - var () return &PostInvoicesParams{ - timeout: timeout, } } // NewPostInvoicesParamsWithContext creates a new PostInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostInvoicesParamsWithContext(ctx context.Context) *PostInvoicesParams { - var () return &PostInvoicesParams{ - Context: ctx, } } // NewPostInvoicesParamsWithHTTPClient creates a new PostInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostInvoicesParamsWithHTTPClient(client *http.Client) *PostInvoicesParams { - var () return &PostInvoicesParams{ HTTPClient: client, } } -/*PostInvoicesParams contains all the parameters to send to the API endpoint -for the post invoices operation typically these are written to a http.Request +/* PostInvoicesParams contains all the parameters to send to the API endpoint + for the post invoices operation. + + Typically these are written to a http.Request. */ type PostInvoicesParams struct { - /*InvoiceRequest - A request with an array of Invoice Objects + /* InvoiceRequest. + A request with an array of Invoice Objects */ InvoiceRequest *ops_models.InvoiceRequest @@ -77,6 +76,21 @@ type PostInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostInvoicesParams) WithDefaults() *PostInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post invoices params func (o *PostInvoicesParams) WithTimeout(timeout time.Duration) *PostInvoicesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.InvoiceRequest != nil { if err := r.SetBodyParam(o.InvoiceRequest); err != nil { return err diff --git a/api/ops/ops_client/invoice/post_invoices_responses.go b/api/ops/ops_client/invoice/post_invoices_responses.go index 83b4c14..56b58d3 100644 --- a/api/ops/ops_client/invoice/post_invoices_responses.go +++ b/api/ops/ops_client/invoice/post_invoices_responses.go @@ -63,9 +63,8 @@ func (o *PostInvoicesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostInvoicesOK() *PostInvoicesOK { return &PostInvoicesOK{} } -/*PostInvoicesOK handles this case with default header values. +/* PostInvoicesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Invoice (full) objects */ type PostInvoicesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.InvoiceResponse } @@ -89,18 +87,25 @@ type PostInvoicesOK struct { func (o *PostInvoicesOK) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesOK %+v", 200, o.Payload) } - func (o *PostInvoicesOK) GetPayload() *ops_models.InvoiceResponse { return o.Payload } func (o *PostInvoicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.InvoiceResponse) @@ -117,7 +122,7 @@ func NewPostInvoicesUnauthorized() *PostInvoicesUnauthorized { return &PostInvoicesUnauthorized{} } -/*PostInvoicesUnauthorized handles this case with default header values. +/* PostInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostInvoicesUnauthorized struct { func (o *PostInvoicesUnauthorized) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *PostInvoicesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostInvoicesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostInvoicesForbidden() *PostInvoicesForbidden { return &PostInvoicesForbidden{} } -/*PostInvoicesForbidden handles this case with default header values. +/* PostInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostInvoicesForbidden struct { func (o *PostInvoicesForbidden) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesForbidden %+v", 403, o.Payload) } - func (o *PostInvoicesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostInvoicesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostInvoicesNotFound() *PostInvoicesNotFound { return &PostInvoicesNotFound{} } -/*PostInvoicesNotFound handles this case with default header values. +/* PostInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostInvoicesNotFound struct { func (o *PostInvoicesNotFound) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesNotFound %+v", 404, o.Payload) } - func (o *PostInvoicesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostInvoicesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostInvoicesUnprocessableEntity() *PostInvoicesUnprocessableEntity { return &PostInvoicesUnprocessableEntity{} } -/*PostInvoicesUnprocessableEntity handles this case with default header values. +/* PostInvoicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostInvoicesUnprocessableEntity struct { func (o *PostInvoicesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostInvoicesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostInvoicesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostInvoicesInternalServerError() *PostInvoicesInternalServerError { return &PostInvoicesInternalServerError{} } -/*PostInvoicesInternalServerError handles this case with default header values. +/* PostInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostInvoicesInternalServerError struct { func (o *PostInvoicesInternalServerError) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *PostInvoicesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostInvoicesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/invoice/put_invoices_parameters.go b/api/ops/ops_client/invoice/put_invoices_parameters.go index b3371a4..f23a3ea 100644 --- a/api/ops/ops_client/invoice/put_invoices_parameters.go +++ b/api/ops/ops_client/invoice/put_invoices_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutInvoicesParams creates a new PutInvoicesParams object -// with the default values initialized. +// NewPutInvoicesParams creates a new PutInvoicesParams 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 NewPutInvoicesParams() *PutInvoicesParams { - var () return &PutInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewPutInvoicesParamsWithTimeout creates a new PutInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutInvoicesParamsWithTimeout(timeout time.Duration) *PutInvoicesParams { - var () return &PutInvoicesParams{ - timeout: timeout, } } // NewPutInvoicesParamsWithContext creates a new PutInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutInvoicesParamsWithContext(ctx context.Context) *PutInvoicesParams { - var () return &PutInvoicesParams{ - Context: ctx, } } // NewPutInvoicesParamsWithHTTPClient creates a new PutInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutInvoicesParamsWithHTTPClient(client *http.Client) *PutInvoicesParams { - var () return &PutInvoicesParams{ HTTPClient: client, } } -/*PutInvoicesParams contains all the parameters to send to the API endpoint -for the put invoices operation typically these are written to a http.Request +/* PutInvoicesParams contains all the parameters to send to the API endpoint + for the put invoices operation. + + Typically these are written to a http.Request. */ type PutInvoicesParams struct { - /*InvoiceRequest - A request with an array of Invoice Objects + /* InvoiceRequest. + A request with an array of Invoice Objects */ InvoiceRequest *ops_models.InvoiceRequest @@ -77,6 +76,21 @@ type PutInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutInvoicesParams) WithDefaults() *PutInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put invoices params func (o *PutInvoicesParams) WithTimeout(timeout time.Duration) *PutInvoicesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.InvoiceRequest != nil { if err := r.SetBodyParam(o.InvoiceRequest); err != nil { return err diff --git a/api/ops/ops_client/invoice/put_invoices_responses.go b/api/ops/ops_client/invoice/put_invoices_responses.go index 4781a98..d89891e 100644 --- a/api/ops/ops_client/invoice/put_invoices_responses.go +++ b/api/ops/ops_client/invoice/put_invoices_responses.go @@ -63,9 +63,8 @@ func (o *PutInvoicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutInvoicesOK() *PutInvoicesOK { return &PutInvoicesOK{} } -/*PutInvoicesOK handles this case with default header values. +/* PutInvoicesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Message objects in response to a PUT */ @@ -87,15 +86,18 @@ type PutInvoicesOK struct { func (o *PutInvoicesOK) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesOK %+v", 200, o.Payload) } - func (o *PutInvoicesOK) GetPayload() *ops_models.PutResponse { return o.Payload } func (o *PutInvoicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.PutResponse) @@ -112,7 +114,7 @@ func NewPutInvoicesUnauthorized() *PutInvoicesUnauthorized { return &PutInvoicesUnauthorized{} } -/*PutInvoicesUnauthorized handles this case with default header values. +/* PutInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PutInvoicesUnauthorized struct { func (o *PutInvoicesUnauthorized) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *PutInvoicesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutInvoicesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewPutInvoicesForbidden() *PutInvoicesForbidden { return &PutInvoicesForbidden{} } -/*PutInvoicesForbidden handles this case with default header values. +/* PutInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PutInvoicesForbidden struct { func (o *PutInvoicesForbidden) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesForbidden %+v", 403, o.Payload) } - func (o *PutInvoicesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutInvoicesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewPutInvoicesNotFound() *PutInvoicesNotFound { return &PutInvoicesNotFound{} } -/*PutInvoicesNotFound handles this case with default header values. +/* PutInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PutInvoicesNotFound struct { func (o *PutInvoicesNotFound) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesNotFound %+v", 404, o.Payload) } - func (o *PutInvoicesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutInvoicesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewPutInvoicesUnprocessableEntity() *PutInvoicesUnprocessableEntity { return &PutInvoicesUnprocessableEntity{} } -/*PutInvoicesUnprocessableEntity handles this case with default header values. +/* PutInvoicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PutInvoicesUnprocessableEntity struct { func (o *PutInvoicesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutInvoicesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutInvoicesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewPutInvoicesInternalServerError() *PutInvoicesInternalServerError { return &PutInvoicesInternalServerError{} } -/*PutInvoicesInternalServerError handles this case with default header values. +/* PutInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PutInvoicesInternalServerError struct { func (o *PutInvoicesInternalServerError) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *PutInvoicesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutInvoicesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/order/delete_order_parameters.go b/api/ops/ops_client/order/delete_order_parameters.go index a9bb56f..48dc16d 100644 --- a/api/ops/ops_client/order/delete_order_parameters.go +++ b/api/ops/ops_client/order/delete_order_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteOrderParams creates a new DeleteOrderParams object -// with the default values initialized. +// NewDeleteOrderParams creates a new DeleteOrderParams 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 NewDeleteOrderParams() *DeleteOrderParams { - var () return &DeleteOrderParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteOrderParamsWithTimeout creates a new DeleteOrderParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteOrderParamsWithTimeout(timeout time.Duration) *DeleteOrderParams { - var () return &DeleteOrderParams{ - timeout: timeout, } } // NewDeleteOrderParamsWithContext creates a new DeleteOrderParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteOrderParamsWithContext(ctx context.Context) *DeleteOrderParams { - var () return &DeleteOrderParams{ - Context: ctx, } } // NewDeleteOrderParamsWithHTTPClient creates a new DeleteOrderParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteOrderParamsWithHTTPClient(client *http.Client) *DeleteOrderParams { - var () return &DeleteOrderParams{ HTTPClient: client, } } -/*DeleteOrderParams contains all the parameters to send to the API endpoint -for the delete order operation typically these are written to a http.Request +/* DeleteOrderParams contains all the parameters to send to the API endpoint + for the delete order operation. + + Typically these are written to a http.Request. */ type DeleteOrderParams struct { - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + Taxnexus Id of the record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeleteOrderParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete order params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteOrderParams) WithDefaults() *DeleteOrderParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete order params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteOrderParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete order params func (o *DeleteOrderParams) WithTimeout(timeout time.Duration) *DeleteOrderParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteOrderParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/order/delete_order_responses.go b/api/ops/ops_client/order/delete_order_responses.go index b615a6c..5b74656 100644 --- a/api/ops/ops_client/order/delete_order_responses.go +++ b/api/ops/ops_client/order/delete_order_responses.go @@ -63,9 +63,8 @@ func (o *DeleteOrderReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteOrderOK() *DeleteOrderOK { return &DeleteOrderOK{} } -/*DeleteOrderOK handles this case with default header values. +/* DeleteOrderOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteOrderOK struct { func (o *DeleteOrderOK) Error() string { return fmt.Sprintf("[DELETE /orders][%d] deleteOrderOK %+v", 200, o.Payload) } - func (o *DeleteOrderOK) GetPayload() *ops_models.DeleteResponse { return o.Payload } func (o *DeleteOrderOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteOrderUnauthorized() *DeleteOrderUnauthorized { return &DeleteOrderUnauthorized{} } -/*DeleteOrderUnauthorized handles this case with default header values. +/* DeleteOrderUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteOrderUnauthorized struct { func (o *DeleteOrderUnauthorized) Error() string { return fmt.Sprintf("[DELETE /orders][%d] deleteOrderUnauthorized %+v", 401, o.Payload) } - func (o *DeleteOrderUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteOrderUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewDeleteOrderForbidden() *DeleteOrderForbidden { return &DeleteOrderForbidden{} } -/*DeleteOrderForbidden handles this case with default header values. +/* DeleteOrderForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteOrderForbidden struct { func (o *DeleteOrderForbidden) Error() string { return fmt.Sprintf("[DELETE /orders][%d] deleteOrderForbidden %+v", 403, o.Payload) } - func (o *DeleteOrderForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteOrderForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewDeleteOrderNotFound() *DeleteOrderNotFound { return &DeleteOrderNotFound{} } -/*DeleteOrderNotFound handles this case with default header values. +/* DeleteOrderNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteOrderNotFound struct { func (o *DeleteOrderNotFound) Error() string { return fmt.Sprintf("[DELETE /orders][%d] deleteOrderNotFound %+v", 404, o.Payload) } - func (o *DeleteOrderNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteOrderNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewDeleteOrderUnprocessableEntity() *DeleteOrderUnprocessableEntity { return &DeleteOrderUnprocessableEntity{} } -/*DeleteOrderUnprocessableEntity handles this case with default header values. +/* DeleteOrderUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteOrderUnprocessableEntity struct { func (o *DeleteOrderUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /orders][%d] deleteOrderUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteOrderUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteOrderUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewDeleteOrderInternalServerError() *DeleteOrderInternalServerError { return &DeleteOrderInternalServerError{} } -/*DeleteOrderInternalServerError handles this case with default header values. +/* DeleteOrderInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteOrderInternalServerError struct { func (o *DeleteOrderInternalServerError) Error() string { return fmt.Sprintf("[DELETE /orders][%d] deleteOrderInternalServerError %+v", 500, o.Payload) } - func (o *DeleteOrderInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteOrderInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/order/get_orders_parameters.go b/api/ops/ops_client/order/get_orders_parameters.go index 4e9a05f..9c665b6 100644 --- a/api/ops/ops_client/order/get_orders_parameters.go +++ b/api/ops/ops_client/order/get_orders_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetOrdersParams creates a new GetOrdersParams object -// with the default values initialized. +// NewGetOrdersParams creates a new GetOrdersParams 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 NewGetOrdersParams() *GetOrdersParams { - var () return &GetOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewGetOrdersParamsWithTimeout creates a new GetOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetOrdersParamsWithTimeout(timeout time.Duration) *GetOrdersParams { - var () return &GetOrdersParams{ - timeout: timeout, } } // NewGetOrdersParamsWithContext creates a new GetOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetOrdersParamsWithContext(ctx context.Context) *GetOrdersParams { - var () return &GetOrdersParams{ - Context: ctx, } } // NewGetOrdersParamsWithHTTPClient creates a new GetOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetOrdersParamsWithHTTPClient(client *http.Client) *GetOrdersParams { - var () return &GetOrdersParams{ HTTPClient: client, } } -/*GetOrdersParams contains all the parameters to send to the API endpoint -for the get orders operation typically these are written to a http.Request +/* GetOrdersParams contains all the parameters to send to the API endpoint + for the get orders operation. + + Typically these are written to a http.Request. */ type GetOrdersParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*OrderID - Taxnexus Record Id of an Order + /* OrderID. + + Taxnexus Record Id of an Order */ OrderID *string @@ -86,6 +91,21 @@ type GetOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOrdersParams) WithDefaults() *GetOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get orders params func (o *GetOrdersParams) WithTimeout(timeout time.Duration) *GetOrdersParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // 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 o.OrderID != nil { // query param orderId var qrOrderID string + if o.OrderID != nil { qrOrderID = *o.OrderID } qOrderID := qrOrderID if qOrderID != "" { + if err := r.SetQueryParam("orderId", qOrderID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/order/get_orders_responses.go b/api/ops/ops_client/order/get_orders_responses.go index 795aa71..1824d79 100644 --- a/api/ops/ops_client/order/get_orders_responses.go +++ b/api/ops/ops_client/order/get_orders_responses.go @@ -63,9 +63,8 @@ func (o *GetOrdersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetOrdersOK() *GetOrdersOK { return &GetOrdersOK{} } -/*GetOrdersOK handles this case with default header values. +/* GetOrdersOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Order objects */ type GetOrdersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.OrderResponse } @@ -89,18 +87,25 @@ type GetOrdersOK struct { func (o *GetOrdersOK) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersOK %+v", 200, o.Payload) } - func (o *GetOrdersOK) GetPayload() *ops_models.OrderResponse { return o.Payload } func (o *GetOrdersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.OrderResponse) @@ -117,7 +122,7 @@ func NewGetOrdersUnauthorized() *GetOrdersUnauthorized { return &GetOrdersUnauthorized{} } -/*GetOrdersUnauthorized handles this case with default header values. +/* GetOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetOrdersUnauthorized struct { func (o *GetOrdersUnauthorized) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersUnauthorized %+v", 401, o.Payload) } - func (o *GetOrdersUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetOrdersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetOrdersForbidden() *GetOrdersForbidden { return &GetOrdersForbidden{} } -/*GetOrdersForbidden handles this case with default header values. +/* GetOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetOrdersForbidden struct { func (o *GetOrdersForbidden) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersForbidden %+v", 403, o.Payload) } - func (o *GetOrdersForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetOrdersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetOrdersNotFound() *GetOrdersNotFound { return &GetOrdersNotFound{} } -/*GetOrdersNotFound handles this case with default header values. +/* GetOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetOrdersNotFound struct { func (o *GetOrdersNotFound) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersNotFound %+v", 404, o.Payload) } - func (o *GetOrdersNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetOrdersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetOrdersUnprocessableEntity() *GetOrdersUnprocessableEntity { return &GetOrdersUnprocessableEntity{} } -/*GetOrdersUnprocessableEntity handles this case with default header values. +/* GetOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetOrdersUnprocessableEntity struct { func (o *GetOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetOrdersUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetOrdersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetOrdersInternalServerError() *GetOrdersInternalServerError { return &GetOrdersInternalServerError{} } -/*GetOrdersInternalServerError handles this case with default header values. +/* GetOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetOrdersInternalServerError struct { func (o *GetOrdersInternalServerError) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersInternalServerError %+v", 500, o.Payload) } - func (o *GetOrdersInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetOrdersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/order/order_client.go b/api/ops/ops_client/order/order_client.go index fc13c74..d545009 100644 --- a/api/ops/ops_client/order/order_client.go +++ b/api/ops/ops_client/order/order_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteOrder(params *DeleteOrderParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteOrderOK, error) + DeleteOrder(params *DeleteOrderParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteOrderOK, error) - GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*GetOrdersOK, error) + GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrdersOK, error) - PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostOrdersOK, error) + PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOrdersOK, error) - PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PutOrdersOK, error) + PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutOrdersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete an order by ID */ -func (a *Client) DeleteOrder(params *DeleteOrderParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteOrderOK, error) { +func (a *Client) DeleteOrder(params *DeleteOrderParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteOrderOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteOrderParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteOrder", Method: "DELETE", PathPattern: "/orders", @@ -65,7 +67,12 @@ func (a *Client) DeleteOrder(params *DeleteOrderParams, authInfo runtime.ClientA 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteOrder(params *DeleteOrderParams, authInfo runtime.ClientA Return a list of Orders */ -func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*GetOrdersOK, error) { +func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getOrders", Method: "GET", PathPattern: "/orders", @@ -102,7 +108,12 @@ func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthI 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 } @@ -121,13 +132,12 @@ func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthI Create new Orders */ -func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostOrdersOK, error) { +func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postOrders", Method: "POST", PathPattern: "/orders", @@ -139,7 +149,12 @@ func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAut 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 } @@ -158,13 +173,12 @@ func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAut Update orders */ -func (a *Client) PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PutOrdersOK, error) { +func (a *Client) PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putOrders", Method: "PUT", PathPattern: "/orders", @@ -176,7 +190,12 @@ func (a *Client) PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/ops/ops_client/order/post_orders_parameters.go b/api/ops/ops_client/order/post_orders_parameters.go index 1033701..4ddbe4a 100644 --- a/api/ops/ops_client/order/post_orders_parameters.go +++ b/api/ops/ops_client/order/post_orders_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostOrdersParams creates a new PostOrdersParams object -// with the default values initialized. +// NewPostOrdersParams creates a new PostOrdersParams 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 NewPostOrdersParams() *PostOrdersParams { - var () return &PostOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewPostOrdersParamsWithTimeout creates a new PostOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostOrdersParamsWithTimeout(timeout time.Duration) *PostOrdersParams { - var () return &PostOrdersParams{ - timeout: timeout, } } // NewPostOrdersParamsWithContext creates a new PostOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostOrdersParamsWithContext(ctx context.Context) *PostOrdersParams { - var () return &PostOrdersParams{ - Context: ctx, } } // NewPostOrdersParamsWithHTTPClient creates a new PostOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostOrdersParamsWithHTTPClient(client *http.Client) *PostOrdersParams { - var () return &PostOrdersParams{ HTTPClient: client, } } -/*PostOrdersParams contains all the parameters to send to the API endpoint -for the post orders operation typically these are written to a http.Request +/* PostOrdersParams contains all the parameters to send to the API endpoint + for the post orders operation. + + Typically these are written to a http.Request. */ type PostOrdersParams struct { - /*OrderRequest - A request with an array of Order Objects + /* OrderRequest. + A request with an array of Order Objects */ OrderRequest *ops_models.OrderRequest @@ -77,6 +76,21 @@ type PostOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostOrdersParams) WithDefaults() *PostOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post orders params func (o *PostOrdersParams) WithTimeout(timeout time.Duration) *PostOrdersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.OrderRequest != nil { if err := r.SetBodyParam(o.OrderRequest); err != nil { return err diff --git a/api/ops/ops_client/order/post_orders_responses.go b/api/ops/ops_client/order/post_orders_responses.go index 887ad98..3c45a3c 100644 --- a/api/ops/ops_client/order/post_orders_responses.go +++ b/api/ops/ops_client/order/post_orders_responses.go @@ -63,9 +63,8 @@ func (o *PostOrdersReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostOrdersOK() *PostOrdersOK { return &PostOrdersOK{} } -/*PostOrdersOK handles this case with default header values. +/* PostOrdersOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Order objects */ type PostOrdersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.OrderResponse } @@ -89,18 +87,25 @@ type PostOrdersOK struct { func (o *PostOrdersOK) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersOK %+v", 200, o.Payload) } - func (o *PostOrdersOK) GetPayload() *ops_models.OrderResponse { return o.Payload } func (o *PostOrdersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.OrderResponse) @@ -117,7 +122,7 @@ func NewPostOrdersUnauthorized() *PostOrdersUnauthorized { return &PostOrdersUnauthorized{} } -/*PostOrdersUnauthorized handles this case with default header values. +/* PostOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostOrdersUnauthorized struct { func (o *PostOrdersUnauthorized) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersUnauthorized %+v", 401, o.Payload) } - func (o *PostOrdersUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostOrdersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostOrdersForbidden() *PostOrdersForbidden { return &PostOrdersForbidden{} } -/*PostOrdersForbidden handles this case with default header values. +/* PostOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostOrdersForbidden struct { func (o *PostOrdersForbidden) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersForbidden %+v", 403, o.Payload) } - func (o *PostOrdersForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostOrdersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostOrdersNotFound() *PostOrdersNotFound { return &PostOrdersNotFound{} } -/*PostOrdersNotFound handles this case with default header values. +/* PostOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostOrdersNotFound struct { func (o *PostOrdersNotFound) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersNotFound %+v", 404, o.Payload) } - func (o *PostOrdersNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostOrdersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostOrdersUnprocessableEntity() *PostOrdersUnprocessableEntity { return &PostOrdersUnprocessableEntity{} } -/*PostOrdersUnprocessableEntity handles this case with default header values. +/* PostOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostOrdersUnprocessableEntity struct { func (o *PostOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostOrdersUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostOrdersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostOrdersInternalServerError() *PostOrdersInternalServerError { return &PostOrdersInternalServerError{} } -/*PostOrdersInternalServerError handles this case with default header values. +/* PostOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostOrdersInternalServerError struct { func (o *PostOrdersInternalServerError) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersInternalServerError %+v", 500, o.Payload) } - func (o *PostOrdersInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostOrdersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/order/put_orders_parameters.go b/api/ops/ops_client/order/put_orders_parameters.go index c8d0005..e35eaff 100644 --- a/api/ops/ops_client/order/put_orders_parameters.go +++ b/api/ops/ops_client/order/put_orders_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutOrdersParams creates a new PutOrdersParams object -// with the default values initialized. +// NewPutOrdersParams creates a new PutOrdersParams 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 NewPutOrdersParams() *PutOrdersParams { - var () return &PutOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewPutOrdersParamsWithTimeout creates a new PutOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutOrdersParamsWithTimeout(timeout time.Duration) *PutOrdersParams { - var () return &PutOrdersParams{ - timeout: timeout, } } // NewPutOrdersParamsWithContext creates a new PutOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutOrdersParamsWithContext(ctx context.Context) *PutOrdersParams { - var () return &PutOrdersParams{ - Context: ctx, } } // NewPutOrdersParamsWithHTTPClient creates a new PutOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutOrdersParamsWithHTTPClient(client *http.Client) *PutOrdersParams { - var () return &PutOrdersParams{ HTTPClient: client, } } -/*PutOrdersParams contains all the parameters to send to the API endpoint -for the put orders operation typically these are written to a http.Request +/* PutOrdersParams contains all the parameters to send to the API endpoint + for the put orders operation. + + Typically these are written to a http.Request. */ type PutOrdersParams struct { - /*OrderRequest - A request with an array of Order Objects + /* OrderRequest. + A request with an array of Order Objects */ OrderRequest *ops_models.OrderRequest @@ -77,6 +76,21 @@ type PutOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutOrdersParams) WithDefaults() *PutOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put orders params func (o *PutOrdersParams) WithTimeout(timeout time.Duration) *PutOrdersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.OrderRequest != nil { if err := r.SetBodyParam(o.OrderRequest); err != nil { return err diff --git a/api/ops/ops_client/order/put_orders_responses.go b/api/ops/ops_client/order/put_orders_responses.go index d4fbba5..d827af2 100644 --- a/api/ops/ops_client/order/put_orders_responses.go +++ b/api/ops/ops_client/order/put_orders_responses.go @@ -63,9 +63,8 @@ func (o *PutOrdersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutOrdersOK() *PutOrdersOK { return &PutOrdersOK{} } -/*PutOrdersOK handles this case with default header values. +/* PutOrdersOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Message objects in response to a PUT */ @@ -87,15 +86,18 @@ type PutOrdersOK struct { func (o *PutOrdersOK) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersOK %+v", 200, o.Payload) } - func (o *PutOrdersOK) GetPayload() *ops_models.PutResponse { return o.Payload } func (o *PutOrdersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.PutResponse) @@ -112,7 +114,7 @@ func NewPutOrdersUnauthorized() *PutOrdersUnauthorized { return &PutOrdersUnauthorized{} } -/*PutOrdersUnauthorized handles this case with default header values. +/* PutOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PutOrdersUnauthorized struct { func (o *PutOrdersUnauthorized) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersUnauthorized %+v", 401, o.Payload) } - func (o *PutOrdersUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutOrdersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewPutOrdersForbidden() *PutOrdersForbidden { return &PutOrdersForbidden{} } -/*PutOrdersForbidden handles this case with default header values. +/* PutOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PutOrdersForbidden struct { func (o *PutOrdersForbidden) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersForbidden %+v", 403, o.Payload) } - func (o *PutOrdersForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutOrdersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewPutOrdersNotFound() *PutOrdersNotFound { return &PutOrdersNotFound{} } -/*PutOrdersNotFound handles this case with default header values. +/* PutOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PutOrdersNotFound struct { func (o *PutOrdersNotFound) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersNotFound %+v", 404, o.Payload) } - func (o *PutOrdersNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutOrdersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewPutOrdersUnprocessableEntity() *PutOrdersUnprocessableEntity { return &PutOrdersUnprocessableEntity{} } -/*PutOrdersUnprocessableEntity handles this case with default header values. +/* PutOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PutOrdersUnprocessableEntity struct { func (o *PutOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutOrdersUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutOrdersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewPutOrdersInternalServerError() *PutOrdersInternalServerError { return &PutOrdersInternalServerError{} } -/*PutOrdersInternalServerError handles this case with default header values. +/* PutOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PutOrdersInternalServerError struct { func (o *PutOrdersInternalServerError) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersInternalServerError %+v", 500, o.Payload) } - func (o *PutOrdersInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutOrdersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/payment_method/delete_payment_method_parameters.go b/api/ops/ops_client/payment_method/delete_payment_method_parameters.go index c0cb0e6..c4cc21b 100644 --- a/api/ops/ops_client/payment_method/delete_payment_method_parameters.go +++ b/api/ops/ops_client/payment_method/delete_payment_method_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeletePaymentMethodParams creates a new DeletePaymentMethodParams object -// with the default values initialized. +// NewDeletePaymentMethodParams creates a new DeletePaymentMethodParams 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 NewDeletePaymentMethodParams() *DeletePaymentMethodParams { - var () return &DeletePaymentMethodParams{ - timeout: cr.DefaultTimeout, } } // NewDeletePaymentMethodParamsWithTimeout creates a new DeletePaymentMethodParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeletePaymentMethodParamsWithTimeout(timeout time.Duration) *DeletePaymentMethodParams { - var () return &DeletePaymentMethodParams{ - timeout: timeout, } } // NewDeletePaymentMethodParamsWithContext creates a new DeletePaymentMethodParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeletePaymentMethodParamsWithContext(ctx context.Context) *DeletePaymentMethodParams { - var () return &DeletePaymentMethodParams{ - Context: ctx, } } // NewDeletePaymentMethodParamsWithHTTPClient creates a new DeletePaymentMethodParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeletePaymentMethodParamsWithHTTPClient(client *http.Client) *DeletePaymentMethodParams { - var () return &DeletePaymentMethodParams{ HTTPClient: client, } } -/*DeletePaymentMethodParams contains all the parameters to send to the API endpoint -for the delete payment method operation typically these are written to a http.Request +/* DeletePaymentMethodParams contains all the parameters to send to the API endpoint + for the delete payment method operation. + + Typically these are written to a http.Request. */ type DeletePaymentMethodParams struct { - /*PaymentMethodID - Taxnexus Record Id of a PaymentMethod + /* PaymentMethodID. + Taxnexus Record Id of a PaymentMethod */ PaymentMethodID *string @@ -75,6 +74,21 @@ type DeletePaymentMethodParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete payment method params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePaymentMethodParams) WithDefaults() *DeletePaymentMethodParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete payment method params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePaymentMethodParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete payment method params func (o *DeletePaymentMethodParams) WithTimeout(timeout time.Duration) *DeletePaymentMethodParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeletePaymentMethodParams) WriteToRequest(r runtime.ClientRequest, reg // query param paymentMethodId var qrPaymentMethodID string + if o.PaymentMethodID != nil { qrPaymentMethodID = *o.PaymentMethodID } qPaymentMethodID := qrPaymentMethodID if qPaymentMethodID != "" { + if err := r.SetQueryParam("paymentMethodId", qPaymentMethodID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/payment_method/delete_payment_method_responses.go b/api/ops/ops_client/payment_method/delete_payment_method_responses.go index acead9f..5668071 100644 --- a/api/ops/ops_client/payment_method/delete_payment_method_responses.go +++ b/api/ops/ops_client/payment_method/delete_payment_method_responses.go @@ -63,9 +63,8 @@ func (o *DeletePaymentMethodReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeletePaymentMethodOK() *DeletePaymentMethodOK { return &DeletePaymentMethodOK{} } -/*DeletePaymentMethodOK handles this case with default header values. +/* DeletePaymentMethodOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeletePaymentMethodOK struct { func (o *DeletePaymentMethodOK) Error() string { return fmt.Sprintf("[DELETE /paymentmethods][%d] deletePaymentMethodOK %+v", 200, o.Payload) } - func (o *DeletePaymentMethodOK) GetPayload() *ops_models.DeleteResponse { return o.Payload } func (o *DeletePaymentMethodOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeletePaymentMethodUnauthorized() *DeletePaymentMethodUnauthorized { return &DeletePaymentMethodUnauthorized{} } -/*DeletePaymentMethodUnauthorized handles this case with default header values. +/* DeletePaymentMethodUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeletePaymentMethodUnauthorized struct { func (o *DeletePaymentMethodUnauthorized) Error() string { return fmt.Sprintf("[DELETE /paymentmethods][%d] deletePaymentMethodUnauthorized %+v", 401, o.Payload) } - func (o *DeletePaymentMethodUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePaymentMethodUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewDeletePaymentMethodForbidden() *DeletePaymentMethodForbidden { return &DeletePaymentMethodForbidden{} } -/*DeletePaymentMethodForbidden handles this case with default header values. +/* DeletePaymentMethodForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeletePaymentMethodForbidden struct { func (o *DeletePaymentMethodForbidden) Error() string { return fmt.Sprintf("[DELETE /paymentmethods][%d] deletePaymentMethodForbidden %+v", 403, o.Payload) } - func (o *DeletePaymentMethodForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePaymentMethodForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewDeletePaymentMethodNotFound() *DeletePaymentMethodNotFound { return &DeletePaymentMethodNotFound{} } -/*DeletePaymentMethodNotFound handles this case with default header values. +/* DeletePaymentMethodNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeletePaymentMethodNotFound struct { func (o *DeletePaymentMethodNotFound) Error() string { return fmt.Sprintf("[DELETE /paymentmethods][%d] deletePaymentMethodNotFound %+v", 404, o.Payload) } - func (o *DeletePaymentMethodNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePaymentMethodNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewDeletePaymentMethodUnprocessableEntity() *DeletePaymentMethodUnprocessab return &DeletePaymentMethodUnprocessableEntity{} } -/*DeletePaymentMethodUnprocessableEntity handles this case with default header values. +/* DeletePaymentMethodUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeletePaymentMethodUnprocessableEntity struct { func (o *DeletePaymentMethodUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /paymentmethods][%d] deletePaymentMethodUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeletePaymentMethodUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePaymentMethodUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewDeletePaymentMethodInternalServerError() *DeletePaymentMethodInternalSer return &DeletePaymentMethodInternalServerError{} } -/*DeletePaymentMethodInternalServerError handles this case with default header values. +/* DeletePaymentMethodInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeletePaymentMethodInternalServerError struct { func (o *DeletePaymentMethodInternalServerError) Error() string { return fmt.Sprintf("[DELETE /paymentmethods][%d] deletePaymentMethodInternalServerError %+v", 500, o.Payload) } - func (o *DeletePaymentMethodInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePaymentMethodInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/payment_method/get_payment_methods_parameters.go b/api/ops/ops_client/payment_method/get_payment_methods_parameters.go index 07d3313..a1aa5d1 100644 --- a/api/ops/ops_client/payment_method/get_payment_methods_parameters.go +++ b/api/ops/ops_client/payment_method/get_payment_methods_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPaymentMethodsParams creates a new GetPaymentMethodsParams object -// with the default values initialized. +// NewGetPaymentMethodsParams creates a new GetPaymentMethodsParams 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 NewGetPaymentMethodsParams() *GetPaymentMethodsParams { - var () return &GetPaymentMethodsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPaymentMethodsParamsWithTimeout creates a new GetPaymentMethodsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPaymentMethodsParamsWithTimeout(timeout time.Duration) *GetPaymentMethodsParams { - var () return &GetPaymentMethodsParams{ - timeout: timeout, } } // NewGetPaymentMethodsParamsWithContext creates a new GetPaymentMethodsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPaymentMethodsParamsWithContext(ctx context.Context) *GetPaymentMethodsParams { - var () return &GetPaymentMethodsParams{ - Context: ctx, } } // NewGetPaymentMethodsParamsWithHTTPClient creates a new GetPaymentMethodsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPaymentMethodsParamsWithHTTPClient(client *http.Client) *GetPaymentMethodsParams { - var () return &GetPaymentMethodsParams{ HTTPClient: client, } } -/*GetPaymentMethodsParams contains all the parameters to send to the API endpoint -for the get payment methods operation typically these are written to a http.Request +/* GetPaymentMethodsParams contains all the parameters to send to the API endpoint + for the get payment methods operation. + + Typically these are written to a http.Request. */ type GetPaymentMethodsParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*PaymentMethodID - Taxnexus Record Id of a PaymentMethod + /* PaymentMethodID. + + Taxnexus Record Id of a PaymentMethod */ PaymentMethodID *string @@ -86,6 +91,21 @@ type GetPaymentMethodsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPaymentMethodsParams) WithDefaults() *GetPaymentMethodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPaymentMethodsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get payment methods params func (o *GetPaymentMethodsParams) WithTimeout(timeout time.Duration) *GetPaymentMethodsParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetPaymentMethodsParams) WriteToRequest(r runtime.ClientRequest, reg st // 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 o.PaymentMethodID != nil { // query param paymentMethodId var qrPaymentMethodID string + if o.PaymentMethodID != nil { qrPaymentMethodID = *o.PaymentMethodID } qPaymentMethodID := qrPaymentMethodID if qPaymentMethodID != "" { + if err := r.SetQueryParam("paymentMethodId", qPaymentMethodID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/payment_method/get_payment_methods_responses.go b/api/ops/ops_client/payment_method/get_payment_methods_responses.go index 60508fb..29d7a47 100644 --- a/api/ops/ops_client/payment_method/get_payment_methods_responses.go +++ b/api/ops/ops_client/payment_method/get_payment_methods_responses.go @@ -63,9 +63,8 @@ func (o *GetPaymentMethodsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetPaymentMethodsOK() *GetPaymentMethodsOK { return &GetPaymentMethodsOK{} } -/*GetPaymentMethodsOK handles this case with default header values. +/* GetPaymentMethodsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Payment Method objects */ type GetPaymentMethodsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.PaymentMethodResponse } @@ -89,18 +87,25 @@ type GetPaymentMethodsOK struct { func (o *GetPaymentMethodsOK) Error() string { return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsOK %+v", 200, o.Payload) } - func (o *GetPaymentMethodsOK) GetPayload() *ops_models.PaymentMethodResponse { return o.Payload } func (o *GetPaymentMethodsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.PaymentMethodResponse) @@ -117,7 +122,7 @@ func NewGetPaymentMethodsUnauthorized() *GetPaymentMethodsUnauthorized { return &GetPaymentMethodsUnauthorized{} } -/*GetPaymentMethodsUnauthorized handles this case with default header values. +/* GetPaymentMethodsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetPaymentMethodsUnauthorized struct { func (o *GetPaymentMethodsUnauthorized) Error() string { return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsUnauthorized %+v", 401, o.Payload) } - func (o *GetPaymentMethodsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPaymentMethodsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetPaymentMethodsForbidden() *GetPaymentMethodsForbidden { return &GetPaymentMethodsForbidden{} } -/*GetPaymentMethodsForbidden handles this case with default header values. +/* GetPaymentMethodsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetPaymentMethodsForbidden struct { func (o *GetPaymentMethodsForbidden) Error() string { return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsForbidden %+v", 403, o.Payload) } - func (o *GetPaymentMethodsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPaymentMethodsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetPaymentMethodsNotFound() *GetPaymentMethodsNotFound { return &GetPaymentMethodsNotFound{} } -/*GetPaymentMethodsNotFound handles this case with default header values. +/* GetPaymentMethodsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetPaymentMethodsNotFound struct { func (o *GetPaymentMethodsNotFound) Error() string { return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsNotFound %+v", 404, o.Payload) } - func (o *GetPaymentMethodsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPaymentMethodsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetPaymentMethodsUnprocessableEntity() *GetPaymentMethodsUnprocessableEn return &GetPaymentMethodsUnprocessableEntity{} } -/*GetPaymentMethodsUnprocessableEntity handles this case with default header values. +/* GetPaymentMethodsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetPaymentMethodsUnprocessableEntity struct { func (o *GetPaymentMethodsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPaymentMethodsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPaymentMethodsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetPaymentMethodsInternalServerError() *GetPaymentMethodsInternalServerE return &GetPaymentMethodsInternalServerError{} } -/*GetPaymentMethodsInternalServerError handles this case with default header values. +/* GetPaymentMethodsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetPaymentMethodsInternalServerError struct { func (o *GetPaymentMethodsInternalServerError) Error() string { return fmt.Sprintf("[GET /paymentmethods][%d] getPaymentMethodsInternalServerError %+v", 500, o.Payload) } - func (o *GetPaymentMethodsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPaymentMethodsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/payment_method/payment_method_client.go b/api/ops/ops_client/payment_method/payment_method_client.go index f1a48b1..52e2481 100644 --- a/api/ops/ops_client/payment_method/payment_method_client.go +++ b/api/ops/ops_client/payment_method/payment_method_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeletePaymentMethod(params *DeletePaymentMethodParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePaymentMethodOK, error) + DeletePaymentMethod(params *DeletePaymentMethodParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePaymentMethodOK, error) - GetPaymentMethods(params *GetPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPaymentMethodsOK, error) + GetPaymentMethods(params *GetPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPaymentMethodsOK, error) - PostPaymentMethods(params *PostPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPaymentMethodsOK, error) + PostPaymentMethods(params *PostPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPaymentMethodsOK, error) - PutPaymentMethods(params *PutPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*PutPaymentMethodsOK, error) + PutPaymentMethods(params *PutPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPaymentMethodsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete a PaymentMethod by ID */ -func (a *Client) DeletePaymentMethod(params *DeletePaymentMethodParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePaymentMethodOK, error) { +func (a *Client) DeletePaymentMethod(params *DeletePaymentMethodParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePaymentMethodOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeletePaymentMethodParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deletePaymentMethod", Method: "DELETE", PathPattern: "/paymentmethods", @@ -65,7 +67,12 @@ func (a *Client) DeletePaymentMethod(params *DeletePaymentMethodParams, authInfo 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 } @@ -84,13 +91,12 @@ func (a *Client) DeletePaymentMethod(params *DeletePaymentMethodParams, authInfo Return a list of available Taxnexus PaymentMethods */ -func (a *Client) GetPaymentMethods(params *GetPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPaymentMethodsOK, error) { +func (a *Client) GetPaymentMethods(params *GetPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPaymentMethodsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPaymentMethodsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPaymentMethods", Method: "GET", PathPattern: "/paymentmethods", @@ -102,7 +108,12 @@ func (a *Client) GetPaymentMethods(params *GetPaymentMethodsParams, authInfo run 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 } @@ -121,13 +132,12 @@ func (a *Client) GetPaymentMethods(params *GetPaymentMethodsParams, authInfo run Create New PaymentMethods */ -func (a *Client) PostPaymentMethods(params *PostPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPaymentMethodsOK, error) { +func (a *Client) PostPaymentMethods(params *PostPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPaymentMethodsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPaymentMethodsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPaymentMethods", Method: "POST", PathPattern: "/paymentmethods", @@ -139,7 +149,12 @@ func (a *Client) PostPaymentMethods(params *PostPaymentMethodsParams, authInfo r 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 } @@ -158,13 +173,12 @@ func (a *Client) PostPaymentMethods(params *PostPaymentMethodsParams, authInfo r Put a list of PaymentMethods */ -func (a *Client) PutPaymentMethods(params *PutPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter) (*PutPaymentMethodsOK, error) { +func (a *Client) PutPaymentMethods(params *PutPaymentMethodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPaymentMethodsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutPaymentMethodsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putPaymentMethods", Method: "PUT", PathPattern: "/paymentmethods", @@ -176,7 +190,12 @@ func (a *Client) PutPaymentMethods(params *PutPaymentMethodsParams, authInfo run 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 } diff --git a/api/ops/ops_client/payment_method/post_payment_methods_parameters.go b/api/ops/ops_client/payment_method/post_payment_methods_parameters.go index 090f2f0..944af01 100644 --- a/api/ops/ops_client/payment_method/post_payment_methods_parameters.go +++ b/api/ops/ops_client/payment_method/post_payment_methods_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostPaymentMethodsParams creates a new PostPaymentMethodsParams object -// with the default values initialized. +// NewPostPaymentMethodsParams creates a new PostPaymentMethodsParams 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 NewPostPaymentMethodsParams() *PostPaymentMethodsParams { - var () return &PostPaymentMethodsParams{ - timeout: cr.DefaultTimeout, } } // NewPostPaymentMethodsParamsWithTimeout creates a new PostPaymentMethodsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPaymentMethodsParamsWithTimeout(timeout time.Duration) *PostPaymentMethodsParams { - var () return &PostPaymentMethodsParams{ - timeout: timeout, } } // NewPostPaymentMethodsParamsWithContext creates a new PostPaymentMethodsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPaymentMethodsParamsWithContext(ctx context.Context) *PostPaymentMethodsParams { - var () return &PostPaymentMethodsParams{ - Context: ctx, } } // NewPostPaymentMethodsParamsWithHTTPClient creates a new PostPaymentMethodsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPaymentMethodsParamsWithHTTPClient(client *http.Client) *PostPaymentMethodsParams { - var () return &PostPaymentMethodsParams{ HTTPClient: client, } } -/*PostPaymentMethodsParams contains all the parameters to send to the API endpoint -for the post payment methods operation typically these are written to a http.Request +/* PostPaymentMethodsParams contains all the parameters to send to the API endpoint + for the post payment methods operation. + + Typically these are written to a http.Request. */ type PostPaymentMethodsParams struct { - /*PaymentMethodRequest - A request with an array of Purchase Order Objects + /* PaymentMethodRequest. + A request with an array of Purchase Order Objects */ PaymentMethodRequest *ops_models.PaymentMethodRequest @@ -77,6 +76,21 @@ type PostPaymentMethodsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPaymentMethodsParams) WithDefaults() *PostPaymentMethodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPaymentMethodsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post payment methods params func (o *PostPaymentMethodsParams) WithTimeout(timeout time.Duration) *PostPaymentMethodsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPaymentMethodsParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if o.PaymentMethodRequest != nil { if err := r.SetBodyParam(o.PaymentMethodRequest); err != nil { return err diff --git a/api/ops/ops_client/payment_method/post_payment_methods_responses.go b/api/ops/ops_client/payment_method/post_payment_methods_responses.go index 75cb72e..ea5fae8 100644 --- a/api/ops/ops_client/payment_method/post_payment_methods_responses.go +++ b/api/ops/ops_client/payment_method/post_payment_methods_responses.go @@ -63,9 +63,8 @@ func (o *PostPaymentMethodsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostPaymentMethodsOK() *PostPaymentMethodsOK { return &PostPaymentMethodsOK{} } -/*PostPaymentMethodsOK handles this case with default header values. +/* PostPaymentMethodsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Payment Method objects */ type PostPaymentMethodsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.PaymentMethodResponse } @@ -89,18 +87,25 @@ type PostPaymentMethodsOK struct { func (o *PostPaymentMethodsOK) Error() string { return fmt.Sprintf("[POST /paymentmethods][%d] postPaymentMethodsOK %+v", 200, o.Payload) } - func (o *PostPaymentMethodsOK) GetPayload() *ops_models.PaymentMethodResponse { return o.Payload } func (o *PostPaymentMethodsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.PaymentMethodResponse) @@ -117,7 +122,7 @@ func NewPostPaymentMethodsUnauthorized() *PostPaymentMethodsUnauthorized { return &PostPaymentMethodsUnauthorized{} } -/*PostPaymentMethodsUnauthorized handles this case with default header values. +/* PostPaymentMethodsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostPaymentMethodsUnauthorized struct { func (o *PostPaymentMethodsUnauthorized) Error() string { return fmt.Sprintf("[POST /paymentmethods][%d] postPaymentMethodsUnauthorized %+v", 401, o.Payload) } - func (o *PostPaymentMethodsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPaymentMethodsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostPaymentMethodsForbidden() *PostPaymentMethodsForbidden { return &PostPaymentMethodsForbidden{} } -/*PostPaymentMethodsForbidden handles this case with default header values. +/* PostPaymentMethodsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostPaymentMethodsForbidden struct { func (o *PostPaymentMethodsForbidden) Error() string { return fmt.Sprintf("[POST /paymentmethods][%d] postPaymentMethodsForbidden %+v", 403, o.Payload) } - func (o *PostPaymentMethodsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPaymentMethodsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostPaymentMethodsNotFound() *PostPaymentMethodsNotFound { return &PostPaymentMethodsNotFound{} } -/*PostPaymentMethodsNotFound handles this case with default header values. +/* PostPaymentMethodsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostPaymentMethodsNotFound struct { func (o *PostPaymentMethodsNotFound) Error() string { return fmt.Sprintf("[POST /paymentmethods][%d] postPaymentMethodsNotFound %+v", 404, o.Payload) } - func (o *PostPaymentMethodsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPaymentMethodsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostPaymentMethodsUnprocessableEntity() *PostPaymentMethodsUnprocessable return &PostPaymentMethodsUnprocessableEntity{} } -/*PostPaymentMethodsUnprocessableEntity handles this case with default header values. +/* PostPaymentMethodsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostPaymentMethodsUnprocessableEntity struct { func (o *PostPaymentMethodsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /paymentmethods][%d] postPaymentMethodsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostPaymentMethodsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPaymentMethodsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostPaymentMethodsInternalServerError() *PostPaymentMethodsInternalServe return &PostPaymentMethodsInternalServerError{} } -/*PostPaymentMethodsInternalServerError handles this case with default header values. +/* PostPaymentMethodsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostPaymentMethodsInternalServerError struct { func (o *PostPaymentMethodsInternalServerError) Error() string { return fmt.Sprintf("[POST /paymentmethods][%d] postPaymentMethodsInternalServerError %+v", 500, o.Payload) } - func (o *PostPaymentMethodsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPaymentMethodsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/payment_method/put_payment_methods_parameters.go b/api/ops/ops_client/payment_method/put_payment_methods_parameters.go index 631c009..f7fb987 100644 --- a/api/ops/ops_client/payment_method/put_payment_methods_parameters.go +++ b/api/ops/ops_client/payment_method/put_payment_methods_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutPaymentMethodsParams creates a new PutPaymentMethodsParams object -// with the default values initialized. +// NewPutPaymentMethodsParams creates a new PutPaymentMethodsParams 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 NewPutPaymentMethodsParams() *PutPaymentMethodsParams { - var () return &PutPaymentMethodsParams{ - timeout: cr.DefaultTimeout, } } // NewPutPaymentMethodsParamsWithTimeout creates a new PutPaymentMethodsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutPaymentMethodsParamsWithTimeout(timeout time.Duration) *PutPaymentMethodsParams { - var () return &PutPaymentMethodsParams{ - timeout: timeout, } } // NewPutPaymentMethodsParamsWithContext creates a new PutPaymentMethodsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutPaymentMethodsParamsWithContext(ctx context.Context) *PutPaymentMethodsParams { - var () return &PutPaymentMethodsParams{ - Context: ctx, } } // NewPutPaymentMethodsParamsWithHTTPClient creates a new PutPaymentMethodsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutPaymentMethodsParamsWithHTTPClient(client *http.Client) *PutPaymentMethodsParams { - var () return &PutPaymentMethodsParams{ HTTPClient: client, } } -/*PutPaymentMethodsParams contains all the parameters to send to the API endpoint -for the put payment methods operation typically these are written to a http.Request +/* PutPaymentMethodsParams contains all the parameters to send to the API endpoint + for the put payment methods operation. + + Typically these are written to a http.Request. */ type PutPaymentMethodsParams struct { - /*PaymentMethodRequest - A request with an array of Purchase Order Objects + /* PaymentMethodRequest. + A request with an array of Purchase Order Objects */ PaymentMethodRequest *ops_models.PaymentMethodRequest @@ -77,6 +76,21 @@ type PutPaymentMethodsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPaymentMethodsParams) WithDefaults() *PutPaymentMethodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPaymentMethodsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put payment methods params func (o *PutPaymentMethodsParams) WithTimeout(timeout time.Duration) *PutPaymentMethodsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutPaymentMethodsParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.PaymentMethodRequest != nil { if err := r.SetBodyParam(o.PaymentMethodRequest); err != nil { return err diff --git a/api/ops/ops_client/payment_method/put_payment_methods_responses.go b/api/ops/ops_client/payment_method/put_payment_methods_responses.go index 10ecde3..422531c 100644 --- a/api/ops/ops_client/payment_method/put_payment_methods_responses.go +++ b/api/ops/ops_client/payment_method/put_payment_methods_responses.go @@ -63,9 +63,8 @@ func (o *PutPaymentMethodsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutPaymentMethodsOK() *PutPaymentMethodsOK { return &PutPaymentMethodsOK{} } -/*PutPaymentMethodsOK handles this case with default header values. +/* PutPaymentMethodsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Message objects in response to a PUT */ @@ -87,15 +86,18 @@ type PutPaymentMethodsOK struct { func (o *PutPaymentMethodsOK) Error() string { return fmt.Sprintf("[PUT /paymentmethods][%d] putPaymentMethodsOK %+v", 200, o.Payload) } - func (o *PutPaymentMethodsOK) GetPayload() *ops_models.PutResponse { return o.Payload } func (o *PutPaymentMethodsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.PutResponse) @@ -112,7 +114,7 @@ func NewPutPaymentMethodsUnauthorized() *PutPaymentMethodsUnauthorized { return &PutPaymentMethodsUnauthorized{} } -/*PutPaymentMethodsUnauthorized handles this case with default header values. +/* PutPaymentMethodsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PutPaymentMethodsUnauthorized struct { func (o *PutPaymentMethodsUnauthorized) Error() string { return fmt.Sprintf("[PUT /paymentmethods][%d] putPaymentMethodsUnauthorized %+v", 401, o.Payload) } - func (o *PutPaymentMethodsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPaymentMethodsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewPutPaymentMethodsForbidden() *PutPaymentMethodsForbidden { return &PutPaymentMethodsForbidden{} } -/*PutPaymentMethodsForbidden handles this case with default header values. +/* PutPaymentMethodsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PutPaymentMethodsForbidden struct { func (o *PutPaymentMethodsForbidden) Error() string { return fmt.Sprintf("[PUT /paymentmethods][%d] putPaymentMethodsForbidden %+v", 403, o.Payload) } - func (o *PutPaymentMethodsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPaymentMethodsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewPutPaymentMethodsNotFound() *PutPaymentMethodsNotFound { return &PutPaymentMethodsNotFound{} } -/*PutPaymentMethodsNotFound handles this case with default header values. +/* PutPaymentMethodsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PutPaymentMethodsNotFound struct { func (o *PutPaymentMethodsNotFound) Error() string { return fmt.Sprintf("[PUT /paymentmethods][%d] putPaymentMethodsNotFound %+v", 404, o.Payload) } - func (o *PutPaymentMethodsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPaymentMethodsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewPutPaymentMethodsUnprocessableEntity() *PutPaymentMethodsUnprocessableEn return &PutPaymentMethodsUnprocessableEntity{} } -/*PutPaymentMethodsUnprocessableEntity handles this case with default header values. +/* PutPaymentMethodsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PutPaymentMethodsUnprocessableEntity struct { func (o *PutPaymentMethodsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /paymentmethods][%d] putPaymentMethodsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutPaymentMethodsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPaymentMethodsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewPutPaymentMethodsInternalServerError() *PutPaymentMethodsInternalServerE return &PutPaymentMethodsInternalServerError{} } -/*PutPaymentMethodsInternalServerError handles this case with default header values. +/* PutPaymentMethodsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PutPaymentMethodsInternalServerError struct { func (o *PutPaymentMethodsInternalServerError) Error() string { return fmt.Sprintf("[PUT /paymentmethods][%d] putPaymentMethodsInternalServerError %+v", 500, o.Payload) } - func (o *PutPaymentMethodsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPaymentMethodsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/product/delete_product_parameters.go b/api/ops/ops_client/product/delete_product_parameters.go index c8e9815..a08981e 100644 --- a/api/ops/ops_client/product/delete_product_parameters.go +++ b/api/ops/ops_client/product/delete_product_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteProductParams creates a new DeleteProductParams object -// with the default values initialized. +// NewDeleteProductParams creates a new DeleteProductParams 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 NewDeleteProductParams() *DeleteProductParams { - var () return &DeleteProductParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteProductParamsWithTimeout creates a new DeleteProductParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteProductParamsWithTimeout(timeout time.Duration) *DeleteProductParams { - var () return &DeleteProductParams{ - timeout: timeout, } } // NewDeleteProductParamsWithContext creates a new DeleteProductParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteProductParamsWithContext(ctx context.Context) *DeleteProductParams { - var () return &DeleteProductParams{ - Context: ctx, } } // NewDeleteProductParamsWithHTTPClient creates a new DeleteProductParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteProductParamsWithHTTPClient(client *http.Client) *DeleteProductParams { - var () return &DeleteProductParams{ HTTPClient: client, } } -/*DeleteProductParams contains all the parameters to send to the API endpoint -for the delete product operation typically these are written to a http.Request +/* DeleteProductParams contains all the parameters to send to the API endpoint + for the delete product operation. + + Typically these are written to a http.Request. */ type DeleteProductParams struct { - /*ProductID - Taxnexus Record Id of a Product + /* ProductID. + Taxnexus Record Id of a Product */ ProductID *string @@ -75,6 +74,21 @@ type DeleteProductParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete product params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteProductParams) WithDefaults() *DeleteProductParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete product params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteProductParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete product params func (o *DeleteProductParams) WithTimeout(timeout time.Duration) *DeleteProductParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteProductParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // query param productId var qrProductID string + if o.ProductID != nil { qrProductID = *o.ProductID } qProductID := qrProductID if qProductID != "" { + if err := r.SetQueryParam("productId", qProductID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/product/delete_product_responses.go b/api/ops/ops_client/product/delete_product_responses.go index dc19c77..1b0ce26 100644 --- a/api/ops/ops_client/product/delete_product_responses.go +++ b/api/ops/ops_client/product/delete_product_responses.go @@ -63,9 +63,8 @@ func (o *DeleteProductReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewDeleteProductOK() *DeleteProductOK { return &DeleteProductOK{} } -/*DeleteProductOK handles this case with default header values. +/* DeleteProductOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Product objects */ type DeleteProductOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.ProductResponse } @@ -89,18 +87,25 @@ type DeleteProductOK struct { func (o *DeleteProductOK) Error() string { return fmt.Sprintf("[DELETE /products][%d] deleteProductOK %+v", 200, o.Payload) } - func (o *DeleteProductOK) GetPayload() *ops_models.ProductResponse { return o.Payload } func (o *DeleteProductOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.ProductResponse) @@ -117,7 +122,7 @@ func NewDeleteProductUnauthorized() *DeleteProductUnauthorized { return &DeleteProductUnauthorized{} } -/*DeleteProductUnauthorized handles this case with default header values. +/* DeleteProductUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type DeleteProductUnauthorized struct { func (o *DeleteProductUnauthorized) Error() string { return fmt.Sprintf("[DELETE /products][%d] deleteProductUnauthorized %+v", 401, o.Payload) } - func (o *DeleteProductUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteProductUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewDeleteProductForbidden() *DeleteProductForbidden { return &DeleteProductForbidden{} } -/*DeleteProductForbidden handles this case with default header values. +/* DeleteProductForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type DeleteProductForbidden struct { func (o *DeleteProductForbidden) Error() string { return fmt.Sprintf("[DELETE /products][%d] deleteProductForbidden %+v", 403, o.Payload) } - func (o *DeleteProductForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteProductForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewDeleteProductNotFound() *DeleteProductNotFound { return &DeleteProductNotFound{} } -/*DeleteProductNotFound handles this case with default header values. +/* DeleteProductNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type DeleteProductNotFound struct { func (o *DeleteProductNotFound) Error() string { return fmt.Sprintf("[DELETE /products][%d] deleteProductNotFound %+v", 404, o.Payload) } - func (o *DeleteProductNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteProductNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewDeleteProductUnprocessableEntity() *DeleteProductUnprocessableEntity { return &DeleteProductUnprocessableEntity{} } -/*DeleteProductUnprocessableEntity handles this case with default header values. +/* DeleteProductUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type DeleteProductUnprocessableEntity struct { func (o *DeleteProductUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /products][%d] deleteProductUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteProductUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteProductUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewDeleteProductInternalServerError() *DeleteProductInternalServerError { return &DeleteProductInternalServerError{} } -/*DeleteProductInternalServerError handles this case with default header values. +/* DeleteProductInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type DeleteProductInternalServerError struct { func (o *DeleteProductInternalServerError) Error() string { return fmt.Sprintf("[DELETE /products][%d] deleteProductInternalServerError %+v", 500, o.Payload) } - func (o *DeleteProductInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteProductInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/product/get_products_observable_parameters.go b/api/ops/ops_client/product/get_products_observable_parameters.go index 622a728..aa01418 100644 --- a/api/ops/ops_client/product/get_products_observable_parameters.go +++ b/api/ops/ops_client/product/get_products_observable_parameters.go @@ -21,68 +21,70 @@ import ( "github.com/go-openapi/swag" ) -// NewGetProductsObservableParams creates a new GetProductsObservableParams object -// with the default values initialized. +// NewGetProductsObservableParams creates a new GetProductsObservableParams 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 NewGetProductsObservableParams() *GetProductsObservableParams { - var () return &GetProductsObservableParams{ - timeout: cr.DefaultTimeout, } } // NewGetProductsObservableParamsWithTimeout creates a new GetProductsObservableParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetProductsObservableParamsWithTimeout(timeout time.Duration) *GetProductsObservableParams { - var () return &GetProductsObservableParams{ - timeout: timeout, } } // NewGetProductsObservableParamsWithContext creates a new GetProductsObservableParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetProductsObservableParamsWithContext(ctx context.Context) *GetProductsObservableParams { - var () return &GetProductsObservableParams{ - Context: ctx, } } // NewGetProductsObservableParamsWithHTTPClient creates a new GetProductsObservableParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetProductsObservableParamsWithHTTPClient(client *http.Client) *GetProductsObservableParams { - var () return &GetProductsObservableParams{ HTTPClient: client, } } -/*GetProductsObservableParams contains all the parameters to send to the API endpoint -for the get products observable operation typically these are written to a http.Request +/* GetProductsObservableParams contains all the parameters to send to the API endpoint + for the get products observable operation. + + Typically these are written to a http.Request. */ type GetProductsObservableParams struct { - /*Active - Retrieve active records? + /* Active. + Retrieve active records? */ Active *bool - /*ProductCode - Product Code of a Product + /* ProductCode. + + Product Code of a Product */ ProductCode *string - /*ProductID - Taxnexus Record Id of a Product + /* ProductID. + + Taxnexus Record Id of a Product */ ProductID *string - /*Publish - Is this product published? + /* Publish. + + Is this product published? */ Publish *bool @@ -91,6 +93,21 @@ type GetProductsObservableParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get products observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsObservableParams) WithDefaults() *GetProductsObservableParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get products observable params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsObservableParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get products observable params func (o *GetProductsObservableParams) WithTimeout(timeout time.Duration) *GetProductsObservableParams { o.SetTimeout(timeout) @@ -180,64 +197,68 @@ func (o *GetProductsObservableParams) WriteToRequest(r runtime.ClientRequest, re // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.ProductCode != nil { // query param productCode var qrProductCode string + if o.ProductCode != nil { qrProductCode = *o.ProductCode } qProductCode := qrProductCode if qProductCode != "" { + if err := r.SetQueryParam("productCode", qProductCode); err != nil { return err } } - } if o.ProductID != nil { // query param productId var qrProductID string + if o.ProductID != nil { qrProductID = *o.ProductID } qProductID := qrProductID if qProductID != "" { + if err := r.SetQueryParam("productId", qProductID); err != nil { return err } } - } if o.Publish != nil { // query param publish var qrPublish bool + if o.Publish != nil { qrPublish = *o.Publish } qPublish := swag.FormatBool(qrPublish) if qPublish != "" { + if err := r.SetQueryParam("publish", qPublish); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/product/get_products_observable_responses.go b/api/ops/ops_client/product/get_products_observable_responses.go index ca681d0..f0b1f1c 100644 --- a/api/ops/ops_client/product/get_products_observable_responses.go +++ b/api/ops/ops_client/product/get_products_observable_responses.go @@ -63,9 +63,8 @@ func (o *GetProductsObservableReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetProductsObservableOK() *GetProductsObservableOK { return &GetProductsObservableOK{} } -/*GetProductsObservableOK handles this case with default header values. +/* GetProductsObservableOK describes a response with status code 200, with default header values. Simple array of products */ type GetProductsObservableOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload []*ops_models.Product } @@ -89,18 +87,25 @@ type GetProductsObservableOK struct { func (o *GetProductsObservableOK) Error() string { return fmt.Sprintf("[GET /products/observable][%d] getProductsObservableOK %+v", 200, o.Payload) } - func (o *GetProductsObservableOK) GetPayload() []*ops_models.Product { return o.Payload } func (o *GetProductsObservableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + 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 { @@ -115,7 +120,7 @@ func NewGetProductsObservableUnauthorized() *GetProductsObservableUnauthorized { return &GetProductsObservableUnauthorized{} } -/*GetProductsObservableUnauthorized handles this case with default header values. +/* GetProductsObservableUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -128,15 +133,18 @@ type GetProductsObservableUnauthorized struct { func (o *GetProductsObservableUnauthorized) Error() string { return fmt.Sprintf("[GET /products/observable][%d] getProductsObservableUnauthorized %+v", 401, o.Payload) } - func (o *GetProductsObservableUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsObservableUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -153,7 +161,7 @@ func NewGetProductsObservableForbidden() *GetProductsObservableForbidden { return &GetProductsObservableForbidden{} } -/*GetProductsObservableForbidden handles this case with default header values. +/* GetProductsObservableForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -166,15 +174,18 @@ type GetProductsObservableForbidden struct { func (o *GetProductsObservableForbidden) Error() string { return fmt.Sprintf("[GET /products/observable][%d] getProductsObservableForbidden %+v", 403, o.Payload) } - func (o *GetProductsObservableForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsObservableForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -191,7 +202,7 @@ func NewGetProductsObservableNotFound() *GetProductsObservableNotFound { return &GetProductsObservableNotFound{} } -/*GetProductsObservableNotFound handles this case with default header values. +/* GetProductsObservableNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -204,15 +215,18 @@ type GetProductsObservableNotFound struct { func (o *GetProductsObservableNotFound) Error() string { return fmt.Sprintf("[GET /products/observable][%d] getProductsObservableNotFound %+v", 404, o.Payload) } - func (o *GetProductsObservableNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsObservableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -229,7 +243,7 @@ func NewGetProductsObservableUnprocessableEntity() *GetProductsObservableUnproce return &GetProductsObservableUnprocessableEntity{} } -/*GetProductsObservableUnprocessableEntity handles this case with default header values. +/* GetProductsObservableUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -242,15 +256,18 @@ type GetProductsObservableUnprocessableEntity struct { func (o *GetProductsObservableUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /products/observable][%d] getProductsObservableUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetProductsObservableUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsObservableUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -267,7 +284,7 @@ func NewGetProductsObservableInternalServerError() *GetProductsObservableInterna return &GetProductsObservableInternalServerError{} } -/*GetProductsObservableInternalServerError handles this case with default header values. +/* GetProductsObservableInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -280,15 +297,18 @@ type GetProductsObservableInternalServerError struct { func (o *GetProductsObservableInternalServerError) Error() string { return fmt.Sprintf("[GET /products/observable][%d] getProductsObservableInternalServerError %+v", 500, o.Payload) } - func (o *GetProductsObservableInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsObservableInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/product/get_products_parameters.go b/api/ops/ops_client/product/get_products_parameters.go index 8e9e271..28d5c66 100644 --- a/api/ops/ops_client/product/get_products_parameters.go +++ b/api/ops/ops_client/product/get_products_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetProductsParams creates a new GetProductsParams object -// with the default values initialized. +// NewGetProductsParams creates a new GetProductsParams 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 NewGetProductsParams() *GetProductsParams { - var () return &GetProductsParams{ - timeout: cr.DefaultTimeout, } } // NewGetProductsParamsWithTimeout creates a new GetProductsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetProductsParamsWithTimeout(timeout time.Duration) *GetProductsParams { - var () return &GetProductsParams{ - timeout: timeout, } } // NewGetProductsParamsWithContext creates a new GetProductsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetProductsParamsWithContext(ctx context.Context) *GetProductsParams { - var () return &GetProductsParams{ - Context: ctx, } } // NewGetProductsParamsWithHTTPClient creates a new GetProductsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetProductsParamsWithHTTPClient(client *http.Client) *GetProductsParams { - var () return &GetProductsParams{ HTTPClient: client, } } -/*GetProductsParams contains all the parameters to send to the API endpoint -for the get products operation typically these are written to a http.Request +/* GetProductsParams contains all the parameters to send to the API endpoint + for the get products operation. + + Typically these are written to a http.Request. */ type GetProductsParams struct { - /*Active - Retrieve active records? + /* Active. + Retrieve active records? */ Active *bool - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*ProductCode - Product Code of a Product + /* ProductCode. + + Product Code of a Product */ ProductCode *string - /*ProductID - Taxnexus Record Id of a Product + /* ProductID. + + Taxnexus Record Id of a Product */ ProductID *string - /*Publish - Is this product published? + /* Publish. + + Is this product published? */ Publish *bool @@ -101,6 +109,21 @@ type GetProductsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsParams) WithDefaults() *GetProductsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get products params func (o *GetProductsParams) WithTimeout(timeout time.Duration) *GetProductsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetProductsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.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 o.ProductCode != nil { // query param productCode var qrProductCode string + if o.ProductCode != nil { qrProductCode = *o.ProductCode } qProductCode := qrProductCode if qProductCode != "" { + if err := r.SetQueryParam("productCode", qProductCode); err != nil { return err } } - } if o.ProductID != nil { // query param productId var qrProductID string + if o.ProductID != nil { qrProductID = *o.ProductID } qProductID := qrProductID if qProductID != "" { + if err := r.SetQueryParam("productId", qProductID); err != nil { return err } } - } if o.Publish != nil { // query param publish var qrPublish bool + if o.Publish != nil { qrPublish = *o.Publish } qPublish := swag.FormatBool(qrPublish) if qPublish != "" { + if err := r.SetQueryParam("publish", qPublish); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/product/get_products_responses.go b/api/ops/ops_client/product/get_products_responses.go index 4357201..6d216ad 100644 --- a/api/ops/ops_client/product/get_products_responses.go +++ b/api/ops/ops_client/product/get_products_responses.go @@ -63,9 +63,8 @@ func (o *GetProductsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetProductsOK() *GetProductsOK { return &GetProductsOK{} } -/*GetProductsOK handles this case with default header values. +/* GetProductsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Product objects */ type GetProductsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.ProductResponse } @@ -89,18 +87,25 @@ type GetProductsOK struct { func (o *GetProductsOK) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsOK %+v", 200, o.Payload) } - func (o *GetProductsOK) GetPayload() *ops_models.ProductResponse { return o.Payload } func (o *GetProductsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.ProductResponse) @@ -117,7 +122,7 @@ func NewGetProductsUnauthorized() *GetProductsUnauthorized { return &GetProductsUnauthorized{} } -/*GetProductsUnauthorized handles this case with default header values. +/* GetProductsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetProductsUnauthorized struct { func (o *GetProductsUnauthorized) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsUnauthorized %+v", 401, o.Payload) } - func (o *GetProductsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetProductsForbidden() *GetProductsForbidden { return &GetProductsForbidden{} } -/*GetProductsForbidden handles this case with default header values. +/* GetProductsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetProductsForbidden struct { func (o *GetProductsForbidden) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsForbidden %+v", 403, o.Payload) } - func (o *GetProductsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetProductsNotFound() *GetProductsNotFound { return &GetProductsNotFound{} } -/*GetProductsNotFound handles this case with default header values. +/* GetProductsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetProductsNotFound struct { func (o *GetProductsNotFound) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsNotFound %+v", 404, o.Payload) } - func (o *GetProductsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetProductsUnprocessableEntity() *GetProductsUnprocessableEntity { return &GetProductsUnprocessableEntity{} } -/*GetProductsUnprocessableEntity handles this case with default header values. +/* GetProductsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetProductsUnprocessableEntity struct { func (o *GetProductsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetProductsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetProductsInternalServerError() *GetProductsInternalServerError { return &GetProductsInternalServerError{} } -/*GetProductsInternalServerError handles this case with default header values. +/* GetProductsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetProductsInternalServerError struct { func (o *GetProductsInternalServerError) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsInternalServerError %+v", 500, o.Payload) } - func (o *GetProductsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetProductsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/product/post_products_parameters.go b/api/ops/ops_client/product/post_products_parameters.go index 01a113a..231359e 100644 --- a/api/ops/ops_client/product/post_products_parameters.go +++ b/api/ops/ops_client/product/post_products_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostProductsParams creates a new PostProductsParams object -// with the default values initialized. +// NewPostProductsParams creates a new PostProductsParams 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 NewPostProductsParams() *PostProductsParams { - var () return &PostProductsParams{ - timeout: cr.DefaultTimeout, } } // NewPostProductsParamsWithTimeout creates a new PostProductsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostProductsParamsWithTimeout(timeout time.Duration) *PostProductsParams { - var () return &PostProductsParams{ - timeout: timeout, } } // NewPostProductsParamsWithContext creates a new PostProductsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostProductsParamsWithContext(ctx context.Context) *PostProductsParams { - var () return &PostProductsParams{ - Context: ctx, } } // NewPostProductsParamsWithHTTPClient creates a new PostProductsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostProductsParamsWithHTTPClient(client *http.Client) *PostProductsParams { - var () return &PostProductsParams{ HTTPClient: client, } } -/*PostProductsParams contains all the parameters to send to the API endpoint -for the post products operation typically these are written to a http.Request +/* PostProductsParams contains all the parameters to send to the API endpoint + for the post products operation. + + Typically these are written to a http.Request. */ type PostProductsParams struct { - /*ProductRequest - A request with an array of Product Objects + /* ProductRequest. + A request with an array of Product Objects */ ProductRequest *ops_models.ProductRequest @@ -77,6 +76,21 @@ type PostProductsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostProductsParams) WithDefaults() *PostProductsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostProductsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post products params func (o *PostProductsParams) WithTimeout(timeout time.Duration) *PostProductsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostProductsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.ProductRequest != nil { if err := r.SetBodyParam(o.ProductRequest); err != nil { return err diff --git a/api/ops/ops_client/product/post_products_responses.go b/api/ops/ops_client/product/post_products_responses.go index 511691d..a02bd70 100644 --- a/api/ops/ops_client/product/post_products_responses.go +++ b/api/ops/ops_client/product/post_products_responses.go @@ -63,9 +63,8 @@ func (o *PostProductsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostProductsOK() *PostProductsOK { return &PostProductsOK{} } -/*PostProductsOK handles this case with default header values. +/* PostProductsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Product objects */ type PostProductsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.ProductResponse } @@ -89,18 +87,25 @@ type PostProductsOK struct { func (o *PostProductsOK) Error() string { return fmt.Sprintf("[POST /products][%d] postProductsOK %+v", 200, o.Payload) } - func (o *PostProductsOK) GetPayload() *ops_models.ProductResponse { return o.Payload } func (o *PostProductsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.ProductResponse) @@ -117,7 +122,7 @@ func NewPostProductsUnauthorized() *PostProductsUnauthorized { return &PostProductsUnauthorized{} } -/*PostProductsUnauthorized handles this case with default header values. +/* PostProductsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostProductsUnauthorized struct { func (o *PostProductsUnauthorized) Error() string { return fmt.Sprintf("[POST /products][%d] postProductsUnauthorized %+v", 401, o.Payload) } - func (o *PostProductsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostProductsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostProductsForbidden() *PostProductsForbidden { return &PostProductsForbidden{} } -/*PostProductsForbidden handles this case with default header values. +/* PostProductsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostProductsForbidden struct { func (o *PostProductsForbidden) Error() string { return fmt.Sprintf("[POST /products][%d] postProductsForbidden %+v", 403, o.Payload) } - func (o *PostProductsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostProductsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostProductsNotFound() *PostProductsNotFound { return &PostProductsNotFound{} } -/*PostProductsNotFound handles this case with default header values. +/* PostProductsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostProductsNotFound struct { func (o *PostProductsNotFound) Error() string { return fmt.Sprintf("[POST /products][%d] postProductsNotFound %+v", 404, o.Payload) } - func (o *PostProductsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostProductsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostProductsUnprocessableEntity() *PostProductsUnprocessableEntity { return &PostProductsUnprocessableEntity{} } -/*PostProductsUnprocessableEntity handles this case with default header values. +/* PostProductsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostProductsUnprocessableEntity struct { func (o *PostProductsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /products][%d] postProductsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostProductsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostProductsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostProductsInternalServerError() *PostProductsInternalServerError { return &PostProductsInternalServerError{} } -/*PostProductsInternalServerError handles this case with default header values. +/* PostProductsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostProductsInternalServerError struct { func (o *PostProductsInternalServerError) Error() string { return fmt.Sprintf("[POST /products][%d] postProductsInternalServerError %+v", 500, o.Payload) } - func (o *PostProductsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostProductsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/product/product_client.go b/api/ops/ops_client/product/product_client.go index 72be277..8d9c74a 100644 --- a/api/ops/ops_client/product/product_client.go +++ b/api/ops/ops_client/product/product_client.go @@ -29,17 +29,20 @@ type Client struct { 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 { - DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteProductOK, error) + DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteProductOK, error) - GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error) + GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error) - GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsObservableOK, error) + GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsObservableOK, error) - PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PostProductsOK, error) + PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostProductsOK, error) - PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PutProductsOK, error) + PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutProductsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -49,13 +52,12 @@ type ClientService interface { Delete Taxnexus Product record */ -func (a *Client) DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteProductOK, error) { +func (a *Client) DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteProductOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteProductParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteProduct", Method: "DELETE", PathPattern: "/products", @@ -67,7 +69,12 @@ func (a *Client) DeleteProduct(params *DeleteProductParams, authInfo runtime.Cli 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 } @@ -86,13 +93,12 @@ func (a *Client) DeleteProduct(params *DeleteProductParams, authInfo runtime.Cli Return a list of all available Products */ -func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error) { +func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetProductsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getProducts", Method: "GET", PathPattern: "/products", @@ -104,7 +110,12 @@ func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientA 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 } @@ -123,13 +134,12 @@ func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientA Return a simplified list of all available Products */ -func (a *Client) GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsObservableOK, error) { +func (a *Client) GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsObservableOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetProductsObservableParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getProductsObservable", Method: "GET", PathPattern: "/products/observable", @@ -141,7 +151,12 @@ func (a *Client) GetProductsObservable(params *GetProductsObservableParams, auth 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 } @@ -160,13 +175,12 @@ func (a *Client) GetProductsObservable(params *GetProductsObservableParams, auth Product records to be added */ -func (a *Client) PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PostProductsOK, error) { +func (a *Client) PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostProductsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostProductsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postProducts", Method: "POST", PathPattern: "/products", @@ -178,7 +192,12 @@ func (a *Client) PostProducts(params *PostProductsParams, authInfo runtime.Clien 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 } @@ -197,13 +216,12 @@ func (a *Client) PostProducts(params *PostProductsParams, authInfo runtime.Clien Update Product records */ -func (a *Client) PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PutProductsOK, error) { +func (a *Client) PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutProductsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutProductsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putProducts", Method: "PUT", PathPattern: "/products", @@ -215,7 +233,12 @@ func (a *Client) PutProducts(params *PutProductsParams, authInfo runtime.ClientA 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 } diff --git a/api/ops/ops_client/product/put_products_parameters.go b/api/ops/ops_client/product/put_products_parameters.go index fbbcc18..377cfbd 100644 --- a/api/ops/ops_client/product/put_products_parameters.go +++ b/api/ops/ops_client/product/put_products_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutProductsParams creates a new PutProductsParams object -// with the default values initialized. +// NewPutProductsParams creates a new PutProductsParams 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 NewPutProductsParams() *PutProductsParams { - var () return &PutProductsParams{ - timeout: cr.DefaultTimeout, } } // NewPutProductsParamsWithTimeout creates a new PutProductsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutProductsParamsWithTimeout(timeout time.Duration) *PutProductsParams { - var () return &PutProductsParams{ - timeout: timeout, } } // NewPutProductsParamsWithContext creates a new PutProductsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutProductsParamsWithContext(ctx context.Context) *PutProductsParams { - var () return &PutProductsParams{ - Context: ctx, } } // NewPutProductsParamsWithHTTPClient creates a new PutProductsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutProductsParamsWithHTTPClient(client *http.Client) *PutProductsParams { - var () return &PutProductsParams{ HTTPClient: client, } } -/*PutProductsParams contains all the parameters to send to the API endpoint -for the put products operation typically these are written to a http.Request +/* PutProductsParams contains all the parameters to send to the API endpoint + for the put products operation. + + Typically these are written to a http.Request. */ type PutProductsParams struct { - /*ProductRequest - A request with an array of Product Objects + /* ProductRequest. + A request with an array of Product Objects */ ProductRequest *ops_models.ProductRequest @@ -77,6 +76,21 @@ type PutProductsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutProductsParams) WithDefaults() *PutProductsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutProductsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put products params func (o *PutProductsParams) WithTimeout(timeout time.Duration) *PutProductsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutProductsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ProductRequest != nil { if err := r.SetBodyParam(o.ProductRequest); err != nil { return err diff --git a/api/ops/ops_client/product/put_products_responses.go b/api/ops/ops_client/product/put_products_responses.go index 784709c..7fd0dd4 100644 --- a/api/ops/ops_client/product/put_products_responses.go +++ b/api/ops/ops_client/product/put_products_responses.go @@ -63,9 +63,8 @@ func (o *PutProductsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutProductsOK() *PutProductsOK { return &PutProductsOK{} } -/*PutProductsOK handles this case with default header values. +/* PutProductsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Message objects in response to a PUT */ @@ -87,15 +86,18 @@ type PutProductsOK struct { func (o *PutProductsOK) Error() string { return fmt.Sprintf("[PUT /products][%d] putProductsOK %+v", 200, o.Payload) } - func (o *PutProductsOK) GetPayload() *ops_models.PutResponse { return o.Payload } func (o *PutProductsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.PutResponse) @@ -112,7 +114,7 @@ func NewPutProductsUnauthorized() *PutProductsUnauthorized { return &PutProductsUnauthorized{} } -/*PutProductsUnauthorized handles this case with default header values. +/* PutProductsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PutProductsUnauthorized struct { func (o *PutProductsUnauthorized) Error() string { return fmt.Sprintf("[PUT /products][%d] putProductsUnauthorized %+v", 401, o.Payload) } - func (o *PutProductsUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutProductsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewPutProductsForbidden() *PutProductsForbidden { return &PutProductsForbidden{} } -/*PutProductsForbidden handles this case with default header values. +/* PutProductsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PutProductsForbidden struct { func (o *PutProductsForbidden) Error() string { return fmt.Sprintf("[PUT /products][%d] putProductsForbidden %+v", 403, o.Payload) } - func (o *PutProductsForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutProductsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewPutProductsNotFound() *PutProductsNotFound { return &PutProductsNotFound{} } -/*PutProductsNotFound handles this case with default header values. +/* PutProductsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PutProductsNotFound struct { func (o *PutProductsNotFound) Error() string { return fmt.Sprintf("[PUT /products][%d] putProductsNotFound %+v", 404, o.Payload) } - func (o *PutProductsNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutProductsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewPutProductsUnprocessableEntity() *PutProductsUnprocessableEntity { return &PutProductsUnprocessableEntity{} } -/*PutProductsUnprocessableEntity handles this case with default header values. +/* PutProductsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PutProductsUnprocessableEntity struct { func (o *PutProductsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /products][%d] putProductsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutProductsUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutProductsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewPutProductsInternalServerError() *PutProductsInternalServerError { return &PutProductsInternalServerError{} } -/*PutProductsInternalServerError handles this case with default header values. +/* PutProductsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PutProductsInternalServerError struct { func (o *PutProductsInternalServerError) Error() string { return fmt.Sprintf("[PUT /products][%d] putProductsInternalServerError %+v", 500, o.Payload) } - func (o *PutProductsInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutProductsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/purchase_order/delete_purchase_order_parameters.go b/api/ops/ops_client/purchase_order/delete_purchase_order_parameters.go index 0ab16e6..5890719 100644 --- a/api/ops/ops_client/purchase_order/delete_purchase_order_parameters.go +++ b/api/ops/ops_client/purchase_order/delete_purchase_order_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeletePurchaseOrderParams creates a new DeletePurchaseOrderParams object -// with the default values initialized. +// NewDeletePurchaseOrderParams creates a new DeletePurchaseOrderParams 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 NewDeletePurchaseOrderParams() *DeletePurchaseOrderParams { - var () return &DeletePurchaseOrderParams{ - timeout: cr.DefaultTimeout, } } // NewDeletePurchaseOrderParamsWithTimeout creates a new DeletePurchaseOrderParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeletePurchaseOrderParamsWithTimeout(timeout time.Duration) *DeletePurchaseOrderParams { - var () return &DeletePurchaseOrderParams{ - timeout: timeout, } } // NewDeletePurchaseOrderParamsWithContext creates a new DeletePurchaseOrderParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeletePurchaseOrderParamsWithContext(ctx context.Context) *DeletePurchaseOrderParams { - var () return &DeletePurchaseOrderParams{ - Context: ctx, } } // NewDeletePurchaseOrderParamsWithHTTPClient creates a new DeletePurchaseOrderParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeletePurchaseOrderParamsWithHTTPClient(client *http.Client) *DeletePurchaseOrderParams { - var () return &DeletePurchaseOrderParams{ HTTPClient: client, } } -/*DeletePurchaseOrderParams contains all the parameters to send to the API endpoint -for the delete purchase order operation typically these are written to a http.Request +/* DeletePurchaseOrderParams contains all the parameters to send to the API endpoint + for the delete purchase order operation. + + Typically these are written to a http.Request. */ type DeletePurchaseOrderParams struct { - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + Taxnexus Id of the record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeletePurchaseOrderParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete purchase order params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePurchaseOrderParams) WithDefaults() *DeletePurchaseOrderParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete purchase order params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeletePurchaseOrderParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete purchase order params func (o *DeletePurchaseOrderParams) WithTimeout(timeout time.Duration) *DeletePurchaseOrderParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeletePurchaseOrderParams) WriteToRequest(r runtime.ClientRequest, reg // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/purchase_order/delete_purchase_order_responses.go b/api/ops/ops_client/purchase_order/delete_purchase_order_responses.go index 0d3e5d8..8c807d0 100644 --- a/api/ops/ops_client/purchase_order/delete_purchase_order_responses.go +++ b/api/ops/ops_client/purchase_order/delete_purchase_order_responses.go @@ -63,9 +63,8 @@ func (o *DeletePurchaseOrderReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeletePurchaseOrderOK() *DeletePurchaseOrderOK { return &DeletePurchaseOrderOK{} } -/*DeletePurchaseOrderOK handles this case with default header values. +/* DeletePurchaseOrderOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeletePurchaseOrderOK struct { func (o *DeletePurchaseOrderOK) Error() string { return fmt.Sprintf("[DELETE /pos][%d] deletePurchaseOrderOK %+v", 200, o.Payload) } - func (o *DeletePurchaseOrderOK) GetPayload() *ops_models.DeleteResponse { return o.Payload } func (o *DeletePurchaseOrderOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeletePurchaseOrderUnauthorized() *DeletePurchaseOrderUnauthorized { return &DeletePurchaseOrderUnauthorized{} } -/*DeletePurchaseOrderUnauthorized handles this case with default header values. +/* DeletePurchaseOrderUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeletePurchaseOrderUnauthorized struct { func (o *DeletePurchaseOrderUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pos][%d] deletePurchaseOrderUnauthorized %+v", 401, o.Payload) } - func (o *DeletePurchaseOrderUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePurchaseOrderUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewDeletePurchaseOrderForbidden() *DeletePurchaseOrderForbidden { return &DeletePurchaseOrderForbidden{} } -/*DeletePurchaseOrderForbidden handles this case with default header values. +/* DeletePurchaseOrderForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeletePurchaseOrderForbidden struct { func (o *DeletePurchaseOrderForbidden) Error() string { return fmt.Sprintf("[DELETE /pos][%d] deletePurchaseOrderForbidden %+v", 403, o.Payload) } - func (o *DeletePurchaseOrderForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePurchaseOrderForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewDeletePurchaseOrderNotFound() *DeletePurchaseOrderNotFound { return &DeletePurchaseOrderNotFound{} } -/*DeletePurchaseOrderNotFound handles this case with default header values. +/* DeletePurchaseOrderNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeletePurchaseOrderNotFound struct { func (o *DeletePurchaseOrderNotFound) Error() string { return fmt.Sprintf("[DELETE /pos][%d] deletePurchaseOrderNotFound %+v", 404, o.Payload) } - func (o *DeletePurchaseOrderNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePurchaseOrderNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewDeletePurchaseOrderUnprocessableEntity() *DeletePurchaseOrderUnprocessab return &DeletePurchaseOrderUnprocessableEntity{} } -/*DeletePurchaseOrderUnprocessableEntity handles this case with default header values. +/* DeletePurchaseOrderUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeletePurchaseOrderUnprocessableEntity struct { func (o *DeletePurchaseOrderUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /pos][%d] deletePurchaseOrderUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeletePurchaseOrderUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePurchaseOrderUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewDeletePurchaseOrderInternalServerError() *DeletePurchaseOrderInternalSer return &DeletePurchaseOrderInternalServerError{} } -/*DeletePurchaseOrderInternalServerError handles this case with default header values. +/* DeletePurchaseOrderInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeletePurchaseOrderInternalServerError struct { func (o *DeletePurchaseOrderInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pos][%d] deletePurchaseOrderInternalServerError %+v", 500, o.Payload) } - func (o *DeletePurchaseOrderInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeletePurchaseOrderInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/purchase_order/get_purchase_orders_parameters.go b/api/ops/ops_client/purchase_order/get_purchase_orders_parameters.go index 66be51c..ac7c73b 100644 --- a/api/ops/ops_client/purchase_order/get_purchase_orders_parameters.go +++ b/api/ops/ops_client/purchase_order/get_purchase_orders_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPurchaseOrdersParams creates a new GetPurchaseOrdersParams object -// with the default values initialized. +// NewGetPurchaseOrdersParams creates a new GetPurchaseOrdersParams 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 NewGetPurchaseOrdersParams() *GetPurchaseOrdersParams { - var () return &GetPurchaseOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewGetPurchaseOrdersParamsWithTimeout creates a new GetPurchaseOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPurchaseOrdersParamsWithTimeout(timeout time.Duration) *GetPurchaseOrdersParams { - var () return &GetPurchaseOrdersParams{ - timeout: timeout, } } // NewGetPurchaseOrdersParamsWithContext creates a new GetPurchaseOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPurchaseOrdersParamsWithContext(ctx context.Context) *GetPurchaseOrdersParams { - var () return &GetPurchaseOrdersParams{ - Context: ctx, } } // NewGetPurchaseOrdersParamsWithHTTPClient creates a new GetPurchaseOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPurchaseOrdersParamsWithHTTPClient(client *http.Client) *GetPurchaseOrdersParams { - var () return &GetPurchaseOrdersParams{ HTTPClient: client, } } -/*GetPurchaseOrdersParams contains all the parameters to send to the API endpoint -for the get purchase orders operation typically these are written to a http.Request +/* GetPurchaseOrdersParams contains all the parameters to send to the API endpoint + for the get purchase orders operation. + + Typically these are written to a http.Request. */ type GetPurchaseOrdersParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*PurchaseOrderID - Taxnexus Record Id of a Company + /* PurchaseOrderID. + + Taxnexus Record Id of a Company */ PurchaseOrderID *string @@ -86,6 +91,21 @@ type GetPurchaseOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get purchase orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPurchaseOrdersParams) WithDefaults() *GetPurchaseOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get purchase orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPurchaseOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get purchase orders params func (o *GetPurchaseOrdersParams) WithTimeout(timeout time.Duration) *GetPurchaseOrdersParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetPurchaseOrdersParams) WriteToRequest(r runtime.ClientRequest, reg st // 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 o.PurchaseOrderID != nil { // query param purchaseOrderId var qrPurchaseOrderID string + if o.PurchaseOrderID != nil { qrPurchaseOrderID = *o.PurchaseOrderID } qPurchaseOrderID := qrPurchaseOrderID if qPurchaseOrderID != "" { + if err := r.SetQueryParam("purchaseOrderId", qPurchaseOrderID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/purchase_order/get_purchase_orders_responses.go b/api/ops/ops_client/purchase_order/get_purchase_orders_responses.go index 4e4d881..b03a056 100644 --- a/api/ops/ops_client/purchase_order/get_purchase_orders_responses.go +++ b/api/ops/ops_client/purchase_order/get_purchase_orders_responses.go @@ -63,9 +63,8 @@ func (o *GetPurchaseOrdersReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetPurchaseOrdersOK() *GetPurchaseOrdersOK { return &GetPurchaseOrdersOK{} } -/*GetPurchaseOrdersOK handles this case with default header values. +/* GetPurchaseOrdersOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Purchase Order objects */ type GetPurchaseOrdersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.PurchaseOrderResponse } @@ -89,18 +87,25 @@ type GetPurchaseOrdersOK struct { func (o *GetPurchaseOrdersOK) Error() string { return fmt.Sprintf("[GET /pos][%d] getPurchaseOrdersOK %+v", 200, o.Payload) } - func (o *GetPurchaseOrdersOK) GetPayload() *ops_models.PurchaseOrderResponse { return o.Payload } func (o *GetPurchaseOrdersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.PurchaseOrderResponse) @@ -117,7 +122,7 @@ func NewGetPurchaseOrdersUnauthorized() *GetPurchaseOrdersUnauthorized { return &GetPurchaseOrdersUnauthorized{} } -/*GetPurchaseOrdersUnauthorized handles this case with default header values. +/* GetPurchaseOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetPurchaseOrdersUnauthorized struct { func (o *GetPurchaseOrdersUnauthorized) Error() string { return fmt.Sprintf("[GET /pos][%d] getPurchaseOrdersUnauthorized %+v", 401, o.Payload) } - func (o *GetPurchaseOrdersUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPurchaseOrdersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetPurchaseOrdersForbidden() *GetPurchaseOrdersForbidden { return &GetPurchaseOrdersForbidden{} } -/*GetPurchaseOrdersForbidden handles this case with default header values. +/* GetPurchaseOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetPurchaseOrdersForbidden struct { func (o *GetPurchaseOrdersForbidden) Error() string { return fmt.Sprintf("[GET /pos][%d] getPurchaseOrdersForbidden %+v", 403, o.Payload) } - func (o *GetPurchaseOrdersForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPurchaseOrdersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetPurchaseOrdersNotFound() *GetPurchaseOrdersNotFound { return &GetPurchaseOrdersNotFound{} } -/*GetPurchaseOrdersNotFound handles this case with default header values. +/* GetPurchaseOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetPurchaseOrdersNotFound struct { func (o *GetPurchaseOrdersNotFound) Error() string { return fmt.Sprintf("[GET /pos][%d] getPurchaseOrdersNotFound %+v", 404, o.Payload) } - func (o *GetPurchaseOrdersNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPurchaseOrdersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetPurchaseOrdersUnprocessableEntity() *GetPurchaseOrdersUnprocessableEn return &GetPurchaseOrdersUnprocessableEntity{} } -/*GetPurchaseOrdersUnprocessableEntity handles this case with default header values. +/* GetPurchaseOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetPurchaseOrdersUnprocessableEntity struct { func (o *GetPurchaseOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /pos][%d] getPurchaseOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPurchaseOrdersUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPurchaseOrdersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetPurchaseOrdersInternalServerError() *GetPurchaseOrdersInternalServerE return &GetPurchaseOrdersInternalServerError{} } -/*GetPurchaseOrdersInternalServerError handles this case with default header values. +/* GetPurchaseOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetPurchaseOrdersInternalServerError struct { func (o *GetPurchaseOrdersInternalServerError) Error() string { return fmt.Sprintf("[GET /pos][%d] getPurchaseOrdersInternalServerError %+v", 500, o.Payload) } - func (o *GetPurchaseOrdersInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetPurchaseOrdersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/purchase_order/post_purchase_orders_parameters.go b/api/ops/ops_client/purchase_order/post_purchase_orders_parameters.go index 3fd817f..8dd5a70 100644 --- a/api/ops/ops_client/purchase_order/post_purchase_orders_parameters.go +++ b/api/ops/ops_client/purchase_order/post_purchase_orders_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostPurchaseOrdersParams creates a new PostPurchaseOrdersParams object -// with the default values initialized. +// NewPostPurchaseOrdersParams creates a new PostPurchaseOrdersParams 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 NewPostPurchaseOrdersParams() *PostPurchaseOrdersParams { - var () return &PostPurchaseOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewPostPurchaseOrdersParamsWithTimeout creates a new PostPurchaseOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPurchaseOrdersParamsWithTimeout(timeout time.Duration) *PostPurchaseOrdersParams { - var () return &PostPurchaseOrdersParams{ - timeout: timeout, } } // NewPostPurchaseOrdersParamsWithContext creates a new PostPurchaseOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPurchaseOrdersParamsWithContext(ctx context.Context) *PostPurchaseOrdersParams { - var () return &PostPurchaseOrdersParams{ - Context: ctx, } } // NewPostPurchaseOrdersParamsWithHTTPClient creates a new PostPurchaseOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPurchaseOrdersParamsWithHTTPClient(client *http.Client) *PostPurchaseOrdersParams { - var () return &PostPurchaseOrdersParams{ HTTPClient: client, } } -/*PostPurchaseOrdersParams contains all the parameters to send to the API endpoint -for the post purchase orders operation typically these are written to a http.Request +/* PostPurchaseOrdersParams contains all the parameters to send to the API endpoint + for the post purchase orders operation. + + Typically these are written to a http.Request. */ type PostPurchaseOrdersParams struct { - /*PurchaseOrderRequest - A request with an array of Purchase Order Objects + /* PurchaseOrderRequest. + A request with an array of Purchase Order Objects */ PurchaseOrderRequest *ops_models.PurchaseOrderRequest @@ -77,6 +76,21 @@ type PostPurchaseOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post purchase orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPurchaseOrdersParams) WithDefaults() *PostPurchaseOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post purchase orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPurchaseOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post purchase orders params func (o *PostPurchaseOrdersParams) WithTimeout(timeout time.Duration) *PostPurchaseOrdersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPurchaseOrdersParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if o.PurchaseOrderRequest != nil { if err := r.SetBodyParam(o.PurchaseOrderRequest); err != nil { return err diff --git a/api/ops/ops_client/purchase_order/post_purchase_orders_responses.go b/api/ops/ops_client/purchase_order/post_purchase_orders_responses.go index 64d2d75..527501e 100644 --- a/api/ops/ops_client/purchase_order/post_purchase_orders_responses.go +++ b/api/ops/ops_client/purchase_order/post_purchase_orders_responses.go @@ -63,9 +63,8 @@ func (o *PostPurchaseOrdersReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostPurchaseOrdersOK() *PostPurchaseOrdersOK { return &PostPurchaseOrdersOK{} } -/*PostPurchaseOrdersOK handles this case with default header values. +/* PostPurchaseOrdersOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Purchase Order objects */ type PostPurchaseOrdersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.PurchaseOrderResponse } @@ -89,18 +87,25 @@ type PostPurchaseOrdersOK struct { func (o *PostPurchaseOrdersOK) Error() string { return fmt.Sprintf("[POST /pos][%d] postPurchaseOrdersOK %+v", 200, o.Payload) } - func (o *PostPurchaseOrdersOK) GetPayload() *ops_models.PurchaseOrderResponse { return o.Payload } func (o *PostPurchaseOrdersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.PurchaseOrderResponse) @@ -117,7 +122,7 @@ func NewPostPurchaseOrdersUnauthorized() *PostPurchaseOrdersUnauthorized { return &PostPurchaseOrdersUnauthorized{} } -/*PostPurchaseOrdersUnauthorized handles this case with default header values. +/* PostPurchaseOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostPurchaseOrdersUnauthorized struct { func (o *PostPurchaseOrdersUnauthorized) Error() string { return fmt.Sprintf("[POST /pos][%d] postPurchaseOrdersUnauthorized %+v", 401, o.Payload) } - func (o *PostPurchaseOrdersUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPurchaseOrdersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostPurchaseOrdersForbidden() *PostPurchaseOrdersForbidden { return &PostPurchaseOrdersForbidden{} } -/*PostPurchaseOrdersForbidden handles this case with default header values. +/* PostPurchaseOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostPurchaseOrdersForbidden struct { func (o *PostPurchaseOrdersForbidden) Error() string { return fmt.Sprintf("[POST /pos][%d] postPurchaseOrdersForbidden %+v", 403, o.Payload) } - func (o *PostPurchaseOrdersForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPurchaseOrdersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostPurchaseOrdersNotFound() *PostPurchaseOrdersNotFound { return &PostPurchaseOrdersNotFound{} } -/*PostPurchaseOrdersNotFound handles this case with default header values. +/* PostPurchaseOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostPurchaseOrdersNotFound struct { func (o *PostPurchaseOrdersNotFound) Error() string { return fmt.Sprintf("[POST /pos][%d] postPurchaseOrdersNotFound %+v", 404, o.Payload) } - func (o *PostPurchaseOrdersNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPurchaseOrdersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostPurchaseOrdersUnprocessableEntity() *PostPurchaseOrdersUnprocessable return &PostPurchaseOrdersUnprocessableEntity{} } -/*PostPurchaseOrdersUnprocessableEntity handles this case with default header values. +/* PostPurchaseOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostPurchaseOrdersUnprocessableEntity struct { func (o *PostPurchaseOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pos][%d] postPurchaseOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostPurchaseOrdersUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPurchaseOrdersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostPurchaseOrdersInternalServerError() *PostPurchaseOrdersInternalServe return &PostPurchaseOrdersInternalServerError{} } -/*PostPurchaseOrdersInternalServerError handles this case with default header values. +/* PostPurchaseOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostPurchaseOrdersInternalServerError struct { func (o *PostPurchaseOrdersInternalServerError) Error() string { return fmt.Sprintf("[POST /pos][%d] postPurchaseOrdersInternalServerError %+v", 500, o.Payload) } - func (o *PostPurchaseOrdersInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostPurchaseOrdersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/purchase_order/purchase_order_client.go b/api/ops/ops_client/purchase_order/purchase_order_client.go index 2e1976a..30d7574 100644 --- a/api/ops/ops_client/purchase_order/purchase_order_client.go +++ b/api/ops/ops_client/purchase_order/purchase_order_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeletePurchaseOrder(params *DeletePurchaseOrderParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePurchaseOrderOK, error) + DeletePurchaseOrder(params *DeletePurchaseOrderParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePurchaseOrderOK, error) - GetPurchaseOrders(params *GetPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*GetPurchaseOrdersOK, error) + GetPurchaseOrders(params *GetPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPurchaseOrdersOK, error) - PostPurchaseOrders(params *PostPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostPurchaseOrdersOK, error) + PostPurchaseOrders(params *PostPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPurchaseOrdersOK, error) - PutPurchaseOrders(params *PutPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PutPurchaseOrdersOK, error) + PutPurchaseOrders(params *PutPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPurchaseOrdersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete a PO by ID */ -func (a *Client) DeletePurchaseOrder(params *DeletePurchaseOrderParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePurchaseOrderOK, error) { +func (a *Client) DeletePurchaseOrder(params *DeletePurchaseOrderParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePurchaseOrderOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeletePurchaseOrderParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deletePurchaseOrder", Method: "DELETE", PathPattern: "/pos", @@ -65,7 +67,12 @@ func (a *Client) DeletePurchaseOrder(params *DeletePurchaseOrderParams, authInfo 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 } @@ -84,13 +91,12 @@ func (a *Client) DeletePurchaseOrder(params *DeletePurchaseOrderParams, authInfo Return a list of available Purchase Orders */ -func (a *Client) GetPurchaseOrders(params *GetPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*GetPurchaseOrdersOK, error) { +func (a *Client) GetPurchaseOrders(params *GetPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPurchaseOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPurchaseOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPurchaseOrders", Method: "GET", PathPattern: "/pos", @@ -102,7 +108,12 @@ func (a *Client) GetPurchaseOrders(params *GetPurchaseOrdersParams, authInfo run 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 } @@ -121,13 +132,12 @@ func (a *Client) GetPurchaseOrders(params *GetPurchaseOrdersParams, authInfo run Create New Purchase Order */ -func (a *Client) PostPurchaseOrders(params *PostPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostPurchaseOrdersOK, error) { +func (a *Client) PostPurchaseOrders(params *PostPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPurchaseOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPurchaseOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPurchaseOrders", Method: "POST", PathPattern: "/pos", @@ -139,7 +149,12 @@ func (a *Client) PostPurchaseOrders(params *PostPurchaseOrdersParams, authInfo r 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 } @@ -158,13 +173,12 @@ func (a *Client) PostPurchaseOrders(params *PostPurchaseOrdersParams, authInfo r Upsert a list of Purchase Order */ -func (a *Client) PutPurchaseOrders(params *PutPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PutPurchaseOrdersOK, error) { +func (a *Client) PutPurchaseOrders(params *PutPurchaseOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPurchaseOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutPurchaseOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putPurchaseOrders", Method: "PUT", PathPattern: "/pos", @@ -176,7 +190,12 @@ func (a *Client) PutPurchaseOrders(params *PutPurchaseOrdersParams, authInfo run 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 } diff --git a/api/ops/ops_client/purchase_order/put_purchase_orders_parameters.go b/api/ops/ops_client/purchase_order/put_purchase_orders_parameters.go index 97e108c..b259c7c 100644 --- a/api/ops/ops_client/purchase_order/put_purchase_orders_parameters.go +++ b/api/ops/ops_client/purchase_order/put_purchase_orders_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutPurchaseOrdersParams creates a new PutPurchaseOrdersParams object -// with the default values initialized. +// NewPutPurchaseOrdersParams creates a new PutPurchaseOrdersParams 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 NewPutPurchaseOrdersParams() *PutPurchaseOrdersParams { - var () return &PutPurchaseOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewPutPurchaseOrdersParamsWithTimeout creates a new PutPurchaseOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutPurchaseOrdersParamsWithTimeout(timeout time.Duration) *PutPurchaseOrdersParams { - var () return &PutPurchaseOrdersParams{ - timeout: timeout, } } // NewPutPurchaseOrdersParamsWithContext creates a new PutPurchaseOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutPurchaseOrdersParamsWithContext(ctx context.Context) *PutPurchaseOrdersParams { - var () return &PutPurchaseOrdersParams{ - Context: ctx, } } // NewPutPurchaseOrdersParamsWithHTTPClient creates a new PutPurchaseOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutPurchaseOrdersParamsWithHTTPClient(client *http.Client) *PutPurchaseOrdersParams { - var () return &PutPurchaseOrdersParams{ HTTPClient: client, } } -/*PutPurchaseOrdersParams contains all the parameters to send to the API endpoint -for the put purchase orders operation typically these are written to a http.Request +/* PutPurchaseOrdersParams contains all the parameters to send to the API endpoint + for the put purchase orders operation. + + Typically these are written to a http.Request. */ type PutPurchaseOrdersParams struct { - /*PurchaseOrderRequest - A request with an array of Purchase Order Objects + /* PurchaseOrderRequest. + A request with an array of Purchase Order Objects */ PurchaseOrderRequest *ops_models.PurchaseOrderRequest @@ -77,6 +76,21 @@ type PutPurchaseOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put purchase orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPurchaseOrdersParams) WithDefaults() *PutPurchaseOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put purchase orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPurchaseOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put purchase orders params func (o *PutPurchaseOrdersParams) WithTimeout(timeout time.Duration) *PutPurchaseOrdersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutPurchaseOrdersParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.PurchaseOrderRequest != nil { if err := r.SetBodyParam(o.PurchaseOrderRequest); err != nil { return err diff --git a/api/ops/ops_client/purchase_order/put_purchase_orders_responses.go b/api/ops/ops_client/purchase_order/put_purchase_orders_responses.go index de69e5c..e77b428 100644 --- a/api/ops/ops_client/purchase_order/put_purchase_orders_responses.go +++ b/api/ops/ops_client/purchase_order/put_purchase_orders_responses.go @@ -63,9 +63,8 @@ func (o *PutPurchaseOrdersReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutPurchaseOrdersOK() *PutPurchaseOrdersOK { return &PutPurchaseOrdersOK{} } -/*PutPurchaseOrdersOK handles this case with default header values. +/* PutPurchaseOrdersOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Message objects in response to a PUT */ @@ -87,15 +86,18 @@ type PutPurchaseOrdersOK struct { func (o *PutPurchaseOrdersOK) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersOK %+v", 200, o.Payload) } - func (o *PutPurchaseOrdersOK) GetPayload() *ops_models.PutResponse { return o.Payload } func (o *PutPurchaseOrdersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.PutResponse) @@ -112,7 +114,7 @@ func NewPutPurchaseOrdersUnauthorized() *PutPurchaseOrdersUnauthorized { return &PutPurchaseOrdersUnauthorized{} } -/*PutPurchaseOrdersUnauthorized handles this case with default header values. +/* PutPurchaseOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PutPurchaseOrdersUnauthorized struct { func (o *PutPurchaseOrdersUnauthorized) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersUnauthorized %+v", 401, o.Payload) } - func (o *PutPurchaseOrdersUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPurchaseOrdersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewPutPurchaseOrdersForbidden() *PutPurchaseOrdersForbidden { return &PutPurchaseOrdersForbidden{} } -/*PutPurchaseOrdersForbidden handles this case with default header values. +/* PutPurchaseOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PutPurchaseOrdersForbidden struct { func (o *PutPurchaseOrdersForbidden) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersForbidden %+v", 403, o.Payload) } - func (o *PutPurchaseOrdersForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPurchaseOrdersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewPutPurchaseOrdersNotFound() *PutPurchaseOrdersNotFound { return &PutPurchaseOrdersNotFound{} } -/*PutPurchaseOrdersNotFound handles this case with default header values. +/* PutPurchaseOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PutPurchaseOrdersNotFound struct { func (o *PutPurchaseOrdersNotFound) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersNotFound %+v", 404, o.Payload) } - func (o *PutPurchaseOrdersNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPurchaseOrdersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewPutPurchaseOrdersUnprocessableEntity() *PutPurchaseOrdersUnprocessableEn return &PutPurchaseOrdersUnprocessableEntity{} } -/*PutPurchaseOrdersUnprocessableEntity handles this case with default header values. +/* PutPurchaseOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PutPurchaseOrdersUnprocessableEntity struct { func (o *PutPurchaseOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutPurchaseOrdersUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPurchaseOrdersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewPutPurchaseOrdersInternalServerError() *PutPurchaseOrdersInternalServerE return &PutPurchaseOrdersInternalServerError{} } -/*PutPurchaseOrdersInternalServerError handles this case with default header values. +/* PutPurchaseOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PutPurchaseOrdersInternalServerError struct { func (o *PutPurchaseOrdersInternalServerError) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPurchaseOrdersInternalServerError %+v", 500, o.Payload) } - func (o *PutPurchaseOrdersInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutPurchaseOrdersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/quote/delete_quote_parameters.go b/api/ops/ops_client/quote/delete_quote_parameters.go index 8b6e95e..9e1350a 100644 --- a/api/ops/ops_client/quote/delete_quote_parameters.go +++ b/api/ops/ops_client/quote/delete_quote_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteQuoteParams creates a new DeleteQuoteParams object -// with the default values initialized. +// NewDeleteQuoteParams creates a new DeleteQuoteParams 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 NewDeleteQuoteParams() *DeleteQuoteParams { - var () return &DeleteQuoteParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteQuoteParamsWithTimeout creates a new DeleteQuoteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteQuoteParamsWithTimeout(timeout time.Duration) *DeleteQuoteParams { - var () return &DeleteQuoteParams{ - timeout: timeout, } } // NewDeleteQuoteParamsWithContext creates a new DeleteQuoteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteQuoteParamsWithContext(ctx context.Context) *DeleteQuoteParams { - var () return &DeleteQuoteParams{ - Context: ctx, } } // NewDeleteQuoteParamsWithHTTPClient creates a new DeleteQuoteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteQuoteParamsWithHTTPClient(client *http.Client) *DeleteQuoteParams { - var () return &DeleteQuoteParams{ HTTPClient: client, } } -/*DeleteQuoteParams contains all the parameters to send to the API endpoint -for the delete quote operation typically these are written to a http.Request +/* DeleteQuoteParams contains all the parameters to send to the API endpoint + for the delete quote operation. + + Typically these are written to a http.Request. */ type DeleteQuoteParams struct { - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + Taxnexus Id of the record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeleteQuoteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete quote params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteQuoteParams) WithDefaults() *DeleteQuoteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete quote params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteQuoteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete quote params func (o *DeleteQuoteParams) WithTimeout(timeout time.Duration) *DeleteQuoteParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteQuoteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/quote/delete_quote_responses.go b/api/ops/ops_client/quote/delete_quote_responses.go index 444fe22..530ab91 100644 --- a/api/ops/ops_client/quote/delete_quote_responses.go +++ b/api/ops/ops_client/quote/delete_quote_responses.go @@ -63,9 +63,8 @@ func (o *DeleteQuoteReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteQuoteOK() *DeleteQuoteOK { return &DeleteQuoteOK{} } -/*DeleteQuoteOK handles this case with default header values. +/* DeleteQuoteOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteQuoteOK struct { func (o *DeleteQuoteOK) Error() string { return fmt.Sprintf("[DELETE /quotes][%d] deleteQuoteOK %+v", 200, o.Payload) } - func (o *DeleteQuoteOK) GetPayload() *ops_models.DeleteResponse { return o.Payload } func (o *DeleteQuoteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteQuoteUnauthorized() *DeleteQuoteUnauthorized { return &DeleteQuoteUnauthorized{} } -/*DeleteQuoteUnauthorized handles this case with default header values. +/* DeleteQuoteUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteQuoteUnauthorized struct { func (o *DeleteQuoteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /quotes][%d] deleteQuoteUnauthorized %+v", 401, o.Payload) } - func (o *DeleteQuoteUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteQuoteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -150,7 +155,7 @@ func NewDeleteQuoteForbidden() *DeleteQuoteForbidden { return &DeleteQuoteForbidden{} } -/*DeleteQuoteForbidden handles this case with default header values. +/* DeleteQuoteForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteQuoteForbidden struct { func (o *DeleteQuoteForbidden) Error() string { return fmt.Sprintf("[DELETE /quotes][%d] deleteQuoteForbidden %+v", 403, o.Payload) } - func (o *DeleteQuoteForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteQuoteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -188,7 +196,7 @@ func NewDeleteQuoteNotFound() *DeleteQuoteNotFound { return &DeleteQuoteNotFound{} } -/*DeleteQuoteNotFound handles this case with default header values. +/* DeleteQuoteNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteQuoteNotFound struct { func (o *DeleteQuoteNotFound) Error() string { return fmt.Sprintf("[DELETE /quotes][%d] deleteQuoteNotFound %+v", 404, o.Payload) } - func (o *DeleteQuoteNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteQuoteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -226,7 +237,7 @@ func NewDeleteQuoteUnprocessableEntity() *DeleteQuoteUnprocessableEntity { return &DeleteQuoteUnprocessableEntity{} } -/*DeleteQuoteUnprocessableEntity handles this case with default header values. +/* DeleteQuoteUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteQuoteUnprocessableEntity struct { func (o *DeleteQuoteUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /quotes][%d] deleteQuoteUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteQuoteUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteQuoteUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -264,7 +278,7 @@ func NewDeleteQuoteInternalServerError() *DeleteQuoteInternalServerError { return &DeleteQuoteInternalServerError{} } -/*DeleteQuoteInternalServerError handles this case with default header values. +/* DeleteQuoteInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteQuoteInternalServerError struct { func (o *DeleteQuoteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /quotes][%d] deleteQuoteInternalServerError %+v", 500, o.Payload) } - func (o *DeleteQuoteInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *DeleteQuoteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/quote/get_quotes_parameters.go b/api/ops/ops_client/quote/get_quotes_parameters.go index f275317..d6ff133 100644 --- a/api/ops/ops_client/quote/get_quotes_parameters.go +++ b/api/ops/ops_client/quote/get_quotes_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetQuotesParams creates a new GetQuotesParams object -// with the default values initialized. +// NewGetQuotesParams creates a new GetQuotesParams 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 NewGetQuotesParams() *GetQuotesParams { - var () return &GetQuotesParams{ - timeout: cr.DefaultTimeout, } } // NewGetQuotesParamsWithTimeout creates a new GetQuotesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetQuotesParamsWithTimeout(timeout time.Duration) *GetQuotesParams { - var () return &GetQuotesParams{ - timeout: timeout, } } // NewGetQuotesParamsWithContext creates a new GetQuotesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetQuotesParamsWithContext(ctx context.Context) *GetQuotesParams { - var () return &GetQuotesParams{ - Context: ctx, } } // NewGetQuotesParamsWithHTTPClient creates a new GetQuotesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetQuotesParamsWithHTTPClient(client *http.Client) *GetQuotesParams { - var () return &GetQuotesParams{ HTTPClient: client, } } -/*GetQuotesParams contains all the parameters to send to the API endpoint -for the get quotes operation typically these are written to a http.Request +/* GetQuotesParams contains all the parameters to send to the API endpoint + for the get quotes operation. + + Typically these are written to a http.Request. */ type GetQuotesParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*QuoteID - Taxnexus Record Id of a Quote + /* QuoteID. + + Taxnexus Record Id of a Quote */ QuoteID *string @@ -86,6 +91,21 @@ type GetQuotesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetQuotesParams) WithDefaults() *GetQuotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetQuotesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get quotes params func (o *GetQuotesParams) WithTimeout(timeout time.Duration) *GetQuotesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetQuotesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // 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 o.QuoteID != nil { // query param quoteId var qrQuoteID string + if o.QuoteID != nil { qrQuoteID = *o.QuoteID } qQuoteID := qrQuoteID if qQuoteID != "" { + if err := r.SetQueryParam("quoteId", qQuoteID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/ops/ops_client/quote/get_quotes_responses.go b/api/ops/ops_client/quote/get_quotes_responses.go index 5442504..e77a335 100644 --- a/api/ops/ops_client/quote/get_quotes_responses.go +++ b/api/ops/ops_client/quote/get_quotes_responses.go @@ -63,9 +63,8 @@ func (o *GetQuotesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetQuotesOK() *GetQuotesOK { return &GetQuotesOK{} } -/*GetQuotesOK handles this case with default header values. +/* GetQuotesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Quote objects */ type GetQuotesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.QuoteResponse } @@ -89,18 +87,25 @@ type GetQuotesOK struct { func (o *GetQuotesOK) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesOK %+v", 200, o.Payload) } - func (o *GetQuotesOK) GetPayload() *ops_models.QuoteResponse { return o.Payload } func (o *GetQuotesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.QuoteResponse) @@ -117,7 +122,7 @@ func NewGetQuotesUnauthorized() *GetQuotesUnauthorized { return &GetQuotesUnauthorized{} } -/*GetQuotesUnauthorized handles this case with default header values. +/* GetQuotesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetQuotesUnauthorized struct { func (o *GetQuotesUnauthorized) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesUnauthorized %+v", 401, o.Payload) } - func (o *GetQuotesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *GetQuotesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewGetQuotesForbidden() *GetQuotesForbidden { return &GetQuotesForbidden{} } -/*GetQuotesForbidden handles this case with default header values. +/* GetQuotesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetQuotesForbidden struct { func (o *GetQuotesForbidden) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesForbidden %+v", 403, o.Payload) } - func (o *GetQuotesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *GetQuotesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewGetQuotesNotFound() *GetQuotesNotFound { return &GetQuotesNotFound{} } -/*GetQuotesNotFound handles this case with default header values. +/* GetQuotesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetQuotesNotFound struct { func (o *GetQuotesNotFound) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesNotFound %+v", 404, o.Payload) } - func (o *GetQuotesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *GetQuotesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewGetQuotesUnprocessableEntity() *GetQuotesUnprocessableEntity { return &GetQuotesUnprocessableEntity{} } -/*GetQuotesUnprocessableEntity handles this case with default header values. +/* GetQuotesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetQuotesUnprocessableEntity struct { func (o *GetQuotesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetQuotesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *GetQuotesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewGetQuotesInternalServerError() *GetQuotesInternalServerError { return &GetQuotesInternalServerError{} } -/*GetQuotesInternalServerError handles this case with default header values. +/* GetQuotesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetQuotesInternalServerError struct { func (o *GetQuotesInternalServerError) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesInternalServerError %+v", 500, o.Payload) } - func (o *GetQuotesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *GetQuotesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/quote/post_quotes_parameters.go b/api/ops/ops_client/quote/post_quotes_parameters.go index 3b1e567..4e2efba 100644 --- a/api/ops/ops_client/quote/post_quotes_parameters.go +++ b/api/ops/ops_client/quote/post_quotes_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostQuotesParams creates a new PostQuotesParams object -// with the default values initialized. +// NewPostQuotesParams creates a new PostQuotesParams 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 NewPostQuotesParams() *PostQuotesParams { - var () return &PostQuotesParams{ - timeout: cr.DefaultTimeout, } } // NewPostQuotesParamsWithTimeout creates a new PostQuotesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostQuotesParamsWithTimeout(timeout time.Duration) *PostQuotesParams { - var () return &PostQuotesParams{ - timeout: timeout, } } // NewPostQuotesParamsWithContext creates a new PostQuotesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostQuotesParamsWithContext(ctx context.Context) *PostQuotesParams { - var () return &PostQuotesParams{ - Context: ctx, } } // NewPostQuotesParamsWithHTTPClient creates a new PostQuotesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostQuotesParamsWithHTTPClient(client *http.Client) *PostQuotesParams { - var () return &PostQuotesParams{ HTTPClient: client, } } -/*PostQuotesParams contains all the parameters to send to the API endpoint -for the post quotes operation typically these are written to a http.Request +/* PostQuotesParams contains all the parameters to send to the API endpoint + for the post quotes operation. + + Typically these are written to a http.Request. */ type PostQuotesParams struct { - /*QuoteRequest - A request with an array of Quote Objects + /* QuoteRequest. + A request with an array of Quote Objects */ QuoteRequest *ops_models.QuoteRequest @@ -77,6 +76,21 @@ type PostQuotesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostQuotesParams) WithDefaults() *PostQuotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostQuotesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post quotes params func (o *PostQuotesParams) WithTimeout(timeout time.Duration) *PostQuotesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostQuotesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.QuoteRequest != nil { if err := r.SetBodyParam(o.QuoteRequest); err != nil { return err diff --git a/api/ops/ops_client/quote/post_quotes_responses.go b/api/ops/ops_client/quote/post_quotes_responses.go index e6acea9..24cde1a 100644 --- a/api/ops/ops_client/quote/post_quotes_responses.go +++ b/api/ops/ops_client/quote/post_quotes_responses.go @@ -63,9 +63,8 @@ func (o *PostQuotesReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostQuotesOK() *PostQuotesOK { return &PostQuotesOK{} } -/*PostQuotesOK handles this case with default header values. +/* PostQuotesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Quote objects */ type PostQuotesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.QuoteResponse } @@ -89,18 +87,25 @@ type PostQuotesOK struct { func (o *PostQuotesOK) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesOK %+v", 200, o.Payload) } - func (o *PostQuotesOK) GetPayload() *ops_models.QuoteResponse { return o.Payload } func (o *PostQuotesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.QuoteResponse) @@ -117,7 +122,7 @@ func NewPostQuotesUnauthorized() *PostQuotesUnauthorized { return &PostQuotesUnauthorized{} } -/*PostQuotesUnauthorized handles this case with default header values. +/* PostQuotesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostQuotesUnauthorized struct { func (o *PostQuotesUnauthorized) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesUnauthorized %+v", 401, o.Payload) } - func (o *PostQuotesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostQuotesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostQuotesForbidden() *PostQuotesForbidden { return &PostQuotesForbidden{} } -/*PostQuotesForbidden handles this case with default header values. +/* PostQuotesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostQuotesForbidden struct { func (o *PostQuotesForbidden) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesForbidden %+v", 403, o.Payload) } - func (o *PostQuotesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostQuotesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostQuotesNotFound() *PostQuotesNotFound { return &PostQuotesNotFound{} } -/*PostQuotesNotFound handles this case with default header values. +/* PostQuotesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostQuotesNotFound struct { func (o *PostQuotesNotFound) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesNotFound %+v", 404, o.Payload) } - func (o *PostQuotesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostQuotesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostQuotesUnprocessableEntity() *PostQuotesUnprocessableEntity { return &PostQuotesUnprocessableEntity{} } -/*PostQuotesUnprocessableEntity handles this case with default header values. +/* PostQuotesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostQuotesUnprocessableEntity struct { func (o *PostQuotesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostQuotesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostQuotesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostQuotesInternalServerError() *PostQuotesInternalServerError { return &PostQuotesInternalServerError{} } -/*PostQuotesInternalServerError handles this case with default header values. +/* PostQuotesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostQuotesInternalServerError struct { func (o *PostQuotesInternalServerError) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesInternalServerError %+v", 500, o.Payload) } - func (o *PostQuotesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostQuotesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/quote/put_quotes_parameters.go b/api/ops/ops_client/quote/put_quotes_parameters.go index 01bf56a..84d9cae 100644 --- a/api/ops/ops_client/quote/put_quotes_parameters.go +++ b/api/ops/ops_client/quote/put_quotes_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPutQuotesParams creates a new PutQuotesParams object -// with the default values initialized. +// NewPutQuotesParams creates a new PutQuotesParams 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 NewPutQuotesParams() *PutQuotesParams { - var () return &PutQuotesParams{ - timeout: cr.DefaultTimeout, } } // NewPutQuotesParamsWithTimeout creates a new PutQuotesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutQuotesParamsWithTimeout(timeout time.Duration) *PutQuotesParams { - var () return &PutQuotesParams{ - timeout: timeout, } } // NewPutQuotesParamsWithContext creates a new PutQuotesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutQuotesParamsWithContext(ctx context.Context) *PutQuotesParams { - var () return &PutQuotesParams{ - Context: ctx, } } // NewPutQuotesParamsWithHTTPClient creates a new PutQuotesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutQuotesParamsWithHTTPClient(client *http.Client) *PutQuotesParams { - var () return &PutQuotesParams{ HTTPClient: client, } } -/*PutQuotesParams contains all the parameters to send to the API endpoint -for the put quotes operation typically these are written to a http.Request +/* PutQuotesParams contains all the parameters to send to the API endpoint + for the put quotes operation. + + Typically these are written to a http.Request. */ type PutQuotesParams struct { - /*QuoteRequest - A request with an array of Quote Objects + /* QuoteRequest. + A request with an array of Quote Objects */ QuoteRequest *ops_models.QuoteRequest @@ -77,6 +76,21 @@ type PutQuotesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutQuotesParams) WithDefaults() *PutQuotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutQuotesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put quotes params func (o *PutQuotesParams) WithTimeout(timeout time.Duration) *PutQuotesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutQuotesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.QuoteRequest != nil { if err := r.SetBodyParam(o.QuoteRequest); err != nil { return err diff --git a/api/ops/ops_client/quote/put_quotes_responses.go b/api/ops/ops_client/quote/put_quotes_responses.go index 63a3f2d..3f85c2d 100644 --- a/api/ops/ops_client/quote/put_quotes_responses.go +++ b/api/ops/ops_client/quote/put_quotes_responses.go @@ -63,9 +63,8 @@ func (o *PutQuotesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutQuotesOK() *PutQuotesOK { return &PutQuotesOK{} } -/*PutQuotesOK handles this case with default header values. +/* PutQuotesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Quote objects */ type PutQuotesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.QuoteResponse } @@ -89,18 +87,25 @@ type PutQuotesOK struct { func (o *PutQuotesOK) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesOK %+v", 200, o.Payload) } - func (o *PutQuotesOK) GetPayload() *ops_models.QuoteResponse { return o.Payload } func (o *PutQuotesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.QuoteResponse) @@ -117,7 +122,7 @@ func NewPutQuotesUnauthorized() *PutQuotesUnauthorized { return &PutQuotesUnauthorized{} } -/*PutQuotesUnauthorized handles this case with default header values. +/* PutQuotesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutQuotesUnauthorized struct { func (o *PutQuotesUnauthorized) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesUnauthorized %+v", 401, o.Payload) } - func (o *PutQuotesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PutQuotesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPutQuotesForbidden() *PutQuotesForbidden { return &PutQuotesForbidden{} } -/*PutQuotesForbidden handles this case with default header values. +/* PutQuotesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutQuotesForbidden struct { func (o *PutQuotesForbidden) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesForbidden %+v", 403, o.Payload) } - func (o *PutQuotesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PutQuotesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPutQuotesNotFound() *PutQuotesNotFound { return &PutQuotesNotFound{} } -/*PutQuotesNotFound handles this case with default header values. +/* PutQuotesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutQuotesNotFound struct { func (o *PutQuotesNotFound) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesNotFound %+v", 404, o.Payload) } - func (o *PutQuotesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PutQuotesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPutQuotesUnprocessableEntity() *PutQuotesUnprocessableEntity { return &PutQuotesUnprocessableEntity{} } -/*PutQuotesUnprocessableEntity handles this case with default header values. +/* PutQuotesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutQuotesUnprocessableEntity struct { func (o *PutQuotesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutQuotesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PutQuotesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPutQuotesInternalServerError() *PutQuotesInternalServerError { return &PutQuotesInternalServerError{} } -/*PutQuotesInternalServerError handles this case with default header values. +/* PutQuotesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutQuotesInternalServerError struct { func (o *PutQuotesInternalServerError) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesInternalServerError %+v", 500, o.Payload) } - func (o *PutQuotesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PutQuotesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/quote/quote_client.go b/api/ops/ops_client/quote/quote_client.go index c9eb626..53855ab 100644 --- a/api/ops/ops_client/quote/quote_client.go +++ b/api/ops/ops_client/quote/quote_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteQuote(params *DeleteQuoteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteQuoteOK, error) + DeleteQuote(params *DeleteQuoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteQuoteOK, error) - GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*GetQuotesOK, error) + GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetQuotesOK, error) - PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PostQuotesOK, error) + PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostQuotesOK, error) - PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PutQuotesOK, error) + PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutQuotesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete quote by ID */ -func (a *Client) DeleteQuote(params *DeleteQuoteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteQuoteOK, error) { +func (a *Client) DeleteQuote(params *DeleteQuoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteQuoteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteQuoteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteQuote", Method: "DELETE", PathPattern: "/quotes", @@ -65,7 +67,12 @@ func (a *Client) DeleteQuote(params *DeleteQuoteParams, authInfo runtime.ClientA 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteQuote(params *DeleteQuoteParams, authInfo runtime.ClientA Return a list of available quotes */ -func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*GetQuotesOK, error) { +func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetQuotesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetQuotesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getQuotes", Method: "GET", PathPattern: "/quotes", @@ -102,7 +108,12 @@ func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthI 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 } @@ -121,13 +132,12 @@ func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthI Create New Quotes */ -func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PostQuotesOK, error) { +func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostQuotesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostQuotesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postQuotes", Method: "POST", PathPattern: "/quotes", @@ -139,7 +149,12 @@ func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAut 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 } @@ -158,13 +173,12 @@ func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAut Put a list of Quotes */ -func (a *Client) PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PutQuotesOK, error) { +func (a *Client) PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutQuotesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutQuotesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putQuotes", Method: "PUT", PathPattern: "/quotes", @@ -176,7 +190,12 @@ func (a *Client) PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/ops/ops_client/tax/post_taxes_invoices_parameters.go b/api/ops/ops_client/tax/post_taxes_invoices_parameters.go index 3674265..e218a8d 100644 --- a/api/ops/ops_client/tax/post_taxes_invoices_parameters.go +++ b/api/ops/ops_client/tax/post_taxes_invoices_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostTaxesInvoicesParams creates a new PostTaxesInvoicesParams object -// with the default values initialized. +// NewPostTaxesInvoicesParams creates a new PostTaxesInvoicesParams 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 NewPostTaxesInvoicesParams() *PostTaxesInvoicesParams { - var () return &PostTaxesInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxesInvoicesParamsWithTimeout creates a new PostTaxesInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxesInvoicesParamsWithTimeout(timeout time.Duration) *PostTaxesInvoicesParams { - var () return &PostTaxesInvoicesParams{ - timeout: timeout, } } // NewPostTaxesInvoicesParamsWithContext creates a new PostTaxesInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxesInvoicesParamsWithContext(ctx context.Context) *PostTaxesInvoicesParams { - var () return &PostTaxesInvoicesParams{ - Context: ctx, } } // NewPostTaxesInvoicesParamsWithHTTPClient creates a new PostTaxesInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxesInvoicesParamsWithHTTPClient(client *http.Client) *PostTaxesInvoicesParams { - var () return &PostTaxesInvoicesParams{ HTTPClient: client, } } -/*PostTaxesInvoicesParams contains all the parameters to send to the API endpoint -for the post taxes invoices operation typically these are written to a http.Request +/* PostTaxesInvoicesParams contains all the parameters to send to the API endpoint + for the post taxes invoices operation. + + Typically these are written to a http.Request. */ type PostTaxesInvoicesParams struct { - /*InvoiceRequest - A request with an array of Invoice Objects + /* InvoiceRequest. + A request with an array of Invoice Objects */ InvoiceRequest *ops_models.InvoiceRequest @@ -77,6 +76,21 @@ type PostTaxesInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post taxes invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesInvoicesParams) WithDefaults() *PostTaxesInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post taxes invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post taxes invoices params func (o *PostTaxesInvoicesParams) WithTimeout(timeout time.Duration) *PostTaxesInvoicesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxesInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.InvoiceRequest != nil { if err := r.SetBodyParam(o.InvoiceRequest); err != nil { return err diff --git a/api/ops/ops_client/tax/post_taxes_invoices_responses.go b/api/ops/ops_client/tax/post_taxes_invoices_responses.go index aaf8ae7..165c95a 100644 --- a/api/ops/ops_client/tax/post_taxes_invoices_responses.go +++ b/api/ops/ops_client/tax/post_taxes_invoices_responses.go @@ -63,9 +63,8 @@ func (o *PostTaxesInvoicesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTaxesInvoicesOK() *PostTaxesInvoicesOK { return &PostTaxesInvoicesOK{} } -/*PostTaxesInvoicesOK handles this case with default header values. +/* PostTaxesInvoicesOK describes a response with status code 200, with default header values. Taxnexus Response with Tax Transaction Objects */ type PostTaxesInvoicesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.TaxTransactionResponse } @@ -89,18 +87,25 @@ type PostTaxesInvoicesOK struct { func (o *PostTaxesInvoicesOK) Error() string { return fmt.Sprintf("[POST /taxes/invoices][%d] postTaxesInvoicesOK %+v", 200, o.Payload) } - func (o *PostTaxesInvoicesOK) GetPayload() *ops_models.TaxTransactionResponse { return o.Payload } func (o *PostTaxesInvoicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.TaxTransactionResponse) @@ -117,7 +122,7 @@ func NewPostTaxesInvoicesUnauthorized() *PostTaxesInvoicesUnauthorized { return &PostTaxesInvoicesUnauthorized{} } -/*PostTaxesInvoicesUnauthorized handles this case with default header values. +/* PostTaxesInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTaxesInvoicesUnauthorized struct { func (o *PostTaxesInvoicesUnauthorized) Error() string { return fmt.Sprintf("[POST /taxes/invoices][%d] postTaxesInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxesInvoicesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesInvoicesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostTaxesInvoicesForbidden() *PostTaxesInvoicesForbidden { return &PostTaxesInvoicesForbidden{} } -/*PostTaxesInvoicesForbidden handles this case with default header values. +/* PostTaxesInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTaxesInvoicesForbidden struct { func (o *PostTaxesInvoicesForbidden) Error() string { return fmt.Sprintf("[POST /taxes/invoices][%d] postTaxesInvoicesForbidden %+v", 403, o.Payload) } - func (o *PostTaxesInvoicesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesInvoicesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostTaxesInvoicesNotFound() *PostTaxesInvoicesNotFound { return &PostTaxesInvoicesNotFound{} } -/*PostTaxesInvoicesNotFound handles this case with default header values. +/* PostTaxesInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTaxesInvoicesNotFound struct { func (o *PostTaxesInvoicesNotFound) Error() string { return fmt.Sprintf("[POST /taxes/invoices][%d] postTaxesInvoicesNotFound %+v", 404, o.Payload) } - func (o *PostTaxesInvoicesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesInvoicesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostTaxesInvoicesUnprocessableEntity() *PostTaxesInvoicesUnprocessableEn return &PostTaxesInvoicesUnprocessableEntity{} } -/*PostTaxesInvoicesUnprocessableEntity handles this case with default header values. +/* PostTaxesInvoicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTaxesInvoicesUnprocessableEntity struct { func (o *PostTaxesInvoicesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /taxes/invoices][%d] postTaxesInvoicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTaxesInvoicesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesInvoicesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostTaxesInvoicesInternalServerError() *PostTaxesInvoicesInternalServerE return &PostTaxesInvoicesInternalServerError{} } -/*PostTaxesInvoicesInternalServerError handles this case with default header values. +/* PostTaxesInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTaxesInvoicesInternalServerError struct { func (o *PostTaxesInvoicesInternalServerError) Error() string { return fmt.Sprintf("[POST /taxes/invoices][%d] postTaxesInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxesInvoicesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesInvoicesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/tax/post_taxes_orders_parameters.go b/api/ops/ops_client/tax/post_taxes_orders_parameters.go index cf739cd..953cd34 100644 --- a/api/ops/ops_client/tax/post_taxes_orders_parameters.go +++ b/api/ops/ops_client/tax/post_taxes_orders_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostTaxesOrdersParams creates a new PostTaxesOrdersParams object -// with the default values initialized. +// NewPostTaxesOrdersParams creates a new PostTaxesOrdersParams 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 NewPostTaxesOrdersParams() *PostTaxesOrdersParams { - var () return &PostTaxesOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxesOrdersParamsWithTimeout creates a new PostTaxesOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxesOrdersParamsWithTimeout(timeout time.Duration) *PostTaxesOrdersParams { - var () return &PostTaxesOrdersParams{ - timeout: timeout, } } // NewPostTaxesOrdersParamsWithContext creates a new PostTaxesOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxesOrdersParamsWithContext(ctx context.Context) *PostTaxesOrdersParams { - var () return &PostTaxesOrdersParams{ - Context: ctx, } } // NewPostTaxesOrdersParamsWithHTTPClient creates a new PostTaxesOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxesOrdersParamsWithHTTPClient(client *http.Client) *PostTaxesOrdersParams { - var () return &PostTaxesOrdersParams{ HTTPClient: client, } } -/*PostTaxesOrdersParams contains all the parameters to send to the API endpoint -for the post taxes orders operation typically these are written to a http.Request +/* PostTaxesOrdersParams contains all the parameters to send to the API endpoint + for the post taxes orders operation. + + Typically these are written to a http.Request. */ type PostTaxesOrdersParams struct { - /*OrderRequest - A request with an array of Order Objects + /* OrderRequest. + A request with an array of Order Objects */ OrderRequest *ops_models.OrderRequest @@ -77,6 +76,21 @@ type PostTaxesOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post taxes orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesOrdersParams) WithDefaults() *PostTaxesOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post taxes orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post taxes orders params func (o *PostTaxesOrdersParams) WithTimeout(timeout time.Duration) *PostTaxesOrdersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxesOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.OrderRequest != nil { if err := r.SetBodyParam(o.OrderRequest); err != nil { return err diff --git a/api/ops/ops_client/tax/post_taxes_orders_responses.go b/api/ops/ops_client/tax/post_taxes_orders_responses.go index 9b99cc8..0837dad 100644 --- a/api/ops/ops_client/tax/post_taxes_orders_responses.go +++ b/api/ops/ops_client/tax/post_taxes_orders_responses.go @@ -63,9 +63,8 @@ func (o *PostTaxesOrdersReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTaxesOrdersOK() *PostTaxesOrdersOK { return &PostTaxesOrdersOK{} } -/*PostTaxesOrdersOK handles this case with default header values. +/* PostTaxesOrdersOK describes a response with status code 200, with default header values. Taxnexus Response with Tax Transaction Objects */ type PostTaxesOrdersOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.TaxTransactionResponse } @@ -89,18 +87,25 @@ type PostTaxesOrdersOK struct { func (o *PostTaxesOrdersOK) Error() string { return fmt.Sprintf("[POST /taxes/orders][%d] postTaxesOrdersOK %+v", 200, o.Payload) } - func (o *PostTaxesOrdersOK) GetPayload() *ops_models.TaxTransactionResponse { return o.Payload } func (o *PostTaxesOrdersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.TaxTransactionResponse) @@ -117,7 +122,7 @@ func NewPostTaxesOrdersUnauthorized() *PostTaxesOrdersUnauthorized { return &PostTaxesOrdersUnauthorized{} } -/*PostTaxesOrdersUnauthorized handles this case with default header values. +/* PostTaxesOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTaxesOrdersUnauthorized struct { func (o *PostTaxesOrdersUnauthorized) Error() string { return fmt.Sprintf("[POST /taxes/orders][%d] postTaxesOrdersUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxesOrdersUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesOrdersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostTaxesOrdersForbidden() *PostTaxesOrdersForbidden { return &PostTaxesOrdersForbidden{} } -/*PostTaxesOrdersForbidden handles this case with default header values. +/* PostTaxesOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTaxesOrdersForbidden struct { func (o *PostTaxesOrdersForbidden) Error() string { return fmt.Sprintf("[POST /taxes/orders][%d] postTaxesOrdersForbidden %+v", 403, o.Payload) } - func (o *PostTaxesOrdersForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesOrdersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostTaxesOrdersNotFound() *PostTaxesOrdersNotFound { return &PostTaxesOrdersNotFound{} } -/*PostTaxesOrdersNotFound handles this case with default header values. +/* PostTaxesOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTaxesOrdersNotFound struct { func (o *PostTaxesOrdersNotFound) Error() string { return fmt.Sprintf("[POST /taxes/orders][%d] postTaxesOrdersNotFound %+v", 404, o.Payload) } - func (o *PostTaxesOrdersNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesOrdersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostTaxesOrdersUnprocessableEntity() *PostTaxesOrdersUnprocessableEntity return &PostTaxesOrdersUnprocessableEntity{} } -/*PostTaxesOrdersUnprocessableEntity handles this case with default header values. +/* PostTaxesOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTaxesOrdersUnprocessableEntity struct { func (o *PostTaxesOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /taxes/orders][%d] postTaxesOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTaxesOrdersUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesOrdersUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostTaxesOrdersInternalServerError() *PostTaxesOrdersInternalServerError return &PostTaxesOrdersInternalServerError{} } -/*PostTaxesOrdersInternalServerError handles this case with default header values. +/* PostTaxesOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTaxesOrdersInternalServerError struct { func (o *PostTaxesOrdersInternalServerError) Error() string { return fmt.Sprintf("[POST /taxes/orders][%d] postTaxesOrdersInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxesOrdersInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesOrdersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/tax/post_taxes_pos_parameters.go b/api/ops/ops_client/tax/post_taxes_pos_parameters.go index 4847899..4fb5ff9 100644 --- a/api/ops/ops_client/tax/post_taxes_pos_parameters.go +++ b/api/ops/ops_client/tax/post_taxes_pos_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostTaxesPosParams creates a new PostTaxesPosParams object -// with the default values initialized. +// NewPostTaxesPosParams creates a new PostTaxesPosParams 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 NewPostTaxesPosParams() *PostTaxesPosParams { - var () return &PostTaxesPosParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxesPosParamsWithTimeout creates a new PostTaxesPosParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxesPosParamsWithTimeout(timeout time.Duration) *PostTaxesPosParams { - var () return &PostTaxesPosParams{ - timeout: timeout, } } // NewPostTaxesPosParamsWithContext creates a new PostTaxesPosParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxesPosParamsWithContext(ctx context.Context) *PostTaxesPosParams { - var () return &PostTaxesPosParams{ - Context: ctx, } } // NewPostTaxesPosParamsWithHTTPClient creates a new PostTaxesPosParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxesPosParamsWithHTTPClient(client *http.Client) *PostTaxesPosParams { - var () return &PostTaxesPosParams{ HTTPClient: client, } } -/*PostTaxesPosParams contains all the parameters to send to the API endpoint -for the post taxes pos operation typically these are written to a http.Request +/* PostTaxesPosParams contains all the parameters to send to the API endpoint + for the post taxes pos operation. + + Typically these are written to a http.Request. */ type PostTaxesPosParams struct { - /*PurchaseOrderRequest - A request with an array of Purchase Order Objects + /* PurchaseOrderRequest. + A request with an array of Purchase Order Objects */ PurchaseOrderRequest *ops_models.PurchaseOrderRequest @@ -77,6 +76,21 @@ type PostTaxesPosParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post taxes pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesPosParams) WithDefaults() *PostTaxesPosParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post taxes pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesPosParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post taxes pos params func (o *PostTaxesPosParams) WithTimeout(timeout time.Duration) *PostTaxesPosParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxesPosParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.PurchaseOrderRequest != nil { if err := r.SetBodyParam(o.PurchaseOrderRequest); err != nil { return err diff --git a/api/ops/ops_client/tax/post_taxes_pos_responses.go b/api/ops/ops_client/tax/post_taxes_pos_responses.go index 6b9a268..23945eb 100644 --- a/api/ops/ops_client/tax/post_taxes_pos_responses.go +++ b/api/ops/ops_client/tax/post_taxes_pos_responses.go @@ -63,9 +63,8 @@ func (o *PostTaxesPosReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTaxesPosOK() *PostTaxesPosOK { return &PostTaxesPosOK{} } -/*PostTaxesPosOK handles this case with default header values. +/* PostTaxesPosOK describes a response with status code 200, with default header values. Taxnexus Response with Tax Transaction Objects */ type PostTaxesPosOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.TaxTransactionResponse } @@ -89,18 +87,25 @@ type PostTaxesPosOK struct { func (o *PostTaxesPosOK) Error() string { return fmt.Sprintf("[POST /taxes/pos][%d] postTaxesPosOK %+v", 200, o.Payload) } - func (o *PostTaxesPosOK) GetPayload() *ops_models.TaxTransactionResponse { return o.Payload } func (o *PostTaxesPosOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.TaxTransactionResponse) @@ -117,7 +122,7 @@ func NewPostTaxesPosUnauthorized() *PostTaxesPosUnauthorized { return &PostTaxesPosUnauthorized{} } -/*PostTaxesPosUnauthorized handles this case with default header values. +/* PostTaxesPosUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTaxesPosUnauthorized struct { func (o *PostTaxesPosUnauthorized) Error() string { return fmt.Sprintf("[POST /taxes/pos][%d] postTaxesPosUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxesPosUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesPosUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostTaxesPosForbidden() *PostTaxesPosForbidden { return &PostTaxesPosForbidden{} } -/*PostTaxesPosForbidden handles this case with default header values. +/* PostTaxesPosForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTaxesPosForbidden struct { func (o *PostTaxesPosForbidden) Error() string { return fmt.Sprintf("[POST /taxes/pos][%d] postTaxesPosForbidden %+v", 403, o.Payload) } - func (o *PostTaxesPosForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesPosForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostTaxesPosNotFound() *PostTaxesPosNotFound { return &PostTaxesPosNotFound{} } -/*PostTaxesPosNotFound handles this case with default header values. +/* PostTaxesPosNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTaxesPosNotFound struct { func (o *PostTaxesPosNotFound) Error() string { return fmt.Sprintf("[POST /taxes/pos][%d] postTaxesPosNotFound %+v", 404, o.Payload) } - func (o *PostTaxesPosNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesPosNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostTaxesPosUnprocessableEntity() *PostTaxesPosUnprocessableEntity { return &PostTaxesPosUnprocessableEntity{} } -/*PostTaxesPosUnprocessableEntity handles this case with default header values. +/* PostTaxesPosUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTaxesPosUnprocessableEntity struct { func (o *PostTaxesPosUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /taxes/pos][%d] postTaxesPosUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTaxesPosUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesPosUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostTaxesPosInternalServerError() *PostTaxesPosInternalServerError { return &PostTaxesPosInternalServerError{} } -/*PostTaxesPosInternalServerError handles this case with default header values. +/* PostTaxesPosInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTaxesPosInternalServerError struct { func (o *PostTaxesPosInternalServerError) Error() string { return fmt.Sprintf("[POST /taxes/pos][%d] postTaxesPosInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxesPosInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesPosInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/tax/post_taxes_quotes_parameters.go b/api/ops/ops_client/tax/post_taxes_quotes_parameters.go index 45517df..3fe4d65 100644 --- a/api/ops/ops_client/tax/post_taxes_quotes_parameters.go +++ b/api/ops/ops_client/tax/post_taxes_quotes_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_models" ) -// NewPostTaxesQuotesParams creates a new PostTaxesQuotesParams object -// with the default values initialized. +// NewPostTaxesQuotesParams creates a new PostTaxesQuotesParams 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 NewPostTaxesQuotesParams() *PostTaxesQuotesParams { - var () return &PostTaxesQuotesParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxesQuotesParamsWithTimeout creates a new PostTaxesQuotesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxesQuotesParamsWithTimeout(timeout time.Duration) *PostTaxesQuotesParams { - var () return &PostTaxesQuotesParams{ - timeout: timeout, } } // NewPostTaxesQuotesParamsWithContext creates a new PostTaxesQuotesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxesQuotesParamsWithContext(ctx context.Context) *PostTaxesQuotesParams { - var () return &PostTaxesQuotesParams{ - Context: ctx, } } // NewPostTaxesQuotesParamsWithHTTPClient creates a new PostTaxesQuotesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxesQuotesParamsWithHTTPClient(client *http.Client) *PostTaxesQuotesParams { - var () return &PostTaxesQuotesParams{ HTTPClient: client, } } -/*PostTaxesQuotesParams contains all the parameters to send to the API endpoint -for the post taxes quotes operation typically these are written to a http.Request +/* PostTaxesQuotesParams contains all the parameters to send to the API endpoint + for the post taxes quotes operation. + + Typically these are written to a http.Request. */ type PostTaxesQuotesParams struct { - /*QuoteRequest - A request with an array of Quote Objects + /* QuoteRequest. + A request with an array of Quote Objects */ QuoteRequest *ops_models.QuoteRequest @@ -77,6 +76,21 @@ type PostTaxesQuotesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post taxes quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesQuotesParams) WithDefaults() *PostTaxesQuotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post taxes quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxesQuotesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post taxes quotes params func (o *PostTaxesQuotesParams) WithTimeout(timeout time.Duration) *PostTaxesQuotesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxesQuotesParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.QuoteRequest != nil { if err := r.SetBodyParam(o.QuoteRequest); err != nil { return err diff --git a/api/ops/ops_client/tax/post_taxes_quotes_responses.go b/api/ops/ops_client/tax/post_taxes_quotes_responses.go index 42edbfc..4afa6b5 100644 --- a/api/ops/ops_client/tax/post_taxes_quotes_responses.go +++ b/api/ops/ops_client/tax/post_taxes_quotes_responses.go @@ -63,9 +63,8 @@ func (o *PostTaxesQuotesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTaxesQuotesOK() *PostTaxesQuotesOK { return &PostTaxesQuotesOK{} } -/*PostTaxesQuotesOK handles this case with default header values. +/* PostTaxesQuotesOK describes a response with status code 200, with default header values. Taxnexus Response with Tax Transaction Objects */ type PostTaxesQuotesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *ops_models.TaxTransactionResponse } @@ -89,18 +87,25 @@ type PostTaxesQuotesOK struct { func (o *PostTaxesQuotesOK) Error() string { return fmt.Sprintf("[POST /taxes/quotes][%d] postTaxesQuotesOK %+v", 200, o.Payload) } - func (o *PostTaxesQuotesOK) GetPayload() *ops_models.TaxTransactionResponse { return o.Payload } func (o *PostTaxesQuotesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(ops_models.TaxTransactionResponse) @@ -117,7 +122,7 @@ func NewPostTaxesQuotesUnauthorized() *PostTaxesQuotesUnauthorized { return &PostTaxesQuotesUnauthorized{} } -/*PostTaxesQuotesUnauthorized handles this case with default header values. +/* PostTaxesQuotesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTaxesQuotesUnauthorized struct { func (o *PostTaxesQuotesUnauthorized) Error() string { return fmt.Sprintf("[POST /taxes/quotes][%d] postTaxesQuotesUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxesQuotesUnauthorized) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesQuotesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -155,7 +163,7 @@ func NewPostTaxesQuotesForbidden() *PostTaxesQuotesForbidden { return &PostTaxesQuotesForbidden{} } -/*PostTaxesQuotesForbidden handles this case with default header values. +/* PostTaxesQuotesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTaxesQuotesForbidden struct { func (o *PostTaxesQuotesForbidden) Error() string { return fmt.Sprintf("[POST /taxes/quotes][%d] postTaxesQuotesForbidden %+v", 403, o.Payload) } - func (o *PostTaxesQuotesForbidden) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesQuotesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -193,7 +204,7 @@ func NewPostTaxesQuotesNotFound() *PostTaxesQuotesNotFound { return &PostTaxesQuotesNotFound{} } -/*PostTaxesQuotesNotFound handles this case with default header values. +/* PostTaxesQuotesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTaxesQuotesNotFound struct { func (o *PostTaxesQuotesNotFound) Error() string { return fmt.Sprintf("[POST /taxes/quotes][%d] postTaxesQuotesNotFound %+v", 404, o.Payload) } - func (o *PostTaxesQuotesNotFound) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesQuotesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -231,7 +245,7 @@ func NewPostTaxesQuotesUnprocessableEntity() *PostTaxesQuotesUnprocessableEntity return &PostTaxesQuotesUnprocessableEntity{} } -/*PostTaxesQuotesUnprocessableEntity handles this case with default header values. +/* PostTaxesQuotesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTaxesQuotesUnprocessableEntity struct { func (o *PostTaxesQuotesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /taxes/quotes][%d] postTaxesQuotesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTaxesQuotesUnprocessableEntity) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesQuotesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) @@ -269,7 +286,7 @@ func NewPostTaxesQuotesInternalServerError() *PostTaxesQuotesInternalServerError return &PostTaxesQuotesInternalServerError{} } -/*PostTaxesQuotesInternalServerError handles this case with default header values. +/* PostTaxesQuotesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTaxesQuotesInternalServerError struct { func (o *PostTaxesQuotesInternalServerError) Error() string { return fmt.Sprintf("[POST /taxes/quotes][%d] postTaxesQuotesInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxesQuotesInternalServerError) GetPayload() *ops_models.Error { return o.Payload } func (o *PostTaxesQuotesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(ops_models.Error) diff --git a/api/ops/ops_client/tax/tax_client.go b/api/ops/ops_client/tax/tax_client.go index 3b92da2..cd0e946 100644 --- a/api/ops/ops_client/tax/tax_client.go +++ b/api/ops/ops_client/tax/tax_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - PostTaxesInvoices(params *PostTaxesInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesInvoicesOK, error) + PostTaxesInvoices(params *PostTaxesInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesInvoicesOK, error) - PostTaxesOrders(params *PostTaxesOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesOrdersOK, error) + PostTaxesOrders(params *PostTaxesOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesOrdersOK, error) - PostTaxesPos(params *PostTaxesPosParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesPosOK, error) + PostTaxesPos(params *PostTaxesPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesPosOK, error) - PostTaxesQuotes(params *PostTaxesQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesQuotesOK, error) + PostTaxesQuotes(params *PostTaxesQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesQuotesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Rate a list of invoices */ -func (a *Client) PostTaxesInvoices(params *PostTaxesInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesInvoicesOK, error) { +func (a *Client) PostTaxesInvoices(params *PostTaxesInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxesInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxesInvoices", Method: "POST", PathPattern: "/taxes/invoices", @@ -65,7 +67,12 @@ func (a *Client) PostTaxesInvoices(params *PostTaxesInvoicesParams, authInfo run 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 } @@ -84,13 +91,12 @@ func (a *Client) PostTaxesInvoices(params *PostTaxesInvoicesParams, authInfo run Rate a list of invoices */ -func (a *Client) PostTaxesOrders(params *PostTaxesOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesOrdersOK, error) { +func (a *Client) PostTaxesOrders(params *PostTaxesOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxesOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxesOrders", Method: "POST", PathPattern: "/taxes/orders", @@ -102,7 +108,12 @@ func (a *Client) PostTaxesOrders(params *PostTaxesOrdersParams, authInfo runtime 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 } @@ -121,13 +132,12 @@ func (a *Client) PostTaxesOrders(params *PostTaxesOrdersParams, authInfo runtime Rate a list of purchase orders */ -func (a *Client) PostTaxesPos(params *PostTaxesPosParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesPosOK, error) { +func (a *Client) PostTaxesPos(params *PostTaxesPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesPosOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxesPosParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxesPos", Method: "POST", PathPattern: "/taxes/pos", @@ -139,7 +149,12 @@ func (a *Client) PostTaxesPos(params *PostTaxesPosParams, authInfo runtime.Clien 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 } @@ -158,13 +173,12 @@ func (a *Client) PostTaxesPos(params *PostTaxesPosParams, authInfo runtime.Clien Rate a list of quotes */ -func (a *Client) PostTaxesQuotes(params *PostTaxesQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxesQuotesOK, error) { +func (a *Client) PostTaxesQuotes(params *PostTaxesQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxesQuotesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxesQuotesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxesQuotes", Method: "POST", PathPattern: "/taxes/quotes", @@ -176,7 +190,12 @@ func (a *Client) PostTaxesQuotes(params *PostTaxesQuotesParams, authInfo runtime 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 } diff --git a/api/ops/ops_models/address.go b/api/ops/ops_models/address.go index 52e3246..4826a0c 100644 --- a/api/ops/ops_models/address.go +++ b/api/ops/ops_models/address.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *Address) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this address based on context it is used +func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Address) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/cash_receipt.go b/api/ops/ops_models/cash_receipt.go index e78979d..417993c 100644 --- a/api/ops/ops_models/cash_receipt.go +++ b/api/ops/ops_models/cash_receipt.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -130,6 +132,11 @@ func (m *CashReceipt) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cash receipt based on context it is used +func (m *CashReceipt) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CashReceipt) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/cash_receipt_request.go b/api/ops/ops_models/cash_receipt_request.go index db10bf0..655f078 100644 --- a/api/ops/ops_models/cash_receipt_request.go +++ b/api/ops/ops_models/cash_receipt_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *CashReceiptRequest) Validate(formats strfmt.Registry) error { } func (m *CashReceiptRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *CashReceiptRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cash receipt request based on the context it is used +func (m *CashReceiptRequest) 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 *CashReceiptRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CashReceiptRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/cash_receipt_response.go b/api/ops/ops_models/cash_receipt_response.go index 09400f6..79162c7 100644 --- a/api/ops/ops_models/cash_receipt_response.go +++ b/api/ops/ops_models/cash_receipt_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CashReceiptResponse) Validate(formats strfmt.Registry) error { } func (m *CashReceiptResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CashReceiptResponse) validateData(formats strfmt.Registry) error { } func (m *CashReceiptResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CashReceiptResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cash receipt response based on the context it is used +func (m *CashReceiptResponse) 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 *CashReceiptResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CashReceiptResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CashReceiptResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/charge.go b/api/ops/ops_models/charge.go index 9da73d0..6051657 100644 --- a/api/ops/ops_models/charge.go +++ b/api/ops/ops_models/charge.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -106,6 +108,11 @@ func (m *Charge) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this charge based on context it is used +func (m *Charge) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Charge) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/charge_request.go b/api/ops/ops_models/charge_request.go index 7407367..53cff92 100644 --- a/api/ops/ops_models/charge_request.go +++ b/api/ops/ops_models/charge_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *ChargeRequest) Validate(formats strfmt.Registry) error { } func (m *ChargeRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *ChargeRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this charge request based on the context it is used +func (m *ChargeRequest) 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 *ChargeRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ChargeRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/charge_response.go b/api/ops/ops_models/charge_response.go index 49aac57..44f67e5 100644 --- a/api/ops/ops_models/charge_response.go +++ b/api/ops/ops_models/charge_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ChargeResponse) Validate(formats strfmt.Registry) error { } func (m *ChargeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ChargeResponse) validateData(formats strfmt.Registry) error { } func (m *ChargeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ChargeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this charge response based on the context it is used +func (m *ChargeResponse) 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 *ChargeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ChargeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ChargeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/contract.go b/api/ops/ops_models/contract.go index 77d4297..49a23d0 100644 --- a/api/ops/ops_models/contract.go +++ b/api/ops/ops_models/contract.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -79,6 +81,11 @@ func (m *Contract) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this contract based on context it is used +func (m *Contract) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Contract) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/credit_card.go b/api/ops/ops_models/credit_card.go index 99b0ffc..ffe85c1 100644 --- a/api/ops/ops_models/credit_card.go +++ b/api/ops/ops_models/credit_card.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -67,6 +69,11 @@ func (m *CreditCard) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this credit card based on context it is used +func (m *CreditCard) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CreditCard) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/delete_response.go b/api/ops/ops_models/delete_response.go index 0b89f07..7aa34c4 100644 --- a/api/ops/ops_models/delete_response.go +++ b/api/ops/ops_models/delete_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error { } func (m *DeleteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error { } func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this delete response based on the context it is used +func (m *DeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DeleteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DeleteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/eft.go b/api/ops/ops_models/eft.go index b16114e..e0eaa53 100644 --- a/api/ops/ops_models/eft.go +++ b/api/ops/ops_models/eft.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -110,7 +111,6 @@ func (m *Eft) Validate(formats strfmt.Registry) error { } func (m *Eft) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -134,6 +134,38 @@ func (m *Eft) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this eft based on the context it is used +func (m *Eft) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Eft) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Eft) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/eft_item.go b/api/ops/ops_models/eft_item.go index 1599268..c3f8eb0 100644 --- a/api/ops/ops_models/eft_item.go +++ b/api/ops/ops_models/eft_item.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -52,6 +54,11 @@ func (m *EftItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this eft item based on context it is used +func (m *EftItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *EftItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/eft_request.go b/api/ops/ops_models/eft_request.go index c75e5e4..42e8279 100644 --- a/api/ops/ops_models/eft_request.go +++ b/api/ops/ops_models/eft_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *EftRequest) Validate(formats strfmt.Registry) error { } func (m *EftRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *EftRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this eft request based on the context it is used +func (m *EftRequest) 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 *EftRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *EftRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/eft_response.go b/api/ops/ops_models/eft_response.go index 64571de..0bf401f 100644 --- a/api/ops/ops_models/eft_response.go +++ b/api/ops/ops_models/eft_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *EftResponse) Validate(formats strfmt.Registry) error { } func (m *EftResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *EftResponse) validateData(formats strfmt.Registry) error { } func (m *EftResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *EftResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this eft response based on the context it is used +func (m *EftResponse) 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 *EftResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *EftResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *EftResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/error.go b/api/ops/ops_models/error.go index 36a2d4e..bc63062 100644 --- a/api/ops/ops_models/error.go +++ b/api/ops/ops_models/error.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/invalid_error.go b/api/ops/ops_models/invalid_error.go index fffa88b..714c84f 100644 --- a/api/ops/ops_models/invalid_error.go +++ b/api/ops/ops_models/invalid_error.go @@ -10,6 +10,8 @@ package ops_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/invoice.go b/api/ops/ops_models/invoice.go index fec2da5..f8e0b21 100644 --- a/api/ops/ops_models/invoice.go +++ b/api/ops/ops_models/invoice.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -334,7 +335,6 @@ func (m *Invoice) Validate(formats strfmt.Registry) error { } func (m *Invoice) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -352,7 +352,6 @@ func (m *Invoice) validateBillingAddress(formats strfmt.Registry) error { } func (m *Invoice) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -370,7 +369,6 @@ func (m *Invoice) validateBusinessAddress(formats strfmt.Registry) error { } func (m *Invoice) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -395,7 +393,6 @@ func (m *Invoice) validateItems(formats strfmt.Registry) error { } func (m *Invoice) validateShippingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingAddress) { // not required return nil } @@ -413,7 +410,6 @@ func (m *Invoice) validateShippingAddress(formats strfmt.Registry) error { } func (m *Invoice) validateTaxTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTransactions) { // not required return nil } @@ -438,7 +434,6 @@ func (m *Invoice) validateTaxTransactions(formats strfmt.Registry) error { } func (m *Invoice) validateTotal(formats strfmt.Registry) error { - if swag.IsZero(m.Total) { // not required return nil } @@ -455,6 +450,132 @@ func (m *Invoice) validateTotal(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice based on the context it is used +func (m *Invoice) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Invoice) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *Invoice) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *Invoice) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Invoice) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingAddress != nil { + if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingAddress") + } + return err + } + } + + return nil +} + +func (m *Invoice) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTransactions); i++ { + + if m.TaxTransactions[i] != nil { + if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Invoice) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error { + + if m.Total != nil { + if err := m.Total.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Total") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Invoice) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/invoice_basic.go b/api/ops/ops_models/invoice_basic.go index 377ee9e..ce4c536 100644 --- a/api/ops/ops_models/invoice_basic.go +++ b/api/ops/ops_models/invoice_basic.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -140,7 +141,6 @@ func (m *InvoiceBasic) Validate(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -158,7 +158,6 @@ func (m *InvoiceBasic) validateBusinessAddress(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -183,7 +182,6 @@ func (m *InvoiceBasic) validateItems(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateTaxTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTransactions) { // not required return nil } @@ -208,7 +206,6 @@ func (m *InvoiceBasic) validateTaxTransactions(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateTotal(formats strfmt.Registry) error { - if swag.IsZero(m.Total) { // not required return nil } @@ -225,6 +222,96 @@ func (m *InvoiceBasic) validateTotal(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice basic based on the context it is used +func (m *InvoiceBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InvoiceBasic) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *InvoiceBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceBasic) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTransactions); i++ { + + if m.TaxTransactions[i] != nil { + if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceBasic) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error { + + if m.Total != nil { + if err := m.Total.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Total") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/invoice_item.go b/api/ops/ops_models/invoice_item.go index d602786..655a430 100644 --- a/api/ops/ops_models/invoice_item.go +++ b/api/ops/ops_models/invoice_item.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -112,6 +114,11 @@ func (m *InvoiceItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this invoice item based on context it is used +func (m *InvoiceItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *InvoiceItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/invoice_request.go b/api/ops/ops_models/invoice_request.go index 4a089de..00d9284 100644 --- a/api/ops/ops_models/invoice_request.go +++ b/api/ops/ops_models/invoice_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *InvoiceRequest) Validate(formats strfmt.Registry) error { } func (m *InvoiceRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *InvoiceRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice request based on the context it is used +func (m *InvoiceRequest) 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 *InvoiceRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/invoice_response.go b/api/ops/ops_models/invoice_response.go index 2871e54..74cee55 100644 --- a/api/ops/ops_models/invoice_response.go +++ b/api/ops/ops_models/invoice_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *InvoiceResponse) Validate(formats strfmt.Registry) error { } func (m *InvoiceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *InvoiceResponse) validateData(formats strfmt.Registry) error { } func (m *InvoiceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *InvoiceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice response based on the context it is used +func (m *InvoiceResponse) 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 *InvoiceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/item_basic.go b/api/ops/ops_models/item_basic.go index 7b16e28..f3f0dd2 100644 --- a/api/ops/ops_models/item_basic.go +++ b/api/ops/ops_models/item_basic.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -64,6 +66,11 @@ func (m *ItemBasic) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this item basic based on context it is used +func (m *ItemBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ItemBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/message.go b/api/ops/ops_models/message.go index 0162520..582568e 100644 --- a/api/ops/ops_models/message.go +++ b/api/ops/ops_models/message.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/order.go b/api/ops/ops_models/order.go index 53ab6e4..ddc4d0e 100644 --- a/api/ops/ops_models/order.go +++ b/api/ops/ops_models/order.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -292,7 +293,6 @@ func (m *Order) Validate(formats strfmt.Registry) error { } func (m *Order) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -310,7 +310,6 @@ func (m *Order) validateBillingAddress(formats strfmt.Registry) error { } func (m *Order) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -328,7 +327,6 @@ func (m *Order) validateBusinessAddress(formats strfmt.Registry) error { } func (m *Order) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -353,7 +351,6 @@ func (m *Order) validateItems(formats strfmt.Registry) error { } func (m *Order) validateShippingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingAddress) { // not required return nil } @@ -371,7 +368,6 @@ func (m *Order) validateShippingAddress(formats strfmt.Registry) error { } func (m *Order) validateTaxTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTransactions) { // not required return nil } @@ -396,7 +392,6 @@ func (m *Order) validateTaxTransactions(formats strfmt.Registry) error { } func (m *Order) validateTotal(formats strfmt.Registry) error { - if swag.IsZero(m.Total) { // not required return nil } @@ -413,6 +408,132 @@ func (m *Order) validateTotal(formats strfmt.Registry) error { return nil } +// ContextValidate validate this order based on the context it is used +func (m *Order) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Order) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *Order) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *Order) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Order) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingAddress != nil { + if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingAddress") + } + return err + } + } + + return nil +} + +func (m *Order) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTransactions); i++ { + + if m.TaxTransactions[i] != nil { + if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Order) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error { + + if m.Total != nil { + if err := m.Total.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Total") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Order) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/order_item.go b/api/ops/ops_models/order_item.go index 3d0846c..6dbc495 100644 --- a/api/ops/ops_models/order_item.go +++ b/api/ops/ops_models/order_item.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -151,6 +153,11 @@ func (m *OrderItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this order item based on context it is used +func (m *OrderItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *OrderItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/order_request.go b/api/ops/ops_models/order_request.go index b68a6d3..a2ea38d 100644 --- a/api/ops/ops_models/order_request.go +++ b/api/ops/ops_models/order_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *OrderRequest) Validate(formats strfmt.Registry) error { } func (m *OrderRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *OrderRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this order request based on the context it is used +func (m *OrderRequest) 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 *OrderRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *OrderRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/order_response.go b/api/ops/ops_models/order_response.go index eb59a11..1216e4a 100644 --- a/api/ops/ops_models/order_response.go +++ b/api/ops/ops_models/order_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *OrderResponse) Validate(formats strfmt.Registry) error { } func (m *OrderResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *OrderResponse) validateData(formats strfmt.Registry) error { } func (m *OrderResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *OrderResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this order response based on the context it is used +func (m *OrderResponse) 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 *OrderResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *OrderResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OrderResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/pagination.go b/api/ops/ops_models/pagination.go index ef77545..6fcb66a 100644 --- a/api/ops/ops_models/pagination.go +++ b/api/ops/ops_models/pagination.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/payment_method.go b/api/ops/ops_models/payment_method.go index 8ef5808..53fc336 100644 --- a/api/ops/ops_models/payment_method.go +++ b/api/ops/ops_models/payment_method.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -106,6 +108,11 @@ func (m *PaymentMethod) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this payment method based on context it is used +func (m *PaymentMethod) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PaymentMethod) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/payment_method_request.go b/api/ops/ops_models/payment_method_request.go index a095d96..093c96d 100644 --- a/api/ops/ops_models/payment_method_request.go +++ b/api/ops/ops_models/payment_method_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *PaymentMethodRequest) Validate(formats strfmt.Registry) error { } func (m *PaymentMethodRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *PaymentMethodRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this payment method request based on the context it is used +func (m *PaymentMethodRequest) 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 *PaymentMethodRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PaymentMethodRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/payment_method_response.go b/api/ops/ops_models/payment_method_response.go index 2702d1c..d89627e 100644 --- a/api/ops/ops_models/payment_method_response.go +++ b/api/ops/ops_models/payment_method_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PaymentMethodResponse) Validate(formats strfmt.Registry) error { } func (m *PaymentMethodResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PaymentMethodResponse) validateData(formats strfmt.Registry) error { } func (m *PaymentMethodResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PaymentMethodResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this payment method response based on the context it is used +func (m *PaymentMethodResponse) 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 *PaymentMethodResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PaymentMethodResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PaymentMethodResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/pricebook.go b/api/ops/ops_models/pricebook.go index 2629960..d8b3c37 100644 --- a/api/ops/ops_models/pricebook.go +++ b/api/ops/ops_models/pricebook.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -55,6 +57,11 @@ func (m *Pricebook) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pricebook based on context it is used +func (m *Pricebook) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pricebook) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/pricebook_entry.go b/api/ops/ops_models/pricebook_entry.go index be7df92..85c46c5 100644 --- a/api/ops/ops_models/pricebook_entry.go +++ b/api/ops/ops_models/pricebook_entry.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -64,6 +66,11 @@ func (m *PricebookEntry) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pricebook entry based on context it is used +func (m *PricebookEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PricebookEntry) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/product.go b/api/ops/ops_models/product.go index b6b57cf..a876541 100644 --- a/api/ops/ops_models/product.go +++ b/api/ops/ops_models/product.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -142,6 +144,11 @@ func (m *Product) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this product based on context it is used +func (m *Product) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Product) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/product_request.go b/api/ops/ops_models/product_request.go index b3a2475..84a2e1d 100644 --- a/api/ops/ops_models/product_request.go +++ b/api/ops/ops_models/product_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *ProductRequest) Validate(formats strfmt.Registry) error { } func (m *ProductRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *ProductRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this product request based on the context it is used +func (m *ProductRequest) 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 *ProductRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/product_response.go b/api/ops/ops_models/product_response.go index 365a10c..fba96ad 100644 --- a/api/ops/ops_models/product_response.go +++ b/api/ops/ops_models/product_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ProductResponse) Validate(formats strfmt.Registry) error { } func (m *ProductResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ProductResponse) validateData(formats strfmt.Registry) error { } func (m *ProductResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ProductResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this product response based on the context it is used +func (m *ProductResponse) 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 *ProductResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/purchase_order.go b/api/ops/ops_models/purchase_order.go index 235e621..67d3870 100644 --- a/api/ops/ops_models/purchase_order.go +++ b/api/ops/ops_models/purchase_order.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -250,7 +251,6 @@ func (m *PurchaseOrder) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -268,7 +268,6 @@ func (m *PurchaseOrder) validateBillingAddress(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -286,7 +285,6 @@ func (m *PurchaseOrder) validateBusinessAddress(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -311,7 +309,6 @@ func (m *PurchaseOrder) validateItems(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateShippingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingAddress) { // not required return nil } @@ -329,7 +326,6 @@ func (m *PurchaseOrder) validateShippingAddress(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateTaxTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTransactions) { // not required return nil } @@ -354,7 +350,6 @@ func (m *PurchaseOrder) validateTaxTransactions(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateTotal(formats strfmt.Registry) error { - if swag.IsZero(m.Total) { // not required return nil } @@ -371,6 +366,132 @@ func (m *PurchaseOrder) validateTotal(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order based on the context it is used +func (m *PurchaseOrder) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrder) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrder) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrder) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrder) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingAddress != nil { + if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingAddress") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrder) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTransactions); i++ { + + if m.TaxTransactions[i] != nil { + if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrder) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error { + + if m.Total != nil { + if err := m.Total.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Total") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrder) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/purchase_order_item.go b/api/ops/ops_models/purchase_order_item.go index e6d5569..62ef39f 100644 --- a/api/ops/ops_models/purchase_order_item.go +++ b/api/ops/ops_models/purchase_order_item.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -118,6 +120,11 @@ func (m *PurchaseOrderItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this purchase order item based on context it is used +func (m *PurchaseOrderItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/purchase_order_request.go b/api/ops/ops_models/purchase_order_request.go index d1e3803..5624a29 100644 --- a/api/ops/ops_models/purchase_order_request.go +++ b/api/ops/ops_models/purchase_order_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *PurchaseOrderRequest) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *PurchaseOrderRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order request based on the context it is used +func (m *PurchaseOrderRequest) 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 *PurchaseOrderRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/purchase_order_response.go b/api/ops/ops_models/purchase_order_response.go index f163430..cb8c519 100644 --- a/api/ops/ops_models/purchase_order_response.go +++ b/api/ops/ops_models/purchase_order_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PurchaseOrderResponse) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PurchaseOrderResponse) validateData(formats strfmt.Registry) error { } func (m *PurchaseOrderResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PurchaseOrderResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order response based on the context it is used +func (m *PurchaseOrderResponse) 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 *PurchaseOrderResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/put_response.go b/api/ops/ops_models/put_response.go index aa65706..c1931bd 100644 --- a/api/ops/ops_models/put_response.go +++ b/api/ops/ops_models/put_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PutResponse) Validate(formats strfmt.Registry) error { } func (m *PutResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PutResponse) validateData(formats strfmt.Registry) error { } func (m *PutResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PutResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this put response based on the context it is used +func (m *PutResponse) 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 *PutResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PutResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PutResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/quote.go b/api/ops/ops_models/quote.go index 71d3b1e..55677c6 100644 --- a/api/ops/ops_models/quote.go +++ b/api/ops/ops_models/quote.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -282,7 +283,6 @@ func (m *Quote) Validate(formats strfmt.Registry) error { } func (m *Quote) validateAdditionalAddress(formats strfmt.Registry) error { - if swag.IsZero(m.AdditionalAddress) { // not required return nil } @@ -300,7 +300,6 @@ func (m *Quote) validateAdditionalAddress(formats strfmt.Registry) error { } func (m *Quote) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -318,7 +317,6 @@ func (m *Quote) validateBillingAddress(formats strfmt.Registry) error { } func (m *Quote) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -336,7 +334,6 @@ func (m *Quote) validateBusinessAddress(formats strfmt.Registry) error { } func (m *Quote) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -361,7 +358,6 @@ func (m *Quote) validateItems(formats strfmt.Registry) error { } func (m *Quote) validateQuoteToAddress(formats strfmt.Registry) error { - if swag.IsZero(m.QuoteToAddress) { // not required return nil } @@ -379,7 +375,6 @@ func (m *Quote) validateQuoteToAddress(formats strfmt.Registry) error { } func (m *Quote) validateShippingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingAddress) { // not required return nil } @@ -397,7 +392,6 @@ func (m *Quote) validateShippingAddress(formats strfmt.Registry) error { } func (m *Quote) validateTaxTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTransactions) { // not required return nil } @@ -422,7 +416,6 @@ func (m *Quote) validateTaxTransactions(formats strfmt.Registry) error { } func (m *Quote) validateTotal(formats strfmt.Registry) error { - if swag.IsZero(m.Total) { // not required return nil } @@ -439,6 +432,168 @@ func (m *Quote) validateTotal(formats strfmt.Registry) error { return nil } +// ContextValidate validate this quote based on the context it is used +func (m *Quote) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdditionalAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQuoteToAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Quote) contextValidateAdditionalAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.AdditionalAddress != nil { + if err := m.AdditionalAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("AdditionalAddress") + } + return err + } + } + + return nil +} + +func (m *Quote) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *Quote) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *Quote) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Quote) contextValidateQuoteToAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.QuoteToAddress != nil { + if err := m.QuoteToAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("QuoteToAddress") + } + return err + } + } + + return nil +} + +func (m *Quote) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingAddress != nil { + if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingAddress") + } + return err + } + } + + return nil +} + +func (m *Quote) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTransactions); i++ { + + if m.TaxTransactions[i] != nil { + if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Quote) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error { + + if m.Total != nil { + if err := m.Total.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Total") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Quote) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/quote_basic.go b/api/ops/ops_models/quote_basic.go index ca29169..6d36a79 100644 --- a/api/ops/ops_models/quote_basic.go +++ b/api/ops/ops_models/quote_basic.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -134,7 +135,6 @@ func (m *QuoteBasic) Validate(formats strfmt.Registry) error { } func (m *QuoteBasic) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -152,7 +152,6 @@ func (m *QuoteBasic) validateBusinessAddress(formats strfmt.Registry) error { } func (m *QuoteBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -177,7 +176,6 @@ func (m *QuoteBasic) validateItems(formats strfmt.Registry) error { } func (m *QuoteBasic) validateTaxTransactions(formats strfmt.Registry) error { - if swag.IsZero(m.TaxTransactions) { // not required return nil } @@ -202,7 +200,6 @@ func (m *QuoteBasic) validateTaxTransactions(formats strfmt.Registry) error { } func (m *QuoteBasic) validateTotal(formats strfmt.Registry) error { - if swag.IsZero(m.Total) { // not required return nil } @@ -219,6 +216,96 @@ func (m *QuoteBasic) validateTotal(formats strfmt.Registry) error { return nil } +// ContextValidate validate this quote basic based on the context it is used +func (m *QuoteBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *QuoteBasic) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *QuoteBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *QuoteBasic) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxTransactions); i++ { + + if m.TaxTransactions[i] != nil { + if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *QuoteBasic) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error { + + if m.Total != nil { + if err := m.Total.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Total") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *QuoteBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/quote_item.go b/api/ops/ops_models/quote_item.go index 6976dfb..573e6e3 100644 --- a/api/ops/ops_models/quote_item.go +++ b/api/ops/ops_models/quote_item.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -106,6 +108,11 @@ func (m *QuoteItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this quote item based on context it is used +func (m *QuoteItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *QuoteItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/quote_request.go b/api/ops/ops_models/quote_request.go index 7a000c9..b5a3837 100644 --- a/api/ops/ops_models/quote_request.go +++ b/api/ops/ops_models/quote_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *QuoteRequest) Validate(formats strfmt.Registry) error { } func (m *QuoteRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *QuoteRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this quote request based on the context it is used +func (m *QuoteRequest) 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 *QuoteRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *QuoteRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/quote_response.go b/api/ops/ops_models/quote_response.go index 4ec12a2..0826351 100644 --- a/api/ops/ops_models/quote_response.go +++ b/api/ops/ops_models/quote_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *QuoteResponse) Validate(formats strfmt.Registry) error { } func (m *QuoteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *QuoteResponse) validateData(formats strfmt.Registry) error { } func (m *QuoteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *QuoteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this quote response based on the context it is used +func (m *QuoteResponse) 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 *QuoteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *QuoteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *QuoteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/response_meta.go b/api/ops/ops_models/response_meta.go index 4d494a2..8cc749b 100644 --- a/api/ops/ops_models/response_meta.go +++ b/api/ops/ops_models/response_meta.go @@ -10,6 +10,8 @@ package ops_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/subscription.go b/api/ops/ops_models/subscription.go index a20ac4d..a3b4ea0 100644 --- a/api/ops/ops_models/subscription.go +++ b/api/ops/ops_models/subscription.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -130,6 +132,11 @@ func (m *Subscription) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this subscription based on context it is used +func (m *Subscription) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Subscription) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/subscription_request.go b/api/ops/ops_models/subscription_request.go index 9864f82..f4f0a79 100644 --- a/api/ops/ops_models/subscription_request.go +++ b/api/ops/ops_models/subscription_request.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *SubscriptionRequest) Validate(formats strfmt.Registry) error { } func (m *SubscriptionRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *SubscriptionRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this subscription request based on the context it is used +func (m *SubscriptionRequest) 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 *SubscriptionRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *SubscriptionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/subscription_response.go b/api/ops/ops_models/subscription_response.go index 1ec412b..d699893 100644 --- a/api/ops/ops_models/subscription_response.go +++ b/api/ops/ops_models/subscription_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SubscriptionResponse) Validate(formats strfmt.Registry) error { } func (m *SubscriptionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SubscriptionResponse) validateData(formats strfmt.Registry) error { } func (m *SubscriptionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SubscriptionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this subscription response based on the context it is used +func (m *SubscriptionResponse) 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 *SubscriptionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SubscriptionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SubscriptionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/tax_transaction.go b/api/ops/ops_models/tax_transaction.go index f33f3e0..d91a056 100644 --- a/api/ops/ops_models/tax_transaction.go +++ b/api/ops/ops_models/tax_transaction.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -163,6 +165,11 @@ func (m *TaxTransaction) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax transaction based on context it is used +func (m *TaxTransaction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxTransaction) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/tax_transaction_response.go b/api/ops/ops_models/tax_transaction_response.go index 565aca8..999bd2d 100644 --- a/api/ops/ops_models/tax_transaction_response.go +++ b/api/ops/ops_models/tax_transaction_response.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxTransactionResponse) Validate(formats strfmt.Registry) error { } func (m *TaxTransactionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxTransactionResponse) validateData(formats strfmt.Registry) error { } func (m *TaxTransactionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxTransactionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax transaction response based on the context it is used +func (m *TaxTransactionResponse) 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 *TaxTransactionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxTransactionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTransactionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/total.go b/api/ops/ops_models/total.go index 1c36a5a..d8b187f 100644 --- a/api/ops/ops_models/total.go +++ b/api/ops/ops_models/total.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -101,7 +102,6 @@ func (m *Total) Validate(formats strfmt.Registry) error { } func (m *Total) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -125,6 +125,38 @@ func (m *Total) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this total based on the context it is used +func (m *Total) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Total) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Total) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/total_item.go b/api/ops/ops_models/total_item.go index 5b2a816..922eebf 100644 --- a/api/ops/ops_models/total_item.go +++ b/api/ops/ops_models/total_item.go @@ -10,6 +10,7 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -56,7 +57,6 @@ func (m *TotalItem) Validate(formats strfmt.Registry) error { } func (m *TotalItem) validateTaxItems(formats strfmt.Registry) error { - if swag.IsZero(m.TaxItems) { // not required return nil } @@ -80,6 +80,38 @@ func (m *TotalItem) validateTaxItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this total item based on the context it is used +func (m *TotalItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TotalItem) contextValidateTaxItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxItems); i++ { + + if m.TaxItems[i] != nil { + if err := m.TaxItems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TaxItems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TotalItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/ops/ops_models/total_tax_item.go b/api/ops/ops_models/total_tax_item.go index 92cfd0d..af07b35 100644 --- a/api/ops/ops_models/total_tax_item.go +++ b/api/ops/ops_models/total_tax_item.go @@ -10,6 +10,8 @@ package ops_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *TotalTaxItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this total tax item based on context it is used +func (m *TotalTaxItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TotalTaxItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/pdf/pdf_client/pdf/get_p_d_f_parameters.go b/api/pdf/pdf_client/pdf/get_p_d_f_parameters.go index bfca45f..ca0c603 100644 --- a/api/pdf/pdf_client/pdf/get_p_d_f_parameters.go +++ b/api/pdf/pdf_client/pdf/get_p_d_f_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetPDFParams creates a new GetPDFParams object -// with the default values initialized. +// NewGetPDFParams creates a new GetPDFParams 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 NewGetPDFParams() *GetPDFParams { - var () return &GetPDFParams{ - timeout: cr.DefaultTimeout, } } // NewGetPDFParamsWithTimeout creates a new GetPDFParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPDFParamsWithTimeout(timeout time.Duration) *GetPDFParams { - var () return &GetPDFParams{ - timeout: timeout, } } // NewGetPDFParamsWithContext creates a new GetPDFParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPDFParamsWithContext(ctx context.Context) *GetPDFParams { - var () return &GetPDFParams{ - Context: ctx, } } // NewGetPDFParamsWithHTTPClient creates a new GetPDFParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPDFParamsWithHTTPClient(client *http.Client) *GetPDFParams { - var () return &GetPDFParams{ HTTPClient: client, } } -/*GetPDFParams contains all the parameters to send to the API endpoint -for the get p d f operation typically these are written to a http.Request +/* GetPDFParams contains all the parameters to send to the API endpoint + for the get p d f operation. + + Typically these are written to a http.Request. */ type GetPDFParams struct { - /*PdfID - Taxnexus Record ID + /* PdfID. + Taxnexus Record ID */ PdfID string @@ -75,6 +74,21 @@ type GetPDFParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get p d f params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPDFParams) WithDefaults() *GetPDFParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get p d f params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPDFParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get p d f params func (o *GetPDFParams) WithTimeout(timeout time.Duration) *GetPDFParams { o.SetTimeout(timeout) diff --git a/api/pdf/pdf_client/pdf/get_p_d_f_responses.go b/api/pdf/pdf_client/pdf/get_p_d_f_responses.go index 4202780..faf6e6c 100644 --- a/api/pdf/pdf_client/pdf/get_p_d_f_responses.go +++ b/api/pdf/pdf_client/pdf/get_p_d_f_responses.go @@ -66,31 +66,36 @@ func (o *GetPDFReader) ReadResponse(response runtime.ClientResponse, consumer ru return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } // NewGetPDFOK creates a GetPDFOK with default headers values func NewGetPDFOK(writer io.Writer) *GetPDFOK { return &GetPDFOK{ + Payload: writer, } } -/*GetPDFOK handles this case with default header values. +/* GetPDFOK describes a response with status code 200, with default header values. A PDF file */ type GetPDFOK struct { - /*Specifies download file name + + /* Specifies download file name */ ContentDisposition string - /*The size of the file - */ + + /* The size of the file + + Format: int32 + */ ContentLength int32 - /*The URL of the document + + /* The URL of the document */ ContentLocation string @@ -100,25 +105,36 @@ type GetPDFOK struct { func (o *GetPDFOK) Error() string { return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFOK %+v", 200, o.Payload) } - func (o *GetPDFOK) GetPayload() io.Writer { return o.Payload } func (o *GetPDFOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Content-Disposition - o.ContentDisposition = response.GetHeader("Content-Disposition") + // hydrates response header Content-Disposition + hdrContentDisposition := response.GetHeader("Content-Disposition") - // response header Content-Length - contentLength, err := swag.ConvertInt32(response.GetHeader("Content-Length")) - if err != nil { - return errors.InvalidType("Content-Length", "header", "int32", response.GetHeader("Content-Length")) + if hdrContentDisposition != "" { + o.ContentDisposition = hdrContentDisposition } - o.ContentLength = contentLength - // response header Content-Location - o.ContentLocation = response.GetHeader("Content-Location") + // hydrates response header Content-Length + hdrContentLength := response.GetHeader("Content-Length") + + if hdrContentLength != "" { + valcontentLength, err := swag.ConvertInt32(hdrContentLength) + if err != nil { + return errors.InvalidType("Content-Length", "header", "int32", hdrContentLength) + } + o.ContentLength = valcontentLength + } + + // hydrates response header Content-Location + hdrContentLocation := response.GetHeader("Content-Location") + + if hdrContentLocation != "" { + o.ContentLocation = hdrContentLocation + } // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { @@ -133,7 +149,7 @@ func NewGetPDFUnauthorized() *GetPDFUnauthorized { return &GetPDFUnauthorized{} } -/*GetPDFUnauthorized handles this case with default header values. +/* GetPDFUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -144,7 +160,6 @@ type GetPDFUnauthorized struct { func (o *GetPDFUnauthorized) Error() string { return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFUnauthorized %+v", 401, o.Payload) } - func (o *GetPDFUnauthorized) GetPayload() *pdf_models.Error { return o.Payload } @@ -166,7 +181,7 @@ func NewGetPDFForbidden() *GetPDFForbidden { return &GetPDFForbidden{} } -/*GetPDFForbidden handles this case with default header values. +/* GetPDFForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -177,7 +192,6 @@ type GetPDFForbidden struct { func (o *GetPDFForbidden) Error() string { return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFForbidden %+v", 403, o.Payload) } - func (o *GetPDFForbidden) GetPayload() *pdf_models.Error { return o.Payload } @@ -199,7 +213,7 @@ func NewGetPDFNotFound() *GetPDFNotFound { return &GetPDFNotFound{} } -/*GetPDFNotFound handles this case with default header values. +/* GetPDFNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -210,7 +224,6 @@ type GetPDFNotFound struct { func (o *GetPDFNotFound) Error() string { return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFNotFound %+v", 404, o.Payload) } - func (o *GetPDFNotFound) GetPayload() *pdf_models.Error { return o.Payload } @@ -232,7 +245,7 @@ func NewGetPDFUnprocessableEntity() *GetPDFUnprocessableEntity { return &GetPDFUnprocessableEntity{} } -/*GetPDFUnprocessableEntity handles this case with default header values. +/* GetPDFUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -243,7 +256,6 @@ type GetPDFUnprocessableEntity struct { func (o *GetPDFUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPDFUnprocessableEntity) GetPayload() *pdf_models.Error { return o.Payload } @@ -265,7 +277,7 @@ func NewGetPDFInternalServerError() *GetPDFInternalServerError { return &GetPDFInternalServerError{} } -/*GetPDFInternalServerError handles this case with default header values. +/* GetPDFInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -276,7 +288,6 @@ type GetPDFInternalServerError struct { func (o *GetPDFInternalServerError) Error() string { return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFInternalServerError %+v", 500, o.Payload) } - func (o *GetPDFInternalServerError) GetPayload() *pdf_models.Error { return o.Payload } diff --git a/api/pdf/pdf_client/pdf/pdf_client.go b/api/pdf/pdf_client/pdf/pdf_client.go index a53238d..e66a932 100644 --- a/api/pdf/pdf_client/pdf/pdf_client.go +++ b/api/pdf/pdf_client/pdf/pdf_client.go @@ -30,9 +30,12 @@ type Client struct { 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 { - GetPDF(params *GetPDFParams, writer io.Writer) (*GetPDFOK, error) + GetPDF(params *GetPDFParams, writer io.Writer, opts ...ClientOption) (*GetPDFOK, error) SetTransport(transport runtime.ClientTransport) } @@ -42,13 +45,12 @@ type ClientService interface { Return a PDF from the datastore */ -func (a *Client) GetPDF(params *GetPDFParams, writer io.Writer) (*GetPDFOK, error) { +func (a *Client) GetPDF(params *GetPDFParams, writer io.Writer, opts ...ClientOption) (*GetPDFOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPDFParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPDF", Method: "GET", PathPattern: "/pdfs/{pdfId}", @@ -59,7 +61,12 @@ func (a *Client) GetPDF(params *GetPDFParams, writer io.Writer) (*GetPDFOK, erro Reader: &GetPDFReader{formats: a.formats, writer: writer}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } diff --git a/api/pdf/pdf_models/error.go b/api/pdf/pdf_models/error.go index 4412f5d..c267348 100644 --- a/api/pdf/pdf_models/error.go +++ b/api/pdf/pdf_models/error.go @@ -10,6 +10,8 @@ package pdf_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_client/tax/get_sales_and_use_tax_return_parameters.go b/api/plex/plex_client/tax/get_sales_and_use_tax_return_parameters.go index b8a9c34..1c4d439 100644 --- a/api/plex/plex_client/tax/get_sales_and_use_tax_return_parameters.go +++ b/api/plex/plex_client/tax/get_sales_and_use_tax_return_parameters.go @@ -21,73 +21,84 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSalesAndUseTaxReturnParams creates a new GetSalesAndUseTaxReturnParams object -// with the default values initialized. +// NewGetSalesAndUseTaxReturnParams creates a new GetSalesAndUseTaxReturnParams 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 NewGetSalesAndUseTaxReturnParams() *GetSalesAndUseTaxReturnParams { - var () return &GetSalesAndUseTaxReturnParams{ - timeout: cr.DefaultTimeout, } } // NewGetSalesAndUseTaxReturnParamsWithTimeout creates a new GetSalesAndUseTaxReturnParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSalesAndUseTaxReturnParamsWithTimeout(timeout time.Duration) *GetSalesAndUseTaxReturnParams { - var () return &GetSalesAndUseTaxReturnParams{ - timeout: timeout, } } // NewGetSalesAndUseTaxReturnParamsWithContext creates a new GetSalesAndUseTaxReturnParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSalesAndUseTaxReturnParamsWithContext(ctx context.Context) *GetSalesAndUseTaxReturnParams { - var () return &GetSalesAndUseTaxReturnParams{ - Context: ctx, } } // NewGetSalesAndUseTaxReturnParamsWithHTTPClient creates a new GetSalesAndUseTaxReturnParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSalesAndUseTaxReturnParamsWithHTTPClient(client *http.Client) *GetSalesAndUseTaxReturnParams { - var () return &GetSalesAndUseTaxReturnParams{ HTTPClient: client, } } -/*GetSalesAndUseTaxReturnParams contains all the parameters to send to the API endpoint -for the get sales and use tax return operation typically these are written to a http.Request +/* GetSalesAndUseTaxReturnParams contains all the parameters to send to the API endpoint + for the get sales and use tax return operation. + + Typically these are written to a http.Request. */ type GetSalesAndUseTaxReturnParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*Month - The Month Number (1,2, ..., 12) of the report + /* Month. + + The Month Number (1,2, ..., 12) of the report + + Format: int64 */ Month *int64 - /*Quarter - The Quarter Number (1,2,3,4) of the report + /* Quarter. + + The Quarter Number (1,2,3,4) of the report + + Format: int64 */ Quarter *int64 - /*Semiannual - The Semiannual Number (1,2) of the report + /* Semiannual. + + The Semiannual Number (1,2) of the report + + Format: int64 */ Semiannual *int64 - /*Year - The year of the report + /* Year. + + The year of the report + + Format: int64 */ Year *int64 @@ -96,6 +107,21 @@ type GetSalesAndUseTaxReturnParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get sales and use tax return params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesAndUseTaxReturnParams) WithDefaults() *GetSalesAndUseTaxReturnParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get sales and use tax return params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSalesAndUseTaxReturnParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get sales and use tax return params func (o *GetSalesAndUseTaxReturnParams) WithTimeout(timeout time.Duration) *GetSalesAndUseTaxReturnParams { o.SetTimeout(timeout) @@ -196,80 +222,85 @@ func (o *GetSalesAndUseTaxReturnParams) WriteToRequest(r runtime.ClientRequest, // 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.Month != nil { // query param month var qrMonth int64 + if o.Month != nil { qrMonth = *o.Month } qMonth := swag.FormatInt64(qrMonth) if qMonth != "" { + if err := r.SetQueryParam("month", qMonth); err != nil { return err } } - } if o.Quarter != nil { // query param quarter var qrQuarter int64 + if o.Quarter != nil { qrQuarter = *o.Quarter } qQuarter := swag.FormatInt64(qrQuarter) if qQuarter != "" { + if err := r.SetQueryParam("quarter", qQuarter); err != nil { return err } } - } if o.Semiannual != nil { // query param semiannual var qrSemiannual int64 + if o.Semiannual != nil { qrSemiannual = *o.Semiannual } qSemiannual := swag.FormatInt64(qrSemiannual) if qSemiannual != "" { + if err := r.SetQueryParam("semiannual", qSemiannual); err != nil { return err } } - } if o.Year != nil { // query param year var qrYear int64 + if o.Year != nil { qrYear = *o.Year } qYear := swag.FormatInt64(qrYear) if qYear != "" { + if err := r.SetQueryParam("year", qYear); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/plex/plex_client/tax/get_sales_and_use_tax_return_responses.go b/api/plex/plex_client/tax/get_sales_and_use_tax_return_responses.go index 8515f14..c9b1523 100644 --- a/api/plex/plex_client/tax/get_sales_and_use_tax_return_responses.go +++ b/api/plex/plex_client/tax/get_sales_and_use_tax_return_responses.go @@ -63,9 +63,8 @@ func (o *GetSalesAndUseTaxReturnReader) ReadResponse(response runtime.ClientResp return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetSalesAndUseTaxReturnOK() *GetSalesAndUseTaxReturnOK { return &GetSalesAndUseTaxReturnOK{} } -/*GetSalesAndUseTaxReturnOK handles this case with default header values. +/* GetSalesAndUseTaxReturnOK describes a response with status code 200, with default header values. The California CDTFA Sales and Use Tax Return */ @@ -85,7 +84,6 @@ type GetSalesAndUseTaxReturnOK struct { func (o *GetSalesAndUseTaxReturnOK) Error() string { return fmt.Sprintf("[GET /taxreturns/salesanduse][%d] getSalesAndUseTaxReturnOK %+v", 200, o.Payload) } - func (o *GetSalesAndUseTaxReturnOK) GetPayload() *plex_models.TaxReturnResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetSalesAndUseTaxReturnUnauthorized() *GetSalesAndUseTaxReturnUnauthoriz return &GetSalesAndUseTaxReturnUnauthorized{} } -/*GetSalesAndUseTaxReturnUnauthorized handles this case with default header values. +/* GetSalesAndUseTaxReturnUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetSalesAndUseTaxReturnUnauthorized struct { func (o *GetSalesAndUseTaxReturnUnauthorized) Error() string { return fmt.Sprintf("[GET /taxreturns/salesanduse][%d] getSalesAndUseTaxReturnUnauthorized %+v", 401, o.Payload) } - func (o *GetSalesAndUseTaxReturnUnauthorized) GetPayload() *plex_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetSalesAndUseTaxReturnForbidden() *GetSalesAndUseTaxReturnForbidden { return &GetSalesAndUseTaxReturnForbidden{} } -/*GetSalesAndUseTaxReturnForbidden handles this case with default header values. +/* GetSalesAndUseTaxReturnForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetSalesAndUseTaxReturnForbidden struct { func (o *GetSalesAndUseTaxReturnForbidden) Error() string { return fmt.Sprintf("[GET /taxreturns/salesanduse][%d] getSalesAndUseTaxReturnForbidden %+v", 403, o.Payload) } - func (o *GetSalesAndUseTaxReturnForbidden) GetPayload() *plex_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetSalesAndUseTaxReturnNotFound() *GetSalesAndUseTaxReturnNotFound { return &GetSalesAndUseTaxReturnNotFound{} } -/*GetSalesAndUseTaxReturnNotFound handles this case with default header values. +/* GetSalesAndUseTaxReturnNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetSalesAndUseTaxReturnNotFound struct { func (o *GetSalesAndUseTaxReturnNotFound) Error() string { return fmt.Sprintf("[GET /taxreturns/salesanduse][%d] getSalesAndUseTaxReturnNotFound %+v", 404, o.Payload) } - func (o *GetSalesAndUseTaxReturnNotFound) GetPayload() *plex_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetSalesAndUseTaxReturnUnprocessableEntity() *GetSalesAndUseTaxReturnUnp return &GetSalesAndUseTaxReturnUnprocessableEntity{} } -/*GetSalesAndUseTaxReturnUnprocessableEntity handles this case with default header values. +/* GetSalesAndUseTaxReturnUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetSalesAndUseTaxReturnUnprocessableEntity struct { func (o *GetSalesAndUseTaxReturnUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxreturns/salesanduse][%d] getSalesAndUseTaxReturnUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetSalesAndUseTaxReturnUnprocessableEntity) GetPayload() *plex_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetSalesAndUseTaxReturnInternalServerError() *GetSalesAndUseTaxReturnInt return &GetSalesAndUseTaxReturnInternalServerError{} } -/*GetSalesAndUseTaxReturnInternalServerError handles this case with default header values. +/* GetSalesAndUseTaxReturnInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetSalesAndUseTaxReturnInternalServerError struct { func (o *GetSalesAndUseTaxReturnInternalServerError) Error() string { return fmt.Sprintf("[GET /taxreturns/salesanduse][%d] getSalesAndUseTaxReturnInternalServerError %+v", 500, o.Payload) } - func (o *GetSalesAndUseTaxReturnInternalServerError) GetPayload() *plex_models.Error { return o.Payload } diff --git a/api/plex/plex_client/tax/tax_client.go b/api/plex/plex_client/tax/tax_client.go index 3e786c9..bb177a9 100644 --- a/api/plex/plex_client/tax/tax_client.go +++ b/api/plex/plex_client/tax/tax_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetSalesAndUseTaxReturn(params *GetSalesAndUseTaxReturnParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesAndUseTaxReturnOK, error) + GetSalesAndUseTaxReturn(params *GetSalesAndUseTaxReturnParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesAndUseTaxReturnOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return CDTFA Sales & Use Tax Return */ -func (a *Client) GetSalesAndUseTaxReturn(params *GetSalesAndUseTaxReturnParams, authInfo runtime.ClientAuthInfoWriter) (*GetSalesAndUseTaxReturnOK, error) { +func (a *Client) GetSalesAndUseTaxReturn(params *GetSalesAndUseTaxReturnParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSalesAndUseTaxReturnOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSalesAndUseTaxReturnParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSalesAndUseTaxReturn", Method: "GET", PathPattern: "/taxreturns/salesanduse", @@ -59,7 +61,12 @@ func (a *Client) GetSalesAndUseTaxReturn(params *GetSalesAndUseTaxReturnParams, 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 } diff --git a/api/plex/plex_models/additional_deductions.go b/api/plex/plex_models/additional_deductions.go index 452f023..6c9b437 100644 --- a/api/plex/plex_models/additional_deductions.go +++ b/api/plex/plex_models/additional_deductions.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *AdditionalDeductions) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this additional deductions based on context it is used +func (m *AdditionalDeductions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AdditionalDeductions) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/district_taxes.go b/api/plex/plex_models/district_taxes.go index 529ccd5..41ac9f5 100644 --- a/api/plex/plex_models/district_taxes.go +++ b/api/plex/plex_models/district_taxes.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *DistrictTaxes) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this district taxes based on context it is used +func (m *DistrictTaxes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DistrictTaxes) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/error.go b/api/plex/plex_models/error.go index dc89cb6..058d928 100644 --- a/api/plex/plex_models/error.go +++ b/api/plex/plex_models/error.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/invoice_item_summary.go b/api/plex/plex_models/invoice_item_summary.go index 7559179..b3c41f9 100644 --- a/api/plex/plex_models/invoice_item_summary.go +++ b/api/plex/plex_models/invoice_item_summary.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -43,6 +45,11 @@ func (m *InvoiceItemSummary) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this invoice item summary based on context it is used +func (m *InvoiceItemSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *InvoiceItemSummary) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/invoice_item_summary_response.go b/api/plex/plex_models/invoice_item_summary_response.go index 3cb2d83..44e7c5b 100644 --- a/api/plex/plex_models/invoice_item_summary_response.go +++ b/api/plex/plex_models/invoice_item_summary_response.go @@ -10,6 +10,7 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *InvoiceItemSummaryResponse) Validate(formats strfmt.Registry) error { } func (m *InvoiceItemSummaryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *InvoiceItemSummaryResponse) validateData(formats strfmt.Registry) error } func (m *InvoiceItemSummaryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *InvoiceItemSummaryResponse) validateMeta(formats strfmt.Registry) error return nil } +// ContextValidate validate this invoice item summary response based on the context it is used +func (m *InvoiceItemSummaryResponse) 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 *InvoiceItemSummaryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceItemSummaryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceItemSummaryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/invoice_summary.go b/api/plex/plex_models/invoice_summary.go index 49bd5fe..922dd58 100644 --- a/api/plex/plex_models/invoice_summary.go +++ b/api/plex/plex_models/invoice_summary.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -70,6 +72,11 @@ func (m *InvoiceSummary) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this invoice summary based on context it is used +func (m *InvoiceSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *InvoiceSummary) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/invoice_summary_response.go b/api/plex/plex_models/invoice_summary_response.go index 8674dee..fd7efb8 100644 --- a/api/plex/plex_models/invoice_summary_response.go +++ b/api/plex/plex_models/invoice_summary_response.go @@ -10,6 +10,7 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *InvoiceSummaryResponse) Validate(formats strfmt.Registry) error { } func (m *InvoiceSummaryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *InvoiceSummaryResponse) validateData(formats strfmt.Registry) error { } func (m *InvoiceSummaryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *InvoiceSummaryResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice summary response based on the context it is used +func (m *InvoiceSummaryResponse) 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 *InvoiceSummaryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceSummaryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceSummaryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/pagination.go b/api/plex/plex_models/pagination.go index 227cfc4..c8bb32f 100644 --- a/api/plex/plex_models/pagination.go +++ b/api/plex/plex_models/pagination.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/response_meta.go b/api/plex/plex_models/response_meta.go index 2a04992..cf0ed57 100644 --- a/api/plex/plex_models/response_meta.go +++ b/api/plex/plex_models/response_meta.go @@ -10,6 +10,8 @@ package plex_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/tax_return.go b/api/plex/plex_models/tax_return.go index f803fe9..2bb4d24 100644 --- a/api/plex/plex_models/tax_return.go +++ b/api/plex/plex_models/tax_return.go @@ -10,6 +10,7 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -150,7 +151,6 @@ func (m *TaxReturn) Validate(formats strfmt.Registry) error { } func (m *TaxReturn) validateAdditionalDeductions(formats strfmt.Registry) error { - if swag.IsZero(m.AdditionalDeductions) { // not required return nil } @@ -175,7 +175,6 @@ func (m *TaxReturn) validateAdditionalDeductions(formats strfmt.Registry) error } func (m *TaxReturn) validateCountyReports(formats strfmt.Registry) error { - if swag.IsZero(m.CountyReports) { // not required return nil } @@ -200,7 +199,6 @@ func (m *TaxReturn) validateCountyReports(formats strfmt.Registry) error { } func (m *TaxReturn) validateDistrictReports(formats strfmt.Registry) error { - if swag.IsZero(m.DistrictReports) { // not required return nil } @@ -225,7 +223,6 @@ func (m *TaxReturn) validateDistrictReports(formats strfmt.Registry) error { } func (m *TaxReturn) validateDistrictTaxes(formats strfmt.Registry) error { - if swag.IsZero(m.DistrictTaxes) { // not required return nil } @@ -250,7 +247,6 @@ func (m *TaxReturn) validateDistrictTaxes(formats strfmt.Registry) error { } func (m *TaxReturn) validateSummaryReport(formats strfmt.Registry) error { - if swag.IsZero(m.SummaryReport) { // not required return nil } @@ -267,6 +263,122 @@ func (m *TaxReturn) validateSummaryReport(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax return based on the context it is used +func (m *TaxReturn) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdditionalDeductions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountyReports(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDistrictReports(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDistrictTaxes(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSummaryReport(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TaxReturn) contextValidateAdditionalDeductions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.AdditionalDeductions); i++ { + + if m.AdditionalDeductions[i] != nil { + if err := m.AdditionalDeductions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("AdditionalDeductions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxReturn) contextValidateCountyReports(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CountyReports); i++ { + + if m.CountyReports[i] != nil { + if err := m.CountyReports[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CountyReports" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxReturn) contextValidateDistrictReports(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DistrictReports); i++ { + + if m.DistrictReports[i] != nil { + if err := m.DistrictReports[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("DistrictReports" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxReturn) contextValidateDistrictTaxes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DistrictTaxes); i++ { + + if m.DistrictTaxes[i] != nil { + if err := m.DistrictTaxes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("DistrictTaxes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxReturn) contextValidateSummaryReport(ctx context.Context, formats strfmt.Registry) error { + + if m.SummaryReport != nil { + if err := m.SummaryReport.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SummaryReport") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxReturn) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/tax_return_panel.go b/api/plex/plex_models/tax_return_panel.go index a93c77b..d1ecc91 100644 --- a/api/plex/plex_models/tax_return_panel.go +++ b/api/plex/plex_models/tax_return_panel.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -244,6 +246,11 @@ func (m *TaxReturnPanel) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax return panel based on context it is used +func (m *TaxReturnPanel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxReturnPanel) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/tax_return_response.go b/api/plex/plex_models/tax_return_response.go index b7e5682..9fb377a 100644 --- a/api/plex/plex_models/tax_return_response.go +++ b/api/plex/plex_models/tax_return_response.go @@ -10,6 +10,7 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxReturnResponse) Validate(formats strfmt.Registry) error { } func (m *TaxReturnResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxReturnResponse) validateData(formats strfmt.Registry) error { } func (m *TaxReturnResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxReturnResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax return response based on the context it is used +func (m *TaxReturnResponse) 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 *TaxReturnResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxReturnResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxReturnResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/tax_summary.go b/api/plex/plex_models/tax_summary.go index 08e204c..f06d6e7 100644 --- a/api/plex/plex_models/tax_summary.go +++ b/api/plex/plex_models/tax_summary.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -73,6 +75,11 @@ func (m *TaxSummary) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax summary based on context it is used +func (m *TaxSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxSummary) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/tax_summary_response.go b/api/plex/plex_models/tax_summary_response.go index 7e87fa3..b9f6431 100644 --- a/api/plex/plex_models/tax_summary_response.go +++ b/api/plex/plex_models/tax_summary_response.go @@ -10,6 +10,7 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxSummaryResponse) Validate(formats strfmt.Registry) error { } func (m *TaxSummaryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxSummaryResponse) validateData(formats strfmt.Registry) error { } func (m *TaxSummaryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxSummaryResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax summary response based on the context it is used +func (m *TaxSummaryResponse) 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 *TaxSummaryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxSummaryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxSummaryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/use_tax.go b/api/plex/plex_models/use_tax.go index 49ef680..e751c86 100644 --- a/api/plex/plex_models/use_tax.go +++ b/api/plex/plex_models/use_tax.go @@ -10,6 +10,8 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *UseTax) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this use tax based on context it is used +func (m *UseTax) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UseTax) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/plex/plex_models/use_tax_response.go b/api/plex/plex_models/use_tax_response.go index d53cded..48eb963 100644 --- a/api/plex/plex_models/use_tax_response.go +++ b/api/plex/plex_models/use_tax_response.go @@ -10,6 +10,7 @@ package plex_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *UseTaxResponse) Validate(formats strfmt.Registry) error { } func (m *UseTaxResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *UseTaxResponse) validateData(formats strfmt.Registry) error { } func (m *UseTaxResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *UseTaxResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this use tax response based on the context it is used +func (m *UseTaxResponse) 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 *UseTaxResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UseTaxResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *UseTaxResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_client/authority/authority_client.go b/api/regs/regs_client/authority/authority_client.go index 447952a..1e1a693 100644 --- a/api/regs/regs_client/authority/authority_client.go +++ b/api/regs/regs_client/authority/authority_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAuthoritiesOK, error) + GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAuthoritiesOK, error) - PostAuthorities(params *PostAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*PostAuthoritiesOK, error) + PostAuthorities(params *PostAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAuthoritiesOK, error) - PutAuthorities(params *PutAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*PutAuthoritiesOK, error) + PutAuthorities(params *PutAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAuthoritiesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Authorities */ -func (a *Client) GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAuthoritiesOK, error) { +func (a *Client) GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAuthoritiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAuthoritiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAuthorities", Method: "GET", PathPattern: "/authorities", @@ -63,7 +65,12 @@ func (a *Client) GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.C 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 } @@ -82,13 +89,12 @@ func (a *Client) GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.C Create new Authorities */ -func (a *Client) PostAuthorities(params *PostAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*PostAuthoritiesOK, error) { +func (a *Client) PostAuthorities(params *PostAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAuthoritiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostAuthoritiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postAuthorities", Method: "POST", PathPattern: "/authorities", @@ -100,7 +106,12 @@ func (a *Client) PostAuthorities(params *PostAuthoritiesParams, authInfo runtime 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 } @@ -119,13 +130,12 @@ func (a *Client) PostAuthorities(params *PostAuthoritiesParams, authInfo runtime Update fields in an Authority record identified by Taxnexus Id */ -func (a *Client) PutAuthorities(params *PutAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*PutAuthoritiesOK, error) { +func (a *Client) PutAuthorities(params *PutAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAuthoritiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutAuthoritiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putAuthorities", Method: "PUT", PathPattern: "/authorities", @@ -137,7 +147,12 @@ func (a *Client) PutAuthorities(params *PutAuthoritiesParams, authInfo runtime.C 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 } diff --git a/api/regs/regs_client/authority/get_authorities_parameters.go b/api/regs/regs_client/authority/get_authorities_parameters.go index a1d8d42..c922bdd 100644 --- a/api/regs/regs_client/authority/get_authorities_parameters.go +++ b/api/regs/regs_client/authority/get_authorities_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAuthoritiesParams creates a new GetAuthoritiesParams object -// with the default values initialized. +// NewGetAuthoritiesParams creates a new GetAuthoritiesParams 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 NewGetAuthoritiesParams() *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ - timeout: cr.DefaultTimeout, } } // NewGetAuthoritiesParamsWithTimeout creates a new GetAuthoritiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAuthoritiesParamsWithTimeout(timeout time.Duration) *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ - timeout: timeout, } } // NewGetAuthoritiesParamsWithContext creates a new GetAuthoritiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAuthoritiesParamsWithContext(ctx context.Context) *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ - Context: ctx, } } // NewGetAuthoritiesParamsWithHTTPClient creates a new GetAuthoritiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAuthoritiesParamsWithHTTPClient(client *http.Client) *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ HTTPClient: client, } } -/*GetAuthoritiesParams contains all the parameters to send to the API endpoint -for the get authorities operation typically these are written to a http.Request +/* GetAuthoritiesParams contains all the parameters to send to the API endpoint + for the get authorities operation. + + Typically these are written to a http.Request. */ type GetAuthoritiesParams struct { - /*AuthorityID - Taxnexus Id of the Authority to be retrieved + /* AuthorityID. + Taxnexus Id of the Authority to be retrieved */ AuthorityID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetAuthoritiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthoritiesParams) WithDefaults() *GetAuthoritiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthoritiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get authorities params func (o *GetAuthoritiesParams) WithTimeout(timeout time.Duration) *GetAuthoritiesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetAuthoritiesParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param authorityId var qrAuthorityID string + if o.AuthorityID != nil { qrAuthorityID = *o.AuthorityID } qAuthorityID := qrAuthorityID if qAuthorityID != "" { + if err := r.SetQueryParam("authorityId", qAuthorityID); 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 { diff --git a/api/regs/regs_client/authority/get_authorities_responses.go b/api/regs/regs_client/authority/get_authorities_responses.go index ad8b33a..6eece81 100644 --- a/api/regs/regs_client/authority/get_authorities_responses.go +++ b/api/regs/regs_client/authority/get_authorities_responses.go @@ -63,9 +63,8 @@ func (o *GetAuthoritiesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetAuthoritiesOK() *GetAuthoritiesOK { return &GetAuthoritiesOK{} } -/*GetAuthoritiesOK handles this case with default header values. +/* GetAuthoritiesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Authority objects */ type GetAuthoritiesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.AuthorityResponse } @@ -89,18 +87,25 @@ type GetAuthoritiesOK struct { func (o *GetAuthoritiesOK) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesOK %+v", 200, o.Payload) } - func (o *GetAuthoritiesOK) GetPayload() *regs_models.AuthorityResponse { return o.Payload } func (o *GetAuthoritiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.AuthorityResponse) @@ -117,7 +122,7 @@ func NewGetAuthoritiesUnauthorized() *GetAuthoritiesUnauthorized { return &GetAuthoritiesUnauthorized{} } -/*GetAuthoritiesUnauthorized handles this case with default header values. +/* GetAuthoritiesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetAuthoritiesUnauthorized struct { func (o *GetAuthoritiesUnauthorized) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesUnauthorized %+v", 401, o.Payload) } - func (o *GetAuthoritiesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetAuthoritiesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetAuthoritiesForbidden() *GetAuthoritiesForbidden { return &GetAuthoritiesForbidden{} } -/*GetAuthoritiesForbidden handles this case with default header values. +/* GetAuthoritiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetAuthoritiesForbidden struct { func (o *GetAuthoritiesForbidden) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesForbidden %+v", 403, o.Payload) } - func (o *GetAuthoritiesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetAuthoritiesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetAuthoritiesNotFound() *GetAuthoritiesNotFound { return &GetAuthoritiesNotFound{} } -/*GetAuthoritiesNotFound handles this case with default header values. +/* GetAuthoritiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetAuthoritiesNotFound struct { func (o *GetAuthoritiesNotFound) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesNotFound %+v", 404, o.Payload) } - func (o *GetAuthoritiesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetAuthoritiesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetAuthoritiesUnprocessableEntity() *GetAuthoritiesUnprocessableEntity { return &GetAuthoritiesUnprocessableEntity{} } -/*GetAuthoritiesUnprocessableEntity handles this case with default header values. +/* GetAuthoritiesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetAuthoritiesUnprocessableEntity struct { func (o *GetAuthoritiesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAuthoritiesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetAuthoritiesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetAuthoritiesInternalServerError() *GetAuthoritiesInternalServerError { return &GetAuthoritiesInternalServerError{} } -/*GetAuthoritiesInternalServerError handles this case with default header values. +/* GetAuthoritiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetAuthoritiesInternalServerError struct { func (o *GetAuthoritiesInternalServerError) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesInternalServerError %+v", 500, o.Payload) } - func (o *GetAuthoritiesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetAuthoritiesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/authority/post_authorities_parameters.go b/api/regs/regs_client/authority/post_authorities_parameters.go index 9984655..3bf7bb3 100644 --- a/api/regs/regs_client/authority/post_authorities_parameters.go +++ b/api/regs/regs_client/authority/post_authorities_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostAuthoritiesParams creates a new PostAuthoritiesParams object -// with the default values initialized. +// NewPostAuthoritiesParams creates a new PostAuthoritiesParams 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 NewPostAuthoritiesParams() *PostAuthoritiesParams { - var () return &PostAuthoritiesParams{ - timeout: cr.DefaultTimeout, } } // NewPostAuthoritiesParamsWithTimeout creates a new PostAuthoritiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostAuthoritiesParamsWithTimeout(timeout time.Duration) *PostAuthoritiesParams { - var () return &PostAuthoritiesParams{ - timeout: timeout, } } // NewPostAuthoritiesParamsWithContext creates a new PostAuthoritiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostAuthoritiesParamsWithContext(ctx context.Context) *PostAuthoritiesParams { - var () return &PostAuthoritiesParams{ - Context: ctx, } } // NewPostAuthoritiesParamsWithHTTPClient creates a new PostAuthoritiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostAuthoritiesParamsWithHTTPClient(client *http.Client) *PostAuthoritiesParams { - var () return &PostAuthoritiesParams{ HTTPClient: client, } } -/*PostAuthoritiesParams contains all the parameters to send to the API endpoint -for the post authorities operation typically these are written to a http.Request +/* PostAuthoritiesParams contains all the parameters to send to the API endpoint + for the post authorities operation. + + Typically these are written to a http.Request. */ type PostAuthoritiesParams struct { - /*AuthorityRequest - A request with an array of Authority Objects + /* AuthorityRequest. + A request with an array of Authority Objects */ AuthorityRequest *regs_models.AuthorityRequest @@ -77,6 +76,21 @@ type PostAuthoritiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAuthoritiesParams) WithDefaults() *PostAuthoritiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAuthoritiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post authorities params func (o *PostAuthoritiesParams) WithTimeout(timeout time.Duration) *PostAuthoritiesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostAuthoritiesParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.AuthorityRequest != nil { if err := r.SetBodyParam(o.AuthorityRequest); err != nil { return err diff --git a/api/regs/regs_client/authority/post_authorities_responses.go b/api/regs/regs_client/authority/post_authorities_responses.go index 770b585..b717db6 100644 --- a/api/regs/regs_client/authority/post_authorities_responses.go +++ b/api/regs/regs_client/authority/post_authorities_responses.go @@ -63,9 +63,8 @@ func (o *PostAuthoritiesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostAuthoritiesOK() *PostAuthoritiesOK { return &PostAuthoritiesOK{} } -/*PostAuthoritiesOK handles this case with default header values. +/* PostAuthoritiesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Authority objects */ type PostAuthoritiesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.AuthorityResponse } @@ -89,18 +87,25 @@ type PostAuthoritiesOK struct { func (o *PostAuthoritiesOK) Error() string { return fmt.Sprintf("[POST /authorities][%d] postAuthoritiesOK %+v", 200, o.Payload) } - func (o *PostAuthoritiesOK) GetPayload() *regs_models.AuthorityResponse { return o.Payload } func (o *PostAuthoritiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.AuthorityResponse) @@ -117,7 +122,7 @@ func NewPostAuthoritiesUnauthorized() *PostAuthoritiesUnauthorized { return &PostAuthoritiesUnauthorized{} } -/*PostAuthoritiesUnauthorized handles this case with default header values. +/* PostAuthoritiesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostAuthoritiesUnauthorized struct { func (o *PostAuthoritiesUnauthorized) Error() string { return fmt.Sprintf("[POST /authorities][%d] postAuthoritiesUnauthorized %+v", 401, o.Payload) } - func (o *PostAuthoritiesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostAuthoritiesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostAuthoritiesForbidden() *PostAuthoritiesForbidden { return &PostAuthoritiesForbidden{} } -/*PostAuthoritiesForbidden handles this case with default header values. +/* PostAuthoritiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostAuthoritiesForbidden struct { func (o *PostAuthoritiesForbidden) Error() string { return fmt.Sprintf("[POST /authorities][%d] postAuthoritiesForbidden %+v", 403, o.Payload) } - func (o *PostAuthoritiesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostAuthoritiesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostAuthoritiesNotFound() *PostAuthoritiesNotFound { return &PostAuthoritiesNotFound{} } -/*PostAuthoritiesNotFound handles this case with default header values. +/* PostAuthoritiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostAuthoritiesNotFound struct { func (o *PostAuthoritiesNotFound) Error() string { return fmt.Sprintf("[POST /authorities][%d] postAuthoritiesNotFound %+v", 404, o.Payload) } - func (o *PostAuthoritiesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostAuthoritiesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostAuthoritiesUnprocessableEntity() *PostAuthoritiesUnprocessableEntity return &PostAuthoritiesUnprocessableEntity{} } -/*PostAuthoritiesUnprocessableEntity handles this case with default header values. +/* PostAuthoritiesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostAuthoritiesUnprocessableEntity struct { func (o *PostAuthoritiesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /authorities][%d] postAuthoritiesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostAuthoritiesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostAuthoritiesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostAuthoritiesInternalServerError() *PostAuthoritiesInternalServerError return &PostAuthoritiesInternalServerError{} } -/*PostAuthoritiesInternalServerError handles this case with default header values. +/* PostAuthoritiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostAuthoritiesInternalServerError struct { func (o *PostAuthoritiesInternalServerError) Error() string { return fmt.Sprintf("[POST /authorities][%d] postAuthoritiesInternalServerError %+v", 500, o.Payload) } - func (o *PostAuthoritiesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostAuthoritiesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/authority/put_authorities_parameters.go b/api/regs/regs_client/authority/put_authorities_parameters.go index a5b3359..7566439 100644 --- a/api/regs/regs_client/authority/put_authorities_parameters.go +++ b/api/regs/regs_client/authority/put_authorities_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutAuthoritiesParams creates a new PutAuthoritiesParams object -// with the default values initialized. +// NewPutAuthoritiesParams creates a new PutAuthoritiesParams 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 NewPutAuthoritiesParams() *PutAuthoritiesParams { - var () return &PutAuthoritiesParams{ - timeout: cr.DefaultTimeout, } } // NewPutAuthoritiesParamsWithTimeout creates a new PutAuthoritiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutAuthoritiesParamsWithTimeout(timeout time.Duration) *PutAuthoritiesParams { - var () return &PutAuthoritiesParams{ - timeout: timeout, } } // NewPutAuthoritiesParamsWithContext creates a new PutAuthoritiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutAuthoritiesParamsWithContext(ctx context.Context) *PutAuthoritiesParams { - var () return &PutAuthoritiesParams{ - Context: ctx, } } // NewPutAuthoritiesParamsWithHTTPClient creates a new PutAuthoritiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutAuthoritiesParamsWithHTTPClient(client *http.Client) *PutAuthoritiesParams { - var () return &PutAuthoritiesParams{ HTTPClient: client, } } -/*PutAuthoritiesParams contains all the parameters to send to the API endpoint -for the put authorities operation typically these are written to a http.Request +/* PutAuthoritiesParams contains all the parameters to send to the API endpoint + for the put authorities operation. + + Typically these are written to a http.Request. */ type PutAuthoritiesParams struct { - /*AuthorityRequest - A request with an array of Authority Objects + /* AuthorityRequest. + A request with an array of Authority Objects */ AuthorityRequest *regs_models.AuthorityRequest @@ -77,6 +76,21 @@ type PutAuthoritiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAuthoritiesParams) WithDefaults() *PutAuthoritiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAuthoritiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put authorities params func (o *PutAuthoritiesParams) WithTimeout(timeout time.Duration) *PutAuthoritiesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutAuthoritiesParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.AuthorityRequest != nil { if err := r.SetBodyParam(o.AuthorityRequest); err != nil { return err diff --git a/api/regs/regs_client/authority/put_authorities_responses.go b/api/regs/regs_client/authority/put_authorities_responses.go index aa3689e..b18a0d1 100644 --- a/api/regs/regs_client/authority/put_authorities_responses.go +++ b/api/regs/regs_client/authority/put_authorities_responses.go @@ -63,9 +63,8 @@ func (o *PutAuthoritiesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutAuthoritiesOK() *PutAuthoritiesOK { return &PutAuthoritiesOK{} } -/*PutAuthoritiesOK handles this case with default header values. +/* PutAuthoritiesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Authority objects */ type PutAuthoritiesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.AuthorityResponse } @@ -89,18 +87,25 @@ type PutAuthoritiesOK struct { func (o *PutAuthoritiesOK) Error() string { return fmt.Sprintf("[PUT /authorities][%d] putAuthoritiesOK %+v", 200, o.Payload) } - func (o *PutAuthoritiesOK) GetPayload() *regs_models.AuthorityResponse { return o.Payload } func (o *PutAuthoritiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.AuthorityResponse) @@ -117,7 +122,7 @@ func NewPutAuthoritiesUnauthorized() *PutAuthoritiesUnauthorized { return &PutAuthoritiesUnauthorized{} } -/*PutAuthoritiesUnauthorized handles this case with default header values. +/* PutAuthoritiesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutAuthoritiesUnauthorized struct { func (o *PutAuthoritiesUnauthorized) Error() string { return fmt.Sprintf("[PUT /authorities][%d] putAuthoritiesUnauthorized %+v", 401, o.Payload) } - func (o *PutAuthoritiesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutAuthoritiesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutAuthoritiesForbidden() *PutAuthoritiesForbidden { return &PutAuthoritiesForbidden{} } -/*PutAuthoritiesForbidden handles this case with default header values. +/* PutAuthoritiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutAuthoritiesForbidden struct { func (o *PutAuthoritiesForbidden) Error() string { return fmt.Sprintf("[PUT /authorities][%d] putAuthoritiesForbidden %+v", 403, o.Payload) } - func (o *PutAuthoritiesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutAuthoritiesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutAuthoritiesNotFound() *PutAuthoritiesNotFound { return &PutAuthoritiesNotFound{} } -/*PutAuthoritiesNotFound handles this case with default header values. +/* PutAuthoritiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutAuthoritiesNotFound struct { func (o *PutAuthoritiesNotFound) Error() string { return fmt.Sprintf("[PUT /authorities][%d] putAuthoritiesNotFound %+v", 404, o.Payload) } - func (o *PutAuthoritiesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutAuthoritiesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutAuthoritiesUnprocessableEntity() *PutAuthoritiesUnprocessableEntity { return &PutAuthoritiesUnprocessableEntity{} } -/*PutAuthoritiesUnprocessableEntity handles this case with default header values. +/* PutAuthoritiesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutAuthoritiesUnprocessableEntity struct { func (o *PutAuthoritiesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /authorities][%d] putAuthoritiesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutAuthoritiesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutAuthoritiesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutAuthoritiesInternalServerError() *PutAuthoritiesInternalServerError { return &PutAuthoritiesInternalServerError{} } -/*PutAuthoritiesInternalServerError handles this case with default header values. +/* PutAuthoritiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutAuthoritiesInternalServerError struct { func (o *PutAuthoritiesInternalServerError) Error() string { return fmt.Sprintf("[PUT /authorities][%d] putAuthoritiesInternalServerError %+v", 500, o.Payload) } - func (o *PutAuthoritiesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutAuthoritiesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/backend/backend_client.go b/api/regs/regs_client/backend/backend_client.go index 1ccdfab..9e9777a 100644 --- a/api/regs/regs_client/backend/backend_client.go +++ b/api/regs/regs_client/backend/backend_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteBackend(params *DeleteBackendParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteBackendOK, error) + DeleteBackend(params *DeleteBackendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteBackendOK, error) - GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*GetBackendsOK, error) + GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetBackendsOK, error) - PostBackends(params *PostBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*PostBackendsOK, error) + PostBackends(params *PostBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostBackendsOK, error) - PutBackends(params *PutBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*PutBackendsOK, error) + PutBackends(params *PutBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutBackendsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete Taxnexus Backend record */ -func (a *Client) DeleteBackend(params *DeleteBackendParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteBackendOK, error) { +func (a *Client) DeleteBackend(params *DeleteBackendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteBackendOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteBackendParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteBackend", Method: "DELETE", PathPattern: "/backends", @@ -65,7 +67,12 @@ func (a *Client) DeleteBackend(params *DeleteBackendParams, authInfo runtime.Cli 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteBackend(params *DeleteBackendParams, authInfo runtime.Cli Return a list of Backends */ -func (a *Client) GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*GetBackendsOK, error) { +func (a *Client) GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetBackendsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetBackendsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getBackends", Method: "GET", PathPattern: "/backends", @@ -102,7 +108,12 @@ func (a *Client) GetBackends(params *GetBackendsParams, authInfo runtime.ClientA 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 } @@ -121,13 +132,12 @@ func (a *Client) GetBackends(params *GetBackendsParams, authInfo runtime.ClientA Contact record to be added */ -func (a *Client) PostBackends(params *PostBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*PostBackendsOK, error) { +func (a *Client) PostBackends(params *PostBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostBackendsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostBackendsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postBackends", Method: "POST", PathPattern: "/backends", @@ -139,7 +149,12 @@ func (a *Client) PostBackends(params *PostBackendsParams, authInfo runtime.Clien 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 } @@ -158,13 +173,12 @@ func (a *Client) PostBackends(params *PostBackendsParams, authInfo runtime.Clien Update Backend records */ -func (a *Client) PutBackends(params *PutBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*PutBackendsOK, error) { +func (a *Client) PutBackends(params *PutBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutBackendsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutBackendsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putBackends", Method: "PUT", PathPattern: "/backends", @@ -176,7 +190,12 @@ func (a *Client) PutBackends(params *PutBackendsParams, authInfo runtime.ClientA 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 } diff --git a/api/regs/regs_client/backend/delete_backend_parameters.go b/api/regs/regs_client/backend/delete_backend_parameters.go index 26aabd9..8a29e17 100644 --- a/api/regs/regs_client/backend/delete_backend_parameters.go +++ b/api/regs/regs_client/backend/delete_backend_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteBackendParams creates a new DeleteBackendParams object -// with the default values initialized. +// NewDeleteBackendParams creates a new DeleteBackendParams 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 NewDeleteBackendParams() *DeleteBackendParams { - var () return &DeleteBackendParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteBackendParamsWithTimeout creates a new DeleteBackendParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteBackendParamsWithTimeout(timeout time.Duration) *DeleteBackendParams { - var () return &DeleteBackendParams{ - timeout: timeout, } } // NewDeleteBackendParamsWithContext creates a new DeleteBackendParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteBackendParamsWithContext(ctx context.Context) *DeleteBackendParams { - var () return &DeleteBackendParams{ - Context: ctx, } } // NewDeleteBackendParamsWithHTTPClient creates a new DeleteBackendParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteBackendParamsWithHTTPClient(client *http.Client) *DeleteBackendParams { - var () return &DeleteBackendParams{ HTTPClient: client, } } -/*DeleteBackendParams contains all the parameters to send to the API endpoint -for the delete backend operation typically these are written to a http.Request +/* DeleteBackendParams contains all the parameters to send to the API endpoint + for the delete backend operation. + + Typically these are written to a http.Request. */ type DeleteBackendParams struct { - /*BackendID - Taxnexus Id of the Backend to be retrieved + /* BackendID. + Taxnexus Id of the Backend to be retrieved */ BackendID *string @@ -75,6 +74,21 @@ type DeleteBackendParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete backend params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteBackendParams) WithDefaults() *DeleteBackendParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete backend params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteBackendParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete backend params func (o *DeleteBackendParams) WithTimeout(timeout time.Duration) *DeleteBackendParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteBackendParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // query param backendId var qrBackendID string + if o.BackendID != nil { qrBackendID = *o.BackendID } qBackendID := qrBackendID if qBackendID != "" { + if err := r.SetQueryParam("backendId", qBackendID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/backend/delete_backend_responses.go b/api/regs/regs_client/backend/delete_backend_responses.go index 686e553..954a6a7 100644 --- a/api/regs/regs_client/backend/delete_backend_responses.go +++ b/api/regs/regs_client/backend/delete_backend_responses.go @@ -63,9 +63,8 @@ func (o *DeleteBackendReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteBackendOK() *DeleteBackendOK { return &DeleteBackendOK{} } -/*DeleteBackendOK handles this case with default header values. +/* DeleteBackendOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteBackendOK struct { func (o *DeleteBackendOK) Error() string { return fmt.Sprintf("[DELETE /backends][%d] deleteBackendOK %+v", 200, o.Payload) } - func (o *DeleteBackendOK) GetPayload() *regs_models.DeleteResponse { return o.Payload } func (o *DeleteBackendOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteBackendUnauthorized() *DeleteBackendUnauthorized { return &DeleteBackendUnauthorized{} } -/*DeleteBackendUnauthorized handles this case with default header values. +/* DeleteBackendUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteBackendUnauthorized struct { func (o *DeleteBackendUnauthorized) Error() string { return fmt.Sprintf("[DELETE /backends][%d] deleteBackendUnauthorized %+v", 401, o.Payload) } - func (o *DeleteBackendUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteBackendUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -150,7 +155,7 @@ func NewDeleteBackendForbidden() *DeleteBackendForbidden { return &DeleteBackendForbidden{} } -/*DeleteBackendForbidden handles this case with default header values. +/* DeleteBackendForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteBackendForbidden struct { func (o *DeleteBackendForbidden) Error() string { return fmt.Sprintf("[DELETE /backends][%d] deleteBackendForbidden %+v", 403, o.Payload) } - func (o *DeleteBackendForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteBackendForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -188,7 +196,7 @@ func NewDeleteBackendNotFound() *DeleteBackendNotFound { return &DeleteBackendNotFound{} } -/*DeleteBackendNotFound handles this case with default header values. +/* DeleteBackendNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteBackendNotFound struct { func (o *DeleteBackendNotFound) Error() string { return fmt.Sprintf("[DELETE /backends][%d] deleteBackendNotFound %+v", 404, o.Payload) } - func (o *DeleteBackendNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteBackendNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -226,7 +237,7 @@ func NewDeleteBackendUnprocessableEntity() *DeleteBackendUnprocessableEntity { return &DeleteBackendUnprocessableEntity{} } -/*DeleteBackendUnprocessableEntity handles this case with default header values. +/* DeleteBackendUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteBackendUnprocessableEntity struct { func (o *DeleteBackendUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /backends][%d] deleteBackendUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteBackendUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteBackendUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -264,7 +278,7 @@ func NewDeleteBackendInternalServerError() *DeleteBackendInternalServerError { return &DeleteBackendInternalServerError{} } -/*DeleteBackendInternalServerError handles this case with default header values. +/* DeleteBackendInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteBackendInternalServerError struct { func (o *DeleteBackendInternalServerError) Error() string { return fmt.Sprintf("[DELETE /backends][%d] deleteBackendInternalServerError %+v", 500, o.Payload) } - func (o *DeleteBackendInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteBackendInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/backend/get_backends_parameters.go b/api/regs/regs_client/backend/get_backends_parameters.go index a71d339..1bf6871 100644 --- a/api/regs/regs_client/backend/get_backends_parameters.go +++ b/api/regs/regs_client/backend/get_backends_parameters.go @@ -21,83 +21,92 @@ import ( "github.com/go-openapi/swag" ) -// NewGetBackendsParams creates a new GetBackendsParams object -// with the default values initialized. +// NewGetBackendsParams creates a new GetBackendsParams 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 NewGetBackendsParams() *GetBackendsParams { - var () return &GetBackendsParams{ - timeout: cr.DefaultTimeout, } } // NewGetBackendsParamsWithTimeout creates a new GetBackendsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetBackendsParamsWithTimeout(timeout time.Duration) *GetBackendsParams { - var () return &GetBackendsParams{ - timeout: timeout, } } // NewGetBackendsParamsWithContext creates a new GetBackendsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetBackendsParamsWithContext(ctx context.Context) *GetBackendsParams { - var () return &GetBackendsParams{ - Context: ctx, } } // NewGetBackendsParamsWithHTTPClient creates a new GetBackendsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetBackendsParamsWithHTTPClient(client *http.Client) *GetBackendsParams { - var () return &GetBackendsParams{ HTTPClient: client, } } -/*GetBackendsParams contains all the parameters to send to the API endpoint -for the get backends operation typically these are written to a http.Request +/* GetBackendsParams contains all the parameters to send to the API endpoint + for the get backends operation. + + Typically these are written to a http.Request. */ type GetBackendsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*AccountNumber - The Taxnexus Account Number of the Account to be used a record retrieval + /* AccountNumber. + + The Taxnexus Account Number of the Account to be used a record retrieval */ AccountNumber *string - /*BackendID - Taxnexus Id of the Backend to be retrieved + /* BackendID. + + Taxnexus Id of the Backend to be retrieved */ BackendID *string - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + + Taxnexus Record Id of a Company */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -106,6 +115,21 @@ type GetBackendsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBackendsParams) WithDefaults() *GetBackendsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBackendsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get backends params func (o *GetBackendsParams) WithTimeout(timeout time.Duration) *GetBackendsParams { o.SetTimeout(timeout) @@ -228,112 +252,119 @@ func (o *GetBackendsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // 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.AccountNumber != nil { // query param accountNumber var qrAccountNumber string + if o.AccountNumber != nil { qrAccountNumber = *o.AccountNumber } qAccountNumber := qrAccountNumber if qAccountNumber != "" { + if err := r.SetQueryParam("accountNumber", qAccountNumber); err != nil { return err } } - } if o.BackendID != nil { // query param backendId var qrBackendID string + if o.BackendID != nil { qrBackendID = *o.BackendID } qBackendID := qrBackendID if qBackendID != "" { + if err := r.SetQueryParam("backendId", qBackendID); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/backend/get_backends_responses.go b/api/regs/regs_client/backend/get_backends_responses.go index 5de155a..0f1e404 100644 --- a/api/regs/regs_client/backend/get_backends_responses.go +++ b/api/regs/regs_client/backend/get_backends_responses.go @@ -63,9 +63,8 @@ func (o *GetBackendsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetBackendsOK() *GetBackendsOK { return &GetBackendsOK{} } -/*GetBackendsOK handles this case with default header values. +/* GetBackendsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Backend Objects */ type GetBackendsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.BackendResponse } @@ -89,18 +87,25 @@ type GetBackendsOK struct { func (o *GetBackendsOK) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsOK %+v", 200, o.Payload) } - func (o *GetBackendsOK) GetPayload() *regs_models.BackendResponse { return o.Payload } func (o *GetBackendsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.BackendResponse) @@ -117,7 +122,7 @@ func NewGetBackendsUnauthorized() *GetBackendsUnauthorized { return &GetBackendsUnauthorized{} } -/*GetBackendsUnauthorized handles this case with default header values. +/* GetBackendsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetBackendsUnauthorized struct { func (o *GetBackendsUnauthorized) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsUnauthorized %+v", 401, o.Payload) } - func (o *GetBackendsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetBackendsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetBackendsForbidden() *GetBackendsForbidden { return &GetBackendsForbidden{} } -/*GetBackendsForbidden handles this case with default header values. +/* GetBackendsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetBackendsForbidden struct { func (o *GetBackendsForbidden) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsForbidden %+v", 403, o.Payload) } - func (o *GetBackendsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetBackendsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetBackendsNotFound() *GetBackendsNotFound { return &GetBackendsNotFound{} } -/*GetBackendsNotFound handles this case with default header values. +/* GetBackendsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetBackendsNotFound struct { func (o *GetBackendsNotFound) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsNotFound %+v", 404, o.Payload) } - func (o *GetBackendsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetBackendsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetBackendsUnprocessableEntity() *GetBackendsUnprocessableEntity { return &GetBackendsUnprocessableEntity{} } -/*GetBackendsUnprocessableEntity handles this case with default header values. +/* GetBackendsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetBackendsUnprocessableEntity struct { func (o *GetBackendsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetBackendsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetBackendsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetBackendsInternalServerError() *GetBackendsInternalServerError { return &GetBackendsInternalServerError{} } -/*GetBackendsInternalServerError handles this case with default header values. +/* GetBackendsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetBackendsInternalServerError struct { func (o *GetBackendsInternalServerError) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsInternalServerError %+v", 500, o.Payload) } - func (o *GetBackendsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetBackendsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/backend/post_backends_parameters.go b/api/regs/regs_client/backend/post_backends_parameters.go index f0b6c5f..81e8e70 100644 --- a/api/regs/regs_client/backend/post_backends_parameters.go +++ b/api/regs/regs_client/backend/post_backends_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostBackendsParams creates a new PostBackendsParams object -// with the default values initialized. +// NewPostBackendsParams creates a new PostBackendsParams 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 NewPostBackendsParams() *PostBackendsParams { - var () return &PostBackendsParams{ - timeout: cr.DefaultTimeout, } } // NewPostBackendsParamsWithTimeout creates a new PostBackendsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostBackendsParamsWithTimeout(timeout time.Duration) *PostBackendsParams { - var () return &PostBackendsParams{ - timeout: timeout, } } // NewPostBackendsParamsWithContext creates a new PostBackendsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostBackendsParamsWithContext(ctx context.Context) *PostBackendsParams { - var () return &PostBackendsParams{ - Context: ctx, } } // NewPostBackendsParamsWithHTTPClient creates a new PostBackendsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostBackendsParamsWithHTTPClient(client *http.Client) *PostBackendsParams { - var () return &PostBackendsParams{ HTTPClient: client, } } -/*PostBackendsParams contains all the parameters to send to the API endpoint -for the post backends operation typically these are written to a http.Request +/* PostBackendsParams contains all the parameters to send to the API endpoint + for the post backends operation. + + Typically these are written to a http.Request. */ type PostBackendsParams struct { - /*BackendRequest - An array of new Backend records + /* BackendRequest. + An array of new Backend records */ BackendRequest *regs_models.BackendRequest @@ -77,6 +76,21 @@ type PostBackendsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostBackendsParams) WithDefaults() *PostBackendsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostBackendsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post backends params func (o *PostBackendsParams) WithTimeout(timeout time.Duration) *PostBackendsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostBackendsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.BackendRequest != nil { if err := r.SetBodyParam(o.BackendRequest); err != nil { return err diff --git a/api/regs/regs_client/backend/post_backends_responses.go b/api/regs/regs_client/backend/post_backends_responses.go index 0f6274d..9ab40dc 100644 --- a/api/regs/regs_client/backend/post_backends_responses.go +++ b/api/regs/regs_client/backend/post_backends_responses.go @@ -63,9 +63,8 @@ func (o *PostBackendsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostBackendsOK() *PostBackendsOK { return &PostBackendsOK{} } -/*PostBackendsOK handles this case with default header values. +/* PostBackendsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Backend Objects */ type PostBackendsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.BackendResponse } @@ -89,18 +87,25 @@ type PostBackendsOK struct { func (o *PostBackendsOK) Error() string { return fmt.Sprintf("[POST /backends][%d] postBackendsOK %+v", 200, o.Payload) } - func (o *PostBackendsOK) GetPayload() *regs_models.BackendResponse { return o.Payload } func (o *PostBackendsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.BackendResponse) @@ -117,7 +122,7 @@ func NewPostBackendsUnauthorized() *PostBackendsUnauthorized { return &PostBackendsUnauthorized{} } -/*PostBackendsUnauthorized handles this case with default header values. +/* PostBackendsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostBackendsUnauthorized struct { func (o *PostBackendsUnauthorized) Error() string { return fmt.Sprintf("[POST /backends][%d] postBackendsUnauthorized %+v", 401, o.Payload) } - func (o *PostBackendsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostBackendsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostBackendsForbidden() *PostBackendsForbidden { return &PostBackendsForbidden{} } -/*PostBackendsForbidden handles this case with default header values. +/* PostBackendsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostBackendsForbidden struct { func (o *PostBackendsForbidden) Error() string { return fmt.Sprintf("[POST /backends][%d] postBackendsForbidden %+v", 403, o.Payload) } - func (o *PostBackendsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostBackendsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostBackendsNotFound() *PostBackendsNotFound { return &PostBackendsNotFound{} } -/*PostBackendsNotFound handles this case with default header values. +/* PostBackendsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostBackendsNotFound struct { func (o *PostBackendsNotFound) Error() string { return fmt.Sprintf("[POST /backends][%d] postBackendsNotFound %+v", 404, o.Payload) } - func (o *PostBackendsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostBackendsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostBackendsUnprocessableEntity() *PostBackendsUnprocessableEntity { return &PostBackendsUnprocessableEntity{} } -/*PostBackendsUnprocessableEntity handles this case with default header values. +/* PostBackendsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostBackendsUnprocessableEntity struct { func (o *PostBackendsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /backends][%d] postBackendsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostBackendsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostBackendsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostBackendsInternalServerError() *PostBackendsInternalServerError { return &PostBackendsInternalServerError{} } -/*PostBackendsInternalServerError handles this case with default header values. +/* PostBackendsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostBackendsInternalServerError struct { func (o *PostBackendsInternalServerError) Error() string { return fmt.Sprintf("[POST /backends][%d] postBackendsInternalServerError %+v", 500, o.Payload) } - func (o *PostBackendsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostBackendsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/backend/put_backends_parameters.go b/api/regs/regs_client/backend/put_backends_parameters.go index b7e537f..ab82f7c 100644 --- a/api/regs/regs_client/backend/put_backends_parameters.go +++ b/api/regs/regs_client/backend/put_backends_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutBackendsParams creates a new PutBackendsParams object -// with the default values initialized. +// NewPutBackendsParams creates a new PutBackendsParams 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 NewPutBackendsParams() *PutBackendsParams { - var () return &PutBackendsParams{ - timeout: cr.DefaultTimeout, } } // NewPutBackendsParamsWithTimeout creates a new PutBackendsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutBackendsParamsWithTimeout(timeout time.Duration) *PutBackendsParams { - var () return &PutBackendsParams{ - timeout: timeout, } } // NewPutBackendsParamsWithContext creates a new PutBackendsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutBackendsParamsWithContext(ctx context.Context) *PutBackendsParams { - var () return &PutBackendsParams{ - Context: ctx, } } // NewPutBackendsParamsWithHTTPClient creates a new PutBackendsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutBackendsParamsWithHTTPClient(client *http.Client) *PutBackendsParams { - var () return &PutBackendsParams{ HTTPClient: client, } } -/*PutBackendsParams contains all the parameters to send to the API endpoint -for the put backends operation typically these are written to a http.Request +/* PutBackendsParams contains all the parameters to send to the API endpoint + for the put backends operation. + + Typically these are written to a http.Request. */ type PutBackendsParams struct { - /*BackendRequest - An array of new Backend records + /* BackendRequest. + An array of new Backend records */ BackendRequest *regs_models.BackendRequest @@ -77,6 +76,21 @@ type PutBackendsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutBackendsParams) WithDefaults() *PutBackendsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutBackendsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put backends params func (o *PutBackendsParams) WithTimeout(timeout time.Duration) *PutBackendsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutBackendsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.BackendRequest != nil { if err := r.SetBodyParam(o.BackendRequest); err != nil { return err diff --git a/api/regs/regs_client/backend/put_backends_responses.go b/api/regs/regs_client/backend/put_backends_responses.go index 0c3f092..7d5f749 100644 --- a/api/regs/regs_client/backend/put_backends_responses.go +++ b/api/regs/regs_client/backend/put_backends_responses.go @@ -63,9 +63,8 @@ func (o *PutBackendsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutBackendsOK() *PutBackendsOK { return &PutBackendsOK{} } -/*PutBackendsOK handles this case with default header values. +/* PutBackendsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Backend Objects */ type PutBackendsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.BackendResponse } @@ -89,18 +87,25 @@ type PutBackendsOK struct { func (o *PutBackendsOK) Error() string { return fmt.Sprintf("[PUT /backends][%d] putBackendsOK %+v", 200, o.Payload) } - func (o *PutBackendsOK) GetPayload() *regs_models.BackendResponse { return o.Payload } func (o *PutBackendsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.BackendResponse) @@ -117,7 +122,7 @@ func NewPutBackendsUnauthorized() *PutBackendsUnauthorized { return &PutBackendsUnauthorized{} } -/*PutBackendsUnauthorized handles this case with default header values. +/* PutBackendsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutBackendsUnauthorized struct { func (o *PutBackendsUnauthorized) Error() string { return fmt.Sprintf("[PUT /backends][%d] putBackendsUnauthorized %+v", 401, o.Payload) } - func (o *PutBackendsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutBackendsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutBackendsForbidden() *PutBackendsForbidden { return &PutBackendsForbidden{} } -/*PutBackendsForbidden handles this case with default header values. +/* PutBackendsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutBackendsForbidden struct { func (o *PutBackendsForbidden) Error() string { return fmt.Sprintf("[PUT /backends][%d] putBackendsForbidden %+v", 403, o.Payload) } - func (o *PutBackendsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutBackendsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutBackendsNotFound() *PutBackendsNotFound { return &PutBackendsNotFound{} } -/*PutBackendsNotFound handles this case with default header values. +/* PutBackendsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutBackendsNotFound struct { func (o *PutBackendsNotFound) Error() string { return fmt.Sprintf("[PUT /backends][%d] putBackendsNotFound %+v", 404, o.Payload) } - func (o *PutBackendsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutBackendsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutBackendsUnprocessableEntity() *PutBackendsUnprocessableEntity { return &PutBackendsUnprocessableEntity{} } -/*PutBackendsUnprocessableEntity handles this case with default header values. +/* PutBackendsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutBackendsUnprocessableEntity struct { func (o *PutBackendsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /backends][%d] putBackendsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutBackendsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutBackendsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutBackendsInternalServerError() *PutBackendsInternalServerError { return &PutBackendsInternalServerError{} } -/*PutBackendsInternalServerError handles this case with default header values. +/* PutBackendsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutBackendsInternalServerError struct { func (o *PutBackendsInternalServerError) Error() string { return fmt.Sprintf("[PUT /backends][%d] putBackendsInternalServerError %+v", 500, o.Payload) } - func (o *PutBackendsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutBackendsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/cors/authority_options_parameters.go b/api/regs/regs_client/cors/authority_options_parameters.go index 9621be2..66c455c 100644 --- a/api/regs/regs_client/cors/authority_options_parameters.go +++ b/api/regs/regs_client/cors/authority_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewAuthorityOptionsParams creates a new AuthorityOptionsParams object -// with the default values initialized. +// NewAuthorityOptionsParams creates a new AuthorityOptionsParams 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 NewAuthorityOptionsParams() *AuthorityOptionsParams { - return &AuthorityOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewAuthorityOptionsParamsWithTimeout creates a new AuthorityOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAuthorityOptionsParamsWithTimeout(timeout time.Duration) *AuthorityOptionsParams { - return &AuthorityOptionsParams{ - timeout: timeout, } } // NewAuthorityOptionsParamsWithContext creates a new AuthorityOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAuthorityOptionsParamsWithContext(ctx context.Context) *AuthorityOptionsParams { - return &AuthorityOptionsParams{ - Context: ctx, } } // NewAuthorityOptionsParamsWithHTTPClient creates a new AuthorityOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAuthorityOptionsParamsWithHTTPClient(client *http.Client) *AuthorityOptionsParams { - return &AuthorityOptionsParams{ HTTPClient: client, } } -/*AuthorityOptionsParams contains all the parameters to send to the API endpoint -for the authority options operation typically these are written to a http.Request +/* AuthorityOptionsParams contains all the parameters to send to the API endpoint + for the authority options operation. + + Typically these are written to a http.Request. */ type AuthorityOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type AuthorityOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the authority options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthorityOptionsParams) WithDefaults() *AuthorityOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the authority options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthorityOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the authority options params func (o *AuthorityOptionsParams) WithTimeout(timeout time.Duration) *AuthorityOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/authority_options_responses.go b/api/regs/regs_client/cors/authority_options_responses.go index d16e42d..6bfcee2 100644 --- a/api/regs/regs_client/cors/authority_options_responses.go +++ b/api/regs/regs_client/cors/authority_options_responses.go @@ -30,9 +30,8 @@ func (o *AuthorityOptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewAuthorityOptionsOK() *AuthorityOptionsOK { return &AuthorityOptionsOK{} } -/*AuthorityOptionsOK handles this case with default header values. +/* AuthorityOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type AuthorityOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *AuthorityOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *AuthorityOptionsOK) Error() string { func (o *AuthorityOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/backend_options_parameters.go b/api/regs/regs_client/cors/backend_options_parameters.go index ef9ad1b..5e0bc8d 100644 --- a/api/regs/regs_client/cors/backend_options_parameters.go +++ b/api/regs/regs_client/cors/backend_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewBackendOptionsParams creates a new BackendOptionsParams object -// with the default values initialized. +// NewBackendOptionsParams creates a new BackendOptionsParams 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 NewBackendOptionsParams() *BackendOptionsParams { - return &BackendOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewBackendOptionsParamsWithTimeout creates a new BackendOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewBackendOptionsParamsWithTimeout(timeout time.Duration) *BackendOptionsParams { - return &BackendOptionsParams{ - timeout: timeout, } } // NewBackendOptionsParamsWithContext creates a new BackendOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewBackendOptionsParamsWithContext(ctx context.Context) *BackendOptionsParams { - return &BackendOptionsParams{ - Context: ctx, } } // NewBackendOptionsParamsWithHTTPClient creates a new BackendOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewBackendOptionsParamsWithHTTPClient(client *http.Client) *BackendOptionsParams { - return &BackendOptionsParams{ HTTPClient: client, } } -/*BackendOptionsParams contains all the parameters to send to the API endpoint -for the backend options operation typically these are written to a http.Request +/* BackendOptionsParams contains all the parameters to send to the API endpoint + for the backend options operation. + + Typically these are written to a http.Request. */ type BackendOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type BackendOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the backend options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BackendOptionsParams) WithDefaults() *BackendOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the backend options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BackendOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the backend options params func (o *BackendOptionsParams) WithTimeout(timeout time.Duration) *BackendOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/backend_options_responses.go b/api/regs/regs_client/cors/backend_options_responses.go index 494d30d..bbc816a 100644 --- a/api/regs/regs_client/cors/backend_options_responses.go +++ b/api/regs/regs_client/cors/backend_options_responses.go @@ -30,9 +30,8 @@ func (o *BackendOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewBackendOptionsOK() *BackendOptionsOK { return &BackendOptionsOK{} } -/*BackendOptionsOK handles this case with default header values. +/* BackendOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type BackendOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *BackendOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *BackendOptionsOK) Error() string { func (o *BackendOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/cors_client.go b/api/regs/regs_client/cors/cors_client.go index 40a5b6b..599f8d5 100644 --- a/api/regs/regs_client/cors/cors_client.go +++ b/api/regs/regs_client/cors/cors_client.go @@ -29,29 +29,32 @@ type Client struct { 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 { - AuthorityOptions(params *AuthorityOptionsParams) (*AuthorityOptionsOK, error) + AuthorityOptions(params *AuthorityOptionsParams, opts ...ClientOption) (*AuthorityOptionsOK, error) - BackendOptions(params *BackendOptionsParams) (*BackendOptionsOK, error) + BackendOptions(params *BackendOptionsParams, opts ...ClientOption) (*BackendOptionsOK, error) - FilingOptions(params *FilingOptionsParams) (*FilingOptionsOK, error) + FilingOptions(params *FilingOptionsParams, opts ...ClientOption) (*FilingOptionsOK, error) - FilingTypeOptions(params *FilingTypeOptionsParams) (*FilingTypeOptionsOK, error) + FilingTypeOptions(params *FilingTypeOptionsParams, opts ...ClientOption) (*FilingTypeOptionsOK, error) - LicenseOptions(params *LicenseOptionsParams) (*LicenseOptionsOK, error) + LicenseOptions(params *LicenseOptionsParams, opts ...ClientOption) (*LicenseOptionsOK, error) - LicenseTypeOptions(params *LicenseTypeOptionsParams) (*LicenseTypeOptionsOK, error) + LicenseTypeOptions(params *LicenseTypeOptionsParams, opts ...ClientOption) (*LicenseTypeOptionsOK, error) - NotebookOptions(params *NotebookOptionsParams) (*NotebookOptionsOK, error) + NotebookOptions(params *NotebookOptionsParams, opts ...ClientOption) (*NotebookOptionsOK, error) - RatingEngineOptions(params *RatingEngineOptionsParams) (*RatingEngineOptionsOK, error) + RatingEngineOptions(params *RatingEngineOptionsParams, opts ...ClientOption) (*RatingEngineOptionsOK, error) - SubmissionOptions(params *SubmissionOptionsParams) (*SubmissionOptionsOK, error) + SubmissionOptions(params *SubmissionOptionsParams, opts ...ClientOption) (*SubmissionOptionsOK, error) - TaxTypeAccountOptions(params *TaxTypeAccountOptionsParams) (*TaxTypeAccountOptionsOK, error) + TaxTypeAccountOptions(params *TaxTypeAccountOptionsParams, opts ...ClientOption) (*TaxTypeAccountOptionsOK, error) - TransactionOptions(params *TransactionOptionsParams) (*TransactionOptionsOK, error) + TransactionOptions(params *TransactionOptionsParams, opts ...ClientOption) (*TransactionOptionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -59,13 +62,12 @@ type ClientService interface { /* AuthorityOptions CORS support */ -func (a *Client) AuthorityOptions(params *AuthorityOptionsParams) (*AuthorityOptionsOK, error) { +func (a *Client) AuthorityOptions(params *AuthorityOptionsParams, opts ...ClientOption) (*AuthorityOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAuthorityOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "authorityOptions", Method: "OPTIONS", PathPattern: "/authorities", @@ -76,7 +78,12 @@ func (a *Client) AuthorityOptions(params *AuthorityOptionsParams) (*AuthorityOpt Reader: &AuthorityOptionsReader{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 } @@ -93,13 +100,12 @@ func (a *Client) AuthorityOptions(params *AuthorityOptionsParams) (*AuthorityOpt /* BackendOptions CORS support */ -func (a *Client) BackendOptions(params *BackendOptionsParams) (*BackendOptionsOK, error) { +func (a *Client) BackendOptions(params *BackendOptionsParams, opts ...ClientOption) (*BackendOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewBackendOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "backendOptions", Method: "OPTIONS", PathPattern: "/backends", @@ -110,7 +116,12 @@ func (a *Client) BackendOptions(params *BackendOptionsParams) (*BackendOptionsOK Reader: &BackendOptionsReader{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 } @@ -127,13 +138,12 @@ func (a *Client) BackendOptions(params *BackendOptionsParams) (*BackendOptionsOK /* FilingOptions CORS support */ -func (a *Client) FilingOptions(params *FilingOptionsParams) (*FilingOptionsOK, error) { +func (a *Client) FilingOptions(params *FilingOptionsParams, opts ...ClientOption) (*FilingOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewFilingOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "filingOptions", Method: "OPTIONS", PathPattern: "/filings", @@ -144,7 +154,12 @@ func (a *Client) FilingOptions(params *FilingOptionsParams) (*FilingOptionsOK, e Reader: &FilingOptionsReader{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 } @@ -161,13 +176,12 @@ func (a *Client) FilingOptions(params *FilingOptionsParams) (*FilingOptionsOK, e /* FilingTypeOptions CORS support */ -func (a *Client) FilingTypeOptions(params *FilingTypeOptionsParams) (*FilingTypeOptionsOK, error) { +func (a *Client) FilingTypeOptions(params *FilingTypeOptionsParams, opts ...ClientOption) (*FilingTypeOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewFilingTypeOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "filingTypeOptions", Method: "OPTIONS", PathPattern: "/filingtypes", @@ -178,7 +192,12 @@ func (a *Client) FilingTypeOptions(params *FilingTypeOptionsParams) (*FilingType Reader: &FilingTypeOptionsReader{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 } @@ -195,13 +214,12 @@ func (a *Client) FilingTypeOptions(params *FilingTypeOptionsParams) (*FilingType /* LicenseOptions CORS support */ -func (a *Client) LicenseOptions(params *LicenseOptionsParams) (*LicenseOptionsOK, error) { +func (a *Client) LicenseOptions(params *LicenseOptionsParams, opts ...ClientOption) (*LicenseOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewLicenseOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "licenseOptions", Method: "OPTIONS", PathPattern: "/licenses", @@ -212,7 +230,12 @@ func (a *Client) LicenseOptions(params *LicenseOptionsParams) (*LicenseOptionsOK Reader: &LicenseOptionsReader{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 } @@ -229,13 +252,12 @@ func (a *Client) LicenseOptions(params *LicenseOptionsParams) (*LicenseOptionsOK /* LicenseTypeOptions CORS support */ -func (a *Client) LicenseTypeOptions(params *LicenseTypeOptionsParams) (*LicenseTypeOptionsOK, error) { +func (a *Client) LicenseTypeOptions(params *LicenseTypeOptionsParams, opts ...ClientOption) (*LicenseTypeOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewLicenseTypeOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "licenseTypeOptions", Method: "OPTIONS", PathPattern: "/licensetypes", @@ -246,7 +268,12 @@ func (a *Client) LicenseTypeOptions(params *LicenseTypeOptionsParams) (*LicenseT Reader: &LicenseTypeOptionsReader{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 } @@ -263,13 +290,12 @@ func (a *Client) LicenseTypeOptions(params *LicenseTypeOptionsParams) (*LicenseT /* NotebookOptions CORS support */ -func (a *Client) NotebookOptions(params *NotebookOptionsParams) (*NotebookOptionsOK, error) { +func (a *Client) NotebookOptions(params *NotebookOptionsParams, opts ...ClientOption) (*NotebookOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewNotebookOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "notebookOptions", Method: "OPTIONS", PathPattern: "/notebooks", @@ -280,7 +306,12 @@ func (a *Client) NotebookOptions(params *NotebookOptionsParams) (*NotebookOption Reader: &NotebookOptionsReader{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 } @@ -297,13 +328,12 @@ func (a *Client) NotebookOptions(params *NotebookOptionsParams) (*NotebookOption /* RatingEngineOptions CORS support */ -func (a *Client) RatingEngineOptions(params *RatingEngineOptionsParams) (*RatingEngineOptionsOK, error) { +func (a *Client) RatingEngineOptions(params *RatingEngineOptionsParams, opts ...ClientOption) (*RatingEngineOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewRatingEngineOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "ratingEngineOptions", Method: "OPTIONS", PathPattern: "/ratingengines", @@ -314,7 +344,12 @@ func (a *Client) RatingEngineOptions(params *RatingEngineOptionsParams) (*Rating Reader: &RatingEngineOptionsReader{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 } @@ -331,13 +366,12 @@ func (a *Client) RatingEngineOptions(params *RatingEngineOptionsParams) (*Rating /* SubmissionOptions CORS support */ -func (a *Client) SubmissionOptions(params *SubmissionOptionsParams) (*SubmissionOptionsOK, error) { +func (a *Client) SubmissionOptions(params *SubmissionOptionsParams, opts ...ClientOption) (*SubmissionOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewSubmissionOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "submissionOptions", Method: "OPTIONS", PathPattern: "/submissions", @@ -348,7 +382,12 @@ func (a *Client) SubmissionOptions(params *SubmissionOptionsParams) (*Submission Reader: &SubmissionOptionsReader{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 } @@ -365,13 +404,12 @@ func (a *Client) SubmissionOptions(params *SubmissionOptionsParams) (*Submission /* TaxTypeAccountOptions CORS support */ -func (a *Client) TaxTypeAccountOptions(params *TaxTypeAccountOptionsParams) (*TaxTypeAccountOptionsOK, error) { +func (a *Client) TaxTypeAccountOptions(params *TaxTypeAccountOptionsParams, opts ...ClientOption) (*TaxTypeAccountOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTaxTypeAccountOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "taxTypeAccountOptions", Method: "OPTIONS", PathPattern: "/taxtypeaccounts", @@ -382,7 +420,12 @@ func (a *Client) TaxTypeAccountOptions(params *TaxTypeAccountOptionsParams) (*Ta Reader: &TaxTypeAccountOptionsReader{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 } @@ -399,13 +442,12 @@ func (a *Client) TaxTypeAccountOptions(params *TaxTypeAccountOptionsParams) (*Ta /* TransactionOptions CORS support */ -func (a *Client) TransactionOptions(params *TransactionOptionsParams) (*TransactionOptionsOK, error) { +func (a *Client) TransactionOptions(params *TransactionOptionsParams, opts ...ClientOption) (*TransactionOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTransactionOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "transactionOptions", Method: "OPTIONS", PathPattern: "/transactions", @@ -416,7 +458,12 @@ func (a *Client) TransactionOptions(params *TransactionOptionsParams) (*Transact Reader: &TransactionOptionsReader{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 } diff --git a/api/regs/regs_client/cors/filing_options_parameters.go b/api/regs/regs_client/cors/filing_options_parameters.go index 9a8a1da..43b120a 100644 --- a/api/regs/regs_client/cors/filing_options_parameters.go +++ b/api/regs/regs_client/cors/filing_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewFilingOptionsParams creates a new FilingOptionsParams object -// with the default values initialized. +// NewFilingOptionsParams creates a new FilingOptionsParams 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 NewFilingOptionsParams() *FilingOptionsParams { - return &FilingOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewFilingOptionsParamsWithTimeout creates a new FilingOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewFilingOptionsParamsWithTimeout(timeout time.Duration) *FilingOptionsParams { - return &FilingOptionsParams{ - timeout: timeout, } } // NewFilingOptionsParamsWithContext creates a new FilingOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewFilingOptionsParamsWithContext(ctx context.Context) *FilingOptionsParams { - return &FilingOptionsParams{ - Context: ctx, } } // NewFilingOptionsParamsWithHTTPClient creates a new FilingOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewFilingOptionsParamsWithHTTPClient(client *http.Client) *FilingOptionsParams { - return &FilingOptionsParams{ HTTPClient: client, } } -/*FilingOptionsParams contains all the parameters to send to the API endpoint -for the filing options operation typically these are written to a http.Request +/* FilingOptionsParams contains all the parameters to send to the API endpoint + for the filing options operation. + + Typically these are written to a http.Request. */ type FilingOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type FilingOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the filing options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilingOptionsParams) WithDefaults() *FilingOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filing options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilingOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the filing options params func (o *FilingOptionsParams) WithTimeout(timeout time.Duration) *FilingOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/filing_options_responses.go b/api/regs/regs_client/cors/filing_options_responses.go index e844929..91e2c06 100644 --- a/api/regs/regs_client/cors/filing_options_responses.go +++ b/api/regs/regs_client/cors/filing_options_responses.go @@ -30,9 +30,8 @@ func (o *FilingOptionsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewFilingOptionsOK() *FilingOptionsOK { return &FilingOptionsOK{} } -/*FilingOptionsOK handles this case with default header values. +/* FilingOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type FilingOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *FilingOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *FilingOptionsOK) Error() string { func (o *FilingOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/filing_type_options_parameters.go b/api/regs/regs_client/cors/filing_type_options_parameters.go index e09fd80..625452c 100644 --- a/api/regs/regs_client/cors/filing_type_options_parameters.go +++ b/api/regs/regs_client/cors/filing_type_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewFilingTypeOptionsParams creates a new FilingTypeOptionsParams object -// with the default values initialized. +// NewFilingTypeOptionsParams creates a new FilingTypeOptionsParams 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 NewFilingTypeOptionsParams() *FilingTypeOptionsParams { - return &FilingTypeOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewFilingTypeOptionsParamsWithTimeout creates a new FilingTypeOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewFilingTypeOptionsParamsWithTimeout(timeout time.Duration) *FilingTypeOptionsParams { - return &FilingTypeOptionsParams{ - timeout: timeout, } } // NewFilingTypeOptionsParamsWithContext creates a new FilingTypeOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewFilingTypeOptionsParamsWithContext(ctx context.Context) *FilingTypeOptionsParams { - return &FilingTypeOptionsParams{ - Context: ctx, } } // NewFilingTypeOptionsParamsWithHTTPClient creates a new FilingTypeOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewFilingTypeOptionsParamsWithHTTPClient(client *http.Client) *FilingTypeOptionsParams { - return &FilingTypeOptionsParams{ HTTPClient: client, } } -/*FilingTypeOptionsParams contains all the parameters to send to the API endpoint -for the filing type options operation typically these are written to a http.Request +/* FilingTypeOptionsParams contains all the parameters to send to the API endpoint + for the filing type options operation. + + Typically these are written to a http.Request. */ type FilingTypeOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type FilingTypeOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the filing type options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilingTypeOptionsParams) WithDefaults() *FilingTypeOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filing type options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilingTypeOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the filing type options params func (o *FilingTypeOptionsParams) WithTimeout(timeout time.Duration) *FilingTypeOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/filing_type_options_responses.go b/api/regs/regs_client/cors/filing_type_options_responses.go index 158a37b..13aea7d 100644 --- a/api/regs/regs_client/cors/filing_type_options_responses.go +++ b/api/regs/regs_client/cors/filing_type_options_responses.go @@ -30,9 +30,8 @@ func (o *FilingTypeOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewFilingTypeOptionsOK() *FilingTypeOptionsOK { return &FilingTypeOptionsOK{} } -/*FilingTypeOptionsOK handles this case with default header values. +/* FilingTypeOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type FilingTypeOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *FilingTypeOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *FilingTypeOptionsOK) Error() string { func (o *FilingTypeOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/license_options_parameters.go b/api/regs/regs_client/cors/license_options_parameters.go index 048b0a6..ff98057 100644 --- a/api/regs/regs_client/cors/license_options_parameters.go +++ b/api/regs/regs_client/cors/license_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewLicenseOptionsParams creates a new LicenseOptionsParams object -// with the default values initialized. +// NewLicenseOptionsParams creates a new LicenseOptionsParams 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 NewLicenseOptionsParams() *LicenseOptionsParams { - return &LicenseOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewLicenseOptionsParamsWithTimeout creates a new LicenseOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewLicenseOptionsParamsWithTimeout(timeout time.Duration) *LicenseOptionsParams { - return &LicenseOptionsParams{ - timeout: timeout, } } // NewLicenseOptionsParamsWithContext creates a new LicenseOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewLicenseOptionsParamsWithContext(ctx context.Context) *LicenseOptionsParams { - return &LicenseOptionsParams{ - Context: ctx, } } // NewLicenseOptionsParamsWithHTTPClient creates a new LicenseOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewLicenseOptionsParamsWithHTTPClient(client *http.Client) *LicenseOptionsParams { - return &LicenseOptionsParams{ HTTPClient: client, } } -/*LicenseOptionsParams contains all the parameters to send to the API endpoint -for the license options operation typically these are written to a http.Request +/* LicenseOptionsParams contains all the parameters to send to the API endpoint + for the license options operation. + + Typically these are written to a http.Request. */ type LicenseOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type LicenseOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the license options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LicenseOptionsParams) WithDefaults() *LicenseOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the license options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LicenseOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the license options params func (o *LicenseOptionsParams) WithTimeout(timeout time.Duration) *LicenseOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/license_options_responses.go b/api/regs/regs_client/cors/license_options_responses.go index 5e1c10e..d8cbce0 100644 --- a/api/regs/regs_client/cors/license_options_responses.go +++ b/api/regs/regs_client/cors/license_options_responses.go @@ -30,9 +30,8 @@ func (o *LicenseOptionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewLicenseOptionsOK() *LicenseOptionsOK { return &LicenseOptionsOK{} } -/*LicenseOptionsOK handles this case with default header values. +/* LicenseOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type LicenseOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *LicenseOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *LicenseOptionsOK) Error() string { func (o *LicenseOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/license_type_options_parameters.go b/api/regs/regs_client/cors/license_type_options_parameters.go index faf09e9..88639ef 100644 --- a/api/regs/regs_client/cors/license_type_options_parameters.go +++ b/api/regs/regs_client/cors/license_type_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewLicenseTypeOptionsParams creates a new LicenseTypeOptionsParams object -// with the default values initialized. +// NewLicenseTypeOptionsParams creates a new LicenseTypeOptionsParams 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 NewLicenseTypeOptionsParams() *LicenseTypeOptionsParams { - return &LicenseTypeOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewLicenseTypeOptionsParamsWithTimeout creates a new LicenseTypeOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewLicenseTypeOptionsParamsWithTimeout(timeout time.Duration) *LicenseTypeOptionsParams { - return &LicenseTypeOptionsParams{ - timeout: timeout, } } // NewLicenseTypeOptionsParamsWithContext creates a new LicenseTypeOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewLicenseTypeOptionsParamsWithContext(ctx context.Context) *LicenseTypeOptionsParams { - return &LicenseTypeOptionsParams{ - Context: ctx, } } // NewLicenseTypeOptionsParamsWithHTTPClient creates a new LicenseTypeOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewLicenseTypeOptionsParamsWithHTTPClient(client *http.Client) *LicenseTypeOptionsParams { - return &LicenseTypeOptionsParams{ HTTPClient: client, } } -/*LicenseTypeOptionsParams contains all the parameters to send to the API endpoint -for the license type options operation typically these are written to a http.Request +/* LicenseTypeOptionsParams contains all the parameters to send to the API endpoint + for the license type options operation. + + Typically these are written to a http.Request. */ type LicenseTypeOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type LicenseTypeOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the license type options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LicenseTypeOptionsParams) WithDefaults() *LicenseTypeOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the license type options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LicenseTypeOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the license type options params func (o *LicenseTypeOptionsParams) WithTimeout(timeout time.Duration) *LicenseTypeOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/license_type_options_responses.go b/api/regs/regs_client/cors/license_type_options_responses.go index 38b5f88..29929b8 100644 --- a/api/regs/regs_client/cors/license_type_options_responses.go +++ b/api/regs/regs_client/cors/license_type_options_responses.go @@ -30,9 +30,8 @@ func (o *LicenseTypeOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewLicenseTypeOptionsOK() *LicenseTypeOptionsOK { return &LicenseTypeOptionsOK{} } -/*LicenseTypeOptionsOK handles this case with default header values. +/* LicenseTypeOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type LicenseTypeOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *LicenseTypeOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *LicenseTypeOptionsOK) Error() string { func (o *LicenseTypeOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/notebook_options_parameters.go b/api/regs/regs_client/cors/notebook_options_parameters.go index bdebc80..f790072 100644 --- a/api/regs/regs_client/cors/notebook_options_parameters.go +++ b/api/regs/regs_client/cors/notebook_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewNotebookOptionsParams creates a new NotebookOptionsParams object -// with the default values initialized. +// NewNotebookOptionsParams creates a new NotebookOptionsParams 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 NewNotebookOptionsParams() *NotebookOptionsParams { - return &NotebookOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewNotebookOptionsParamsWithTimeout creates a new NotebookOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewNotebookOptionsParamsWithTimeout(timeout time.Duration) *NotebookOptionsParams { - return &NotebookOptionsParams{ - timeout: timeout, } } // NewNotebookOptionsParamsWithContext creates a new NotebookOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewNotebookOptionsParamsWithContext(ctx context.Context) *NotebookOptionsParams { - return &NotebookOptionsParams{ - Context: ctx, } } // NewNotebookOptionsParamsWithHTTPClient creates a new NotebookOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewNotebookOptionsParamsWithHTTPClient(client *http.Client) *NotebookOptionsParams { - return &NotebookOptionsParams{ HTTPClient: client, } } -/*NotebookOptionsParams contains all the parameters to send to the API endpoint -for the notebook options operation typically these are written to a http.Request +/* NotebookOptionsParams contains all the parameters to send to the API endpoint + for the notebook options operation. + + Typically these are written to a http.Request. */ type NotebookOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type NotebookOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the notebook options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotebookOptionsParams) WithDefaults() *NotebookOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the notebook options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotebookOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the notebook options params func (o *NotebookOptionsParams) WithTimeout(timeout time.Duration) *NotebookOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/notebook_options_responses.go b/api/regs/regs_client/cors/notebook_options_responses.go index 1a7e45d..800d37c 100644 --- a/api/regs/regs_client/cors/notebook_options_responses.go +++ b/api/regs/regs_client/cors/notebook_options_responses.go @@ -30,9 +30,8 @@ func (o *NotebookOptionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewNotebookOptionsOK() *NotebookOptionsOK { return &NotebookOptionsOK{} } -/*NotebookOptionsOK handles this case with default header values. +/* NotebookOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type NotebookOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *NotebookOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *NotebookOptionsOK) Error() string { func (o *NotebookOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/rating_engine_options_parameters.go b/api/regs/regs_client/cors/rating_engine_options_parameters.go index 05bda68..3e6a697 100644 --- a/api/regs/regs_client/cors/rating_engine_options_parameters.go +++ b/api/regs/regs_client/cors/rating_engine_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewRatingEngineOptionsParams creates a new RatingEngineOptionsParams object -// with the default values initialized. +// NewRatingEngineOptionsParams creates a new RatingEngineOptionsParams 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 NewRatingEngineOptionsParams() *RatingEngineOptionsParams { - return &RatingEngineOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewRatingEngineOptionsParamsWithTimeout creates a new RatingEngineOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewRatingEngineOptionsParamsWithTimeout(timeout time.Duration) *RatingEngineOptionsParams { - return &RatingEngineOptionsParams{ - timeout: timeout, } } // NewRatingEngineOptionsParamsWithContext creates a new RatingEngineOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewRatingEngineOptionsParamsWithContext(ctx context.Context) *RatingEngineOptionsParams { - return &RatingEngineOptionsParams{ - Context: ctx, } } // NewRatingEngineOptionsParamsWithHTTPClient creates a new RatingEngineOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewRatingEngineOptionsParamsWithHTTPClient(client *http.Client) *RatingEngineOptionsParams { - return &RatingEngineOptionsParams{ HTTPClient: client, } } -/*RatingEngineOptionsParams contains all the parameters to send to the API endpoint -for the rating engine options operation typically these are written to a http.Request +/* RatingEngineOptionsParams contains all the parameters to send to the API endpoint + for the rating engine options operation. + + Typically these are written to a http.Request. */ type RatingEngineOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type RatingEngineOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the rating engine options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RatingEngineOptionsParams) WithDefaults() *RatingEngineOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rating engine options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RatingEngineOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the rating engine options params func (o *RatingEngineOptionsParams) WithTimeout(timeout time.Duration) *RatingEngineOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/rating_engine_options_responses.go b/api/regs/regs_client/cors/rating_engine_options_responses.go index 1e2a1aa..b7e0458 100644 --- a/api/regs/regs_client/cors/rating_engine_options_responses.go +++ b/api/regs/regs_client/cors/rating_engine_options_responses.go @@ -30,9 +30,8 @@ func (o *RatingEngineOptionsReader) ReadResponse(response runtime.ClientResponse return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewRatingEngineOptionsOK() *RatingEngineOptionsOK { return &RatingEngineOptionsOK{} } -/*RatingEngineOptionsOK handles this case with default header values. +/* RatingEngineOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type RatingEngineOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *RatingEngineOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *RatingEngineOptionsOK) Error() string { func (o *RatingEngineOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/submission_options_parameters.go b/api/regs/regs_client/cors/submission_options_parameters.go index 0e53441..35459cf 100644 --- a/api/regs/regs_client/cors/submission_options_parameters.go +++ b/api/regs/regs_client/cors/submission_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewSubmissionOptionsParams creates a new SubmissionOptionsParams object -// with the default values initialized. +// NewSubmissionOptionsParams creates a new SubmissionOptionsParams 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 NewSubmissionOptionsParams() *SubmissionOptionsParams { - return &SubmissionOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewSubmissionOptionsParamsWithTimeout creates a new SubmissionOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewSubmissionOptionsParamsWithTimeout(timeout time.Duration) *SubmissionOptionsParams { - return &SubmissionOptionsParams{ - timeout: timeout, } } // NewSubmissionOptionsParamsWithContext creates a new SubmissionOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewSubmissionOptionsParamsWithContext(ctx context.Context) *SubmissionOptionsParams { - return &SubmissionOptionsParams{ - Context: ctx, } } // NewSubmissionOptionsParamsWithHTTPClient creates a new SubmissionOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewSubmissionOptionsParamsWithHTTPClient(client *http.Client) *SubmissionOptionsParams { - return &SubmissionOptionsParams{ HTTPClient: client, } } -/*SubmissionOptionsParams contains all the parameters to send to the API endpoint -for the submission options operation typically these are written to a http.Request +/* SubmissionOptionsParams contains all the parameters to send to the API endpoint + for the submission options operation. + + Typically these are written to a http.Request. */ type SubmissionOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type SubmissionOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the submission options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SubmissionOptionsParams) WithDefaults() *SubmissionOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the submission options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SubmissionOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the submission options params func (o *SubmissionOptionsParams) WithTimeout(timeout time.Duration) *SubmissionOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/submission_options_responses.go b/api/regs/regs_client/cors/submission_options_responses.go index 75dd816..6f186a2 100644 --- a/api/regs/regs_client/cors/submission_options_responses.go +++ b/api/regs/regs_client/cors/submission_options_responses.go @@ -30,9 +30,8 @@ func (o *SubmissionOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewSubmissionOptionsOK() *SubmissionOptionsOK { return &SubmissionOptionsOK{} } -/*SubmissionOptionsOK handles this case with default header values. +/* SubmissionOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type SubmissionOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *SubmissionOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *SubmissionOptionsOK) Error() string { func (o *SubmissionOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/tax_type_account_options_parameters.go b/api/regs/regs_client/cors/tax_type_account_options_parameters.go index 2258a58..d866ea3 100644 --- a/api/regs/regs_client/cors/tax_type_account_options_parameters.go +++ b/api/regs/regs_client/cors/tax_type_account_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTaxTypeAccountOptionsParams creates a new TaxTypeAccountOptionsParams object -// with the default values initialized. +// NewTaxTypeAccountOptionsParams creates a new TaxTypeAccountOptionsParams 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 NewTaxTypeAccountOptionsParams() *TaxTypeAccountOptionsParams { - return &TaxTypeAccountOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTaxTypeAccountOptionsParamsWithTimeout creates a new TaxTypeAccountOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTaxTypeAccountOptionsParamsWithTimeout(timeout time.Duration) *TaxTypeAccountOptionsParams { - return &TaxTypeAccountOptionsParams{ - timeout: timeout, } } // NewTaxTypeAccountOptionsParamsWithContext creates a new TaxTypeAccountOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTaxTypeAccountOptionsParamsWithContext(ctx context.Context) *TaxTypeAccountOptionsParams { - return &TaxTypeAccountOptionsParams{ - Context: ctx, } } // NewTaxTypeAccountOptionsParamsWithHTTPClient creates a new TaxTypeAccountOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTaxTypeAccountOptionsParamsWithHTTPClient(client *http.Client) *TaxTypeAccountOptionsParams { - return &TaxTypeAccountOptionsParams{ HTTPClient: client, } } -/*TaxTypeAccountOptionsParams contains all the parameters to send to the API endpoint -for the tax type account options operation typically these are written to a http.Request +/* TaxTypeAccountOptionsParams contains all the parameters to send to the API endpoint + for the tax type account options operation. + + Typically these are written to a http.Request. */ type TaxTypeAccountOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TaxTypeAccountOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tax type account options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxTypeAccountOptionsParams) WithDefaults() *TaxTypeAccountOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tax type account options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxTypeAccountOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tax type account options params func (o *TaxTypeAccountOptionsParams) WithTimeout(timeout time.Duration) *TaxTypeAccountOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/tax_type_account_options_responses.go b/api/regs/regs_client/cors/tax_type_account_options_responses.go index c658e85..8afab24 100644 --- a/api/regs/regs_client/cors/tax_type_account_options_responses.go +++ b/api/regs/regs_client/cors/tax_type_account_options_responses.go @@ -30,9 +30,8 @@ func (o *TaxTypeAccountOptionsReader) ReadResponse(response runtime.ClientRespon return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTaxTypeAccountOptionsOK() *TaxTypeAccountOptionsOK { return &TaxTypeAccountOptionsOK{} } -/*TaxTypeAccountOptionsOK handles this case with default header values. +/* TaxTypeAccountOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TaxTypeAccountOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TaxTypeAccountOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TaxTypeAccountOptionsOK) Error() string { func (o *TaxTypeAccountOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/cors/transaction_options_parameters.go b/api/regs/regs_client/cors/transaction_options_parameters.go index 1098734..17d18d1 100644 --- a/api/regs/regs_client/cors/transaction_options_parameters.go +++ b/api/regs/regs_client/cors/transaction_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTransactionOptionsParams creates a new TransactionOptionsParams object -// with the default values initialized. +// NewTransactionOptionsParams creates a new TransactionOptionsParams 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 NewTransactionOptionsParams() *TransactionOptionsParams { - return &TransactionOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTransactionOptionsParamsWithTimeout creates a new TransactionOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTransactionOptionsParamsWithTimeout(timeout time.Duration) *TransactionOptionsParams { - return &TransactionOptionsParams{ - timeout: timeout, } } // NewTransactionOptionsParamsWithContext creates a new TransactionOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTransactionOptionsParamsWithContext(ctx context.Context) *TransactionOptionsParams { - return &TransactionOptionsParams{ - Context: ctx, } } // NewTransactionOptionsParamsWithHTTPClient creates a new TransactionOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTransactionOptionsParamsWithHTTPClient(client *http.Client) *TransactionOptionsParams { - return &TransactionOptionsParams{ HTTPClient: client, } } -/*TransactionOptionsParams contains all the parameters to send to the API endpoint -for the transaction options operation typically these are written to a http.Request +/* TransactionOptionsParams contains all the parameters to send to the API endpoint + for the transaction options operation. + + Typically these are written to a http.Request. */ type TransactionOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TransactionOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the transaction options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TransactionOptionsParams) WithDefaults() *TransactionOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the transaction options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TransactionOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the transaction options params func (o *TransactionOptionsParams) WithTimeout(timeout time.Duration) *TransactionOptionsParams { o.SetTimeout(timeout) diff --git a/api/regs/regs_client/cors/transaction_options_responses.go b/api/regs/regs_client/cors/transaction_options_responses.go index bac64da..6682857 100644 --- a/api/regs/regs_client/cors/transaction_options_responses.go +++ b/api/regs/regs_client/cors/transaction_options_responses.go @@ -30,9 +30,8 @@ func (o *TransactionOptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTransactionOptionsOK() *TransactionOptionsOK { return &TransactionOptionsOK{} } -/*TransactionOptionsOK handles this case with default header values. +/* TransactionOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TransactionOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TransactionOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TransactionOptionsOK) Error() string { func (o *TransactionOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/regs/regs_client/filing/filing_client.go b/api/regs/regs_client/filing/filing_client.go index 66c4df1..08fd6c1 100644 --- a/api/regs/regs_client/filing/filing_client.go +++ b/api/regs/regs_client/filing/filing_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingsOK, error) + GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingsOK, error) - PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingsOK, error) + PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingsOK, error) - PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingsOK, error) + PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Regulatory Filings */ -func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingsOK, error) { +func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetFilingsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getFilings", Method: "GET", PathPattern: "/filings", @@ -63,7 +65,12 @@ func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAut 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 } @@ -82,13 +89,12 @@ func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAut Create new Filings */ -func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingsOK, error) { +func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostFilingsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postFilings", Method: "POST", PathPattern: "/filings", @@ -100,7 +106,12 @@ func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientA 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 } @@ -119,13 +130,12 @@ func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientA Update all the fields in a Filing record identified by Taxnexus ID */ -func (a *Client) PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingsOK, error) { +func (a *Client) PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutFilingsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putFilings", Method: "PUT", PathPattern: "/filings", @@ -137,7 +147,12 @@ func (a *Client) PutFilings(params *PutFilingsParams, authInfo runtime.ClientAut 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 } diff --git a/api/regs/regs_client/filing/get_filings_parameters.go b/api/regs/regs_client/filing/get_filings_parameters.go index f78ad8a..730192a 100644 --- a/api/regs/regs_client/filing/get_filings_parameters.go +++ b/api/regs/regs_client/filing/get_filings_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetFilingsParams creates a new GetFilingsParams object -// with the default values initialized. +// NewGetFilingsParams creates a new GetFilingsParams 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 NewGetFilingsParams() *GetFilingsParams { - var () return &GetFilingsParams{ - timeout: cr.DefaultTimeout, } } // NewGetFilingsParamsWithTimeout creates a new GetFilingsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetFilingsParamsWithTimeout(timeout time.Duration) *GetFilingsParams { - var () return &GetFilingsParams{ - timeout: timeout, } } // NewGetFilingsParamsWithContext creates a new GetFilingsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetFilingsParamsWithContext(ctx context.Context) *GetFilingsParams { - var () return &GetFilingsParams{ - Context: ctx, } } // NewGetFilingsParamsWithHTTPClient creates a new GetFilingsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetFilingsParamsWithHTTPClient(client *http.Client) *GetFilingsParams { - var () return &GetFilingsParams{ HTTPClient: client, } } -/*GetFilingsParams contains all the parameters to send to the API endpoint -for the get filings operation typically these are written to a http.Request +/* GetFilingsParams contains all the parameters to send to the API endpoint + for the get filings operation. + + Typically these are written to a http.Request. */ type GetFilingsParams struct { - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + Taxnexus Record Id of a Company */ CompanyID *string - /*FilingID - Taxnexus Record Id of a Filing + /* FilingID. + + Taxnexus Record Id of a Filing */ FilingID *string - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + + Taxnexus Id of the record to be retrieved */ ID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -96,6 +103,21 @@ type GetFilingsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingsParams) WithDefaults() *GetFilingsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get filings params func (o *GetFilingsParams) WithTimeout(timeout time.Duration) *GetFilingsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetFilingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.FilingID != nil { // query param filingId var qrFilingID string + if o.FilingID != nil { qrFilingID = *o.FilingID } qFilingID := qrFilingID if qFilingID != "" { + if err := r.SetQueryParam("filingId", qFilingID); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); 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 { diff --git a/api/regs/regs_client/filing/get_filings_responses.go b/api/regs/regs_client/filing/get_filings_responses.go index 01855fa..313ab25 100644 --- a/api/regs/regs_client/filing/get_filings_responses.go +++ b/api/regs/regs_client/filing/get_filings_responses.go @@ -63,9 +63,8 @@ func (o *GetFilingsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetFilingsOK() *GetFilingsOK { return &GetFilingsOK{} } -/*GetFilingsOK handles this case with default header values. +/* GetFilingsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Filing objects */ type GetFilingsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.FilingResponse } @@ -89,18 +87,25 @@ type GetFilingsOK struct { func (o *GetFilingsOK) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsOK %+v", 200, o.Payload) } - func (o *GetFilingsOK) GetPayload() *regs_models.FilingResponse { return o.Payload } func (o *GetFilingsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.FilingResponse) @@ -117,7 +122,7 @@ func NewGetFilingsUnauthorized() *GetFilingsUnauthorized { return &GetFilingsUnauthorized{} } -/*GetFilingsUnauthorized handles this case with default header values. +/* GetFilingsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetFilingsUnauthorized struct { func (o *GetFilingsUnauthorized) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsUnauthorized %+v", 401, o.Payload) } - func (o *GetFilingsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetFilingsForbidden() *GetFilingsForbidden { return &GetFilingsForbidden{} } -/*GetFilingsForbidden handles this case with default header values. +/* GetFilingsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetFilingsForbidden struct { func (o *GetFilingsForbidden) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsForbidden %+v", 403, o.Payload) } - func (o *GetFilingsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetFilingsNotFound() *GetFilingsNotFound { return &GetFilingsNotFound{} } -/*GetFilingsNotFound handles this case with default header values. +/* GetFilingsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetFilingsNotFound struct { func (o *GetFilingsNotFound) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsNotFound %+v", 404, o.Payload) } - func (o *GetFilingsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetFilingsUnprocessableEntity() *GetFilingsUnprocessableEntity { return &GetFilingsUnprocessableEntity{} } -/*GetFilingsUnprocessableEntity handles this case with default header values. +/* GetFilingsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetFilingsUnprocessableEntity struct { func (o *GetFilingsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetFilingsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetFilingsInternalServerError() *GetFilingsInternalServerError { return &GetFilingsInternalServerError{} } -/*GetFilingsInternalServerError handles this case with default header values. +/* GetFilingsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetFilingsInternalServerError struct { func (o *GetFilingsInternalServerError) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsInternalServerError %+v", 500, o.Payload) } - func (o *GetFilingsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/filing/post_filings_parameters.go b/api/regs/regs_client/filing/post_filings_parameters.go index da44ce5..14efc32 100644 --- a/api/regs/regs_client/filing/post_filings_parameters.go +++ b/api/regs/regs_client/filing/post_filings_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostFilingsParams creates a new PostFilingsParams object -// with the default values initialized. +// NewPostFilingsParams creates a new PostFilingsParams 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 NewPostFilingsParams() *PostFilingsParams { - var () return &PostFilingsParams{ - timeout: cr.DefaultTimeout, } } // NewPostFilingsParamsWithTimeout creates a new PostFilingsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostFilingsParamsWithTimeout(timeout time.Duration) *PostFilingsParams { - var () return &PostFilingsParams{ - timeout: timeout, } } // NewPostFilingsParamsWithContext creates a new PostFilingsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostFilingsParamsWithContext(ctx context.Context) *PostFilingsParams { - var () return &PostFilingsParams{ - Context: ctx, } } // NewPostFilingsParamsWithHTTPClient creates a new PostFilingsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostFilingsParamsWithHTTPClient(client *http.Client) *PostFilingsParams { - var () return &PostFilingsParams{ HTTPClient: client, } } -/*PostFilingsParams contains all the parameters to send to the API endpoint -for the post filings operation typically these are written to a http.Request +/* PostFilingsParams contains all the parameters to send to the API endpoint + for the post filings operation. + + Typically these are written to a http.Request. */ type PostFilingsParams struct { - /*FilingRequest - A request with an array of Filing Objects + /* FilingRequest. + A request with an array of Filing Objects */ FilingRequest *regs_models.FilingRequest @@ -77,6 +76,21 @@ type PostFilingsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingsParams) WithDefaults() *PostFilingsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post filings params func (o *PostFilingsParams) WithTimeout(timeout time.Duration) *PostFilingsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostFilingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.FilingRequest != nil { if err := r.SetBodyParam(o.FilingRequest); err != nil { return err diff --git a/api/regs/regs_client/filing/post_filings_responses.go b/api/regs/regs_client/filing/post_filings_responses.go index 68de5bc..02a8402 100644 --- a/api/regs/regs_client/filing/post_filings_responses.go +++ b/api/regs/regs_client/filing/post_filings_responses.go @@ -63,9 +63,8 @@ func (o *PostFilingsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostFilingsOK() *PostFilingsOK { return &PostFilingsOK{} } -/*PostFilingsOK handles this case with default header values. +/* PostFilingsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Filing objects */ type PostFilingsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.FilingResponse } @@ -89,18 +87,25 @@ type PostFilingsOK struct { func (o *PostFilingsOK) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsOK %+v", 200, o.Payload) } - func (o *PostFilingsOK) GetPayload() *regs_models.FilingResponse { return o.Payload } func (o *PostFilingsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.FilingResponse) @@ -117,7 +122,7 @@ func NewPostFilingsUnauthorized() *PostFilingsUnauthorized { return &PostFilingsUnauthorized{} } -/*PostFilingsUnauthorized handles this case with default header values. +/* PostFilingsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostFilingsUnauthorized struct { func (o *PostFilingsUnauthorized) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsUnauthorized %+v", 401, o.Payload) } - func (o *PostFilingsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostFilingsForbidden() *PostFilingsForbidden { return &PostFilingsForbidden{} } -/*PostFilingsForbidden handles this case with default header values. +/* PostFilingsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostFilingsForbidden struct { func (o *PostFilingsForbidden) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsForbidden %+v", 403, o.Payload) } - func (o *PostFilingsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostFilingsNotFound() *PostFilingsNotFound { return &PostFilingsNotFound{} } -/*PostFilingsNotFound handles this case with default header values. +/* PostFilingsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostFilingsNotFound struct { func (o *PostFilingsNotFound) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsNotFound %+v", 404, o.Payload) } - func (o *PostFilingsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostFilingsUnprocessableEntity() *PostFilingsUnprocessableEntity { return &PostFilingsUnprocessableEntity{} } -/*PostFilingsUnprocessableEntity handles this case with default header values. +/* PostFilingsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostFilingsUnprocessableEntity struct { func (o *PostFilingsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostFilingsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostFilingsInternalServerError() *PostFilingsInternalServerError { return &PostFilingsInternalServerError{} } -/*PostFilingsInternalServerError handles this case with default header values. +/* PostFilingsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostFilingsInternalServerError struct { func (o *PostFilingsInternalServerError) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsInternalServerError %+v", 500, o.Payload) } - func (o *PostFilingsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/filing/put_filings_parameters.go b/api/regs/regs_client/filing/put_filings_parameters.go index 617da59..5a34bfd 100644 --- a/api/regs/regs_client/filing/put_filings_parameters.go +++ b/api/regs/regs_client/filing/put_filings_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutFilingsParams creates a new PutFilingsParams object -// with the default values initialized. +// NewPutFilingsParams creates a new PutFilingsParams 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 NewPutFilingsParams() *PutFilingsParams { - var () return &PutFilingsParams{ - timeout: cr.DefaultTimeout, } } // NewPutFilingsParamsWithTimeout creates a new PutFilingsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutFilingsParamsWithTimeout(timeout time.Duration) *PutFilingsParams { - var () return &PutFilingsParams{ - timeout: timeout, } } // NewPutFilingsParamsWithContext creates a new PutFilingsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutFilingsParamsWithContext(ctx context.Context) *PutFilingsParams { - var () return &PutFilingsParams{ - Context: ctx, } } // NewPutFilingsParamsWithHTTPClient creates a new PutFilingsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutFilingsParamsWithHTTPClient(client *http.Client) *PutFilingsParams { - var () return &PutFilingsParams{ HTTPClient: client, } } -/*PutFilingsParams contains all the parameters to send to the API endpoint -for the put filings operation typically these are written to a http.Request +/* PutFilingsParams contains all the parameters to send to the API endpoint + for the put filings operation. + + Typically these are written to a http.Request. */ type PutFilingsParams struct { - /*FilingRequest - A request with an array of Filing Objects + /* FilingRequest. + A request with an array of Filing Objects */ FilingRequest *regs_models.FilingRequest @@ -77,6 +76,21 @@ type PutFilingsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingsParams) WithDefaults() *PutFilingsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put filings params func (o *PutFilingsParams) WithTimeout(timeout time.Duration) *PutFilingsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutFilingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.FilingRequest != nil { if err := r.SetBodyParam(o.FilingRequest); err != nil { return err diff --git a/api/regs/regs_client/filing/put_filings_responses.go b/api/regs/regs_client/filing/put_filings_responses.go index 21f394b..c441903 100644 --- a/api/regs/regs_client/filing/put_filings_responses.go +++ b/api/regs/regs_client/filing/put_filings_responses.go @@ -63,9 +63,8 @@ func (o *PutFilingsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutFilingsOK() *PutFilingsOK { return &PutFilingsOK{} } -/*PutFilingsOK handles this case with default header values. +/* PutFilingsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Filing objects */ type PutFilingsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.FilingResponse } @@ -89,18 +87,25 @@ type PutFilingsOK struct { func (o *PutFilingsOK) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsOK %+v", 200, o.Payload) } - func (o *PutFilingsOK) GetPayload() *regs_models.FilingResponse { return o.Payload } func (o *PutFilingsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.FilingResponse) @@ -117,7 +122,7 @@ func NewPutFilingsUnauthorized() *PutFilingsUnauthorized { return &PutFilingsUnauthorized{} } -/*PutFilingsUnauthorized handles this case with default header values. +/* PutFilingsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutFilingsUnauthorized struct { func (o *PutFilingsUnauthorized) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsUnauthorized %+v", 401, o.Payload) } - func (o *PutFilingsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutFilingsForbidden() *PutFilingsForbidden { return &PutFilingsForbidden{} } -/*PutFilingsForbidden handles this case with default header values. +/* PutFilingsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutFilingsForbidden struct { func (o *PutFilingsForbidden) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsForbidden %+v", 403, o.Payload) } - func (o *PutFilingsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutFilingsNotFound() *PutFilingsNotFound { return &PutFilingsNotFound{} } -/*PutFilingsNotFound handles this case with default header values. +/* PutFilingsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutFilingsNotFound struct { func (o *PutFilingsNotFound) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsNotFound %+v", 404, o.Payload) } - func (o *PutFilingsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutFilingsUnprocessableEntity() *PutFilingsUnprocessableEntity { return &PutFilingsUnprocessableEntity{} } -/*PutFilingsUnprocessableEntity handles this case with default header values. +/* PutFilingsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutFilingsUnprocessableEntity struct { func (o *PutFilingsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutFilingsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutFilingsInternalServerError() *PutFilingsInternalServerError { return &PutFilingsInternalServerError{} } -/*PutFilingsInternalServerError handles this case with default header values. +/* PutFilingsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutFilingsInternalServerError struct { func (o *PutFilingsInternalServerError) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsInternalServerError %+v", 500, o.Payload) } - func (o *PutFilingsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/filing_type/filing_type_client.go b/api/regs/regs_client/filing_type/filing_type_client.go index 14d2d98..f28d5a1 100644 --- a/api/regs/regs_client/filing_type/filing_type_client.go +++ b/api/regs/regs_client/filing_type/filing_type_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingTypesOK, error) + GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingTypesOK, error) - PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingTypesOK, error) + PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingTypesOK, error) - PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingTypesOK, error) + PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingTypesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Regulatory FilingTypes */ -func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingTypesOK, error) { +func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetFilingTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getFilingTypes", Method: "GET", PathPattern: "/filingtypes", @@ -63,7 +65,12 @@ func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.C 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 } @@ -82,13 +89,12 @@ func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.C Create new FilingTypes */ -func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingTypesOK, error) { +func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostFilingTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postFilingTypes", Method: "POST", PathPattern: "/filingtypes", @@ -100,7 +106,12 @@ func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime 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 } @@ -119,13 +130,12 @@ func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime Update all the fields in a FilingType record identified by Taxnexus ID */ -func (a *Client) PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingTypesOK, error) { +func (a *Client) PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutFilingTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putFilingTypes", Method: "PUT", PathPattern: "/filingtypes", @@ -137,7 +147,12 @@ func (a *Client) PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.C 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 } diff --git a/api/regs/regs_client/filing_type/get_filing_types_parameters.go b/api/regs/regs_client/filing_type/get_filing_types_parameters.go index 8970b67..0990864 100644 --- a/api/regs/regs_client/filing_type/get_filing_types_parameters.go +++ b/api/regs/regs_client/filing_type/get_filing_types_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetFilingTypesParams creates a new GetFilingTypesParams object -// with the default values initialized. +// NewGetFilingTypesParams creates a new GetFilingTypesParams 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 NewGetFilingTypesParams() *GetFilingTypesParams { - var () return &GetFilingTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetFilingTypesParamsWithTimeout creates a new GetFilingTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetFilingTypesParamsWithTimeout(timeout time.Duration) *GetFilingTypesParams { - var () return &GetFilingTypesParams{ - timeout: timeout, } } // NewGetFilingTypesParamsWithContext creates a new GetFilingTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetFilingTypesParamsWithContext(ctx context.Context) *GetFilingTypesParams { - var () return &GetFilingTypesParams{ - Context: ctx, } } // NewGetFilingTypesParamsWithHTTPClient creates a new GetFilingTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetFilingTypesParamsWithHTTPClient(client *http.Client) *GetFilingTypesParams { - var () return &GetFilingTypesParams{ HTTPClient: client, } } -/*GetFilingTypesParams contains all the parameters to send to the API endpoint -for the get filing types operation typically these are written to a http.Request +/* GetFilingTypesParams contains all the parameters to send to the API endpoint + for the get filing types operation. + + Typically these are written to a http.Request. */ type GetFilingTypesParams struct { - /*FilingTypeID - Taxnexus Record Id of a Filing + /* FilingTypeID. + Taxnexus Record Id of a Filing */ FilingTypeID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetFilingTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingTypesParams) WithDefaults() *GetFilingTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get filing types params func (o *GetFilingTypesParams) WithTimeout(timeout time.Duration) *GetFilingTypesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetFilingTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param filingTypeId var qrFilingTypeID string + if o.FilingTypeID != nil { qrFilingTypeID = *o.FilingTypeID } qFilingTypeID := qrFilingTypeID if qFilingTypeID != "" { + if err := r.SetQueryParam("filingTypeId", qFilingTypeID); 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 { diff --git a/api/regs/regs_client/filing_type/get_filing_types_responses.go b/api/regs/regs_client/filing_type/get_filing_types_responses.go index 0397b43..53c4811 100644 --- a/api/regs/regs_client/filing_type/get_filing_types_responses.go +++ b/api/regs/regs_client/filing_type/get_filing_types_responses.go @@ -63,9 +63,8 @@ func (o *GetFilingTypesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetFilingTypesOK() *GetFilingTypesOK { return &GetFilingTypesOK{} } -/*GetFilingTypesOK handles this case with default header values. +/* GetFilingTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of FilingType objects */ type GetFilingTypesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.FilingTypeResponse } @@ -89,18 +87,25 @@ type GetFilingTypesOK struct { func (o *GetFilingTypesOK) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesOK %+v", 200, o.Payload) } - func (o *GetFilingTypesOK) GetPayload() *regs_models.FilingTypeResponse { return o.Payload } func (o *GetFilingTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.FilingTypeResponse) @@ -117,7 +122,7 @@ func NewGetFilingTypesUnauthorized() *GetFilingTypesUnauthorized { return &GetFilingTypesUnauthorized{} } -/*GetFilingTypesUnauthorized handles this case with default header values. +/* GetFilingTypesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetFilingTypesUnauthorized struct { func (o *GetFilingTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetFilingTypesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingTypesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetFilingTypesForbidden() *GetFilingTypesForbidden { return &GetFilingTypesForbidden{} } -/*GetFilingTypesForbidden handles this case with default header values. +/* GetFilingTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetFilingTypesForbidden struct { func (o *GetFilingTypesForbidden) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesForbidden %+v", 403, o.Payload) } - func (o *GetFilingTypesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingTypesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetFilingTypesNotFound() *GetFilingTypesNotFound { return &GetFilingTypesNotFound{} } -/*GetFilingTypesNotFound handles this case with default header values. +/* GetFilingTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetFilingTypesNotFound struct { func (o *GetFilingTypesNotFound) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesNotFound %+v", 404, o.Payload) } - func (o *GetFilingTypesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingTypesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetFilingTypesUnprocessableEntity() *GetFilingTypesUnprocessableEntity { return &GetFilingTypesUnprocessableEntity{} } -/*GetFilingTypesUnprocessableEntity handles this case with default header values. +/* GetFilingTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetFilingTypesUnprocessableEntity struct { func (o *GetFilingTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetFilingTypesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingTypesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetFilingTypesInternalServerError() *GetFilingTypesInternalServerError { return &GetFilingTypesInternalServerError{} } -/*GetFilingTypesInternalServerError handles this case with default header values. +/* GetFilingTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetFilingTypesInternalServerError struct { func (o *GetFilingTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetFilingTypesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetFilingTypesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/filing_type/post_filing_types_parameters.go b/api/regs/regs_client/filing_type/post_filing_types_parameters.go index d614b1d..92a4a06 100644 --- a/api/regs/regs_client/filing_type/post_filing_types_parameters.go +++ b/api/regs/regs_client/filing_type/post_filing_types_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostFilingTypesParams creates a new PostFilingTypesParams object -// with the default values initialized. +// NewPostFilingTypesParams creates a new PostFilingTypesParams 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 NewPostFilingTypesParams() *PostFilingTypesParams { - var () return &PostFilingTypesParams{ - timeout: cr.DefaultTimeout, } } // NewPostFilingTypesParamsWithTimeout creates a new PostFilingTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostFilingTypesParamsWithTimeout(timeout time.Duration) *PostFilingTypesParams { - var () return &PostFilingTypesParams{ - timeout: timeout, } } // NewPostFilingTypesParamsWithContext creates a new PostFilingTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostFilingTypesParamsWithContext(ctx context.Context) *PostFilingTypesParams { - var () return &PostFilingTypesParams{ - Context: ctx, } } // NewPostFilingTypesParamsWithHTTPClient creates a new PostFilingTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostFilingTypesParamsWithHTTPClient(client *http.Client) *PostFilingTypesParams { - var () return &PostFilingTypesParams{ HTTPClient: client, } } -/*PostFilingTypesParams contains all the parameters to send to the API endpoint -for the post filing types operation typically these are written to a http.Request +/* PostFilingTypesParams contains all the parameters to send to the API endpoint + for the post filing types operation. + + Typically these are written to a http.Request. */ type PostFilingTypesParams struct { - /*FilingTypeRequest - A request with an array of FilingType Objects + /* FilingTypeRequest. + A request with an array of FilingType Objects */ FilingTypeRequest *regs_models.FilingTypeRequest @@ -77,6 +76,21 @@ type PostFilingTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingTypesParams) WithDefaults() *PostFilingTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post filing types params func (o *PostFilingTypesParams) WithTimeout(timeout time.Duration) *PostFilingTypesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostFilingTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.FilingTypeRequest != nil { if err := r.SetBodyParam(o.FilingTypeRequest); err != nil { return err diff --git a/api/regs/regs_client/filing_type/post_filing_types_responses.go b/api/regs/regs_client/filing_type/post_filing_types_responses.go index 462eab8..83d84a1 100644 --- a/api/regs/regs_client/filing_type/post_filing_types_responses.go +++ b/api/regs/regs_client/filing_type/post_filing_types_responses.go @@ -63,9 +63,8 @@ func (o *PostFilingTypesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostFilingTypesOK() *PostFilingTypesOK { return &PostFilingTypesOK{} } -/*PostFilingTypesOK handles this case with default header values. +/* PostFilingTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of FilingType objects */ type PostFilingTypesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.FilingTypeResponse } @@ -89,18 +87,25 @@ type PostFilingTypesOK struct { func (o *PostFilingTypesOK) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesOK %+v", 200, o.Payload) } - func (o *PostFilingTypesOK) GetPayload() *regs_models.FilingTypeResponse { return o.Payload } func (o *PostFilingTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.FilingTypeResponse) @@ -117,7 +122,7 @@ func NewPostFilingTypesUnauthorized() *PostFilingTypesUnauthorized { return &PostFilingTypesUnauthorized{} } -/*PostFilingTypesUnauthorized handles this case with default header values. +/* PostFilingTypesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostFilingTypesUnauthorized struct { func (o *PostFilingTypesUnauthorized) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesUnauthorized %+v", 401, o.Payload) } - func (o *PostFilingTypesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingTypesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostFilingTypesForbidden() *PostFilingTypesForbidden { return &PostFilingTypesForbidden{} } -/*PostFilingTypesForbidden handles this case with default header values. +/* PostFilingTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostFilingTypesForbidden struct { func (o *PostFilingTypesForbidden) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesForbidden %+v", 403, o.Payload) } - func (o *PostFilingTypesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingTypesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostFilingTypesNotFound() *PostFilingTypesNotFound { return &PostFilingTypesNotFound{} } -/*PostFilingTypesNotFound handles this case with default header values. +/* PostFilingTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostFilingTypesNotFound struct { func (o *PostFilingTypesNotFound) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesNotFound %+v", 404, o.Payload) } - func (o *PostFilingTypesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingTypesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostFilingTypesUnprocessableEntity() *PostFilingTypesUnprocessableEntity return &PostFilingTypesUnprocessableEntity{} } -/*PostFilingTypesUnprocessableEntity handles this case with default header values. +/* PostFilingTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostFilingTypesUnprocessableEntity struct { func (o *PostFilingTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostFilingTypesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingTypesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostFilingTypesInternalServerError() *PostFilingTypesInternalServerError return &PostFilingTypesInternalServerError{} } -/*PostFilingTypesInternalServerError handles this case with default header values. +/* PostFilingTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostFilingTypesInternalServerError struct { func (o *PostFilingTypesInternalServerError) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesInternalServerError %+v", 500, o.Payload) } - func (o *PostFilingTypesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostFilingTypesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/filing_type/put_filing_types_parameters.go b/api/regs/regs_client/filing_type/put_filing_types_parameters.go index d7a52f9..594f445 100644 --- a/api/regs/regs_client/filing_type/put_filing_types_parameters.go +++ b/api/regs/regs_client/filing_type/put_filing_types_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutFilingTypesParams creates a new PutFilingTypesParams object -// with the default values initialized. +// NewPutFilingTypesParams creates a new PutFilingTypesParams 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 NewPutFilingTypesParams() *PutFilingTypesParams { - var () return &PutFilingTypesParams{ - timeout: cr.DefaultTimeout, } } // NewPutFilingTypesParamsWithTimeout creates a new PutFilingTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutFilingTypesParamsWithTimeout(timeout time.Duration) *PutFilingTypesParams { - var () return &PutFilingTypesParams{ - timeout: timeout, } } // NewPutFilingTypesParamsWithContext creates a new PutFilingTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutFilingTypesParamsWithContext(ctx context.Context) *PutFilingTypesParams { - var () return &PutFilingTypesParams{ - Context: ctx, } } // NewPutFilingTypesParamsWithHTTPClient creates a new PutFilingTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutFilingTypesParamsWithHTTPClient(client *http.Client) *PutFilingTypesParams { - var () return &PutFilingTypesParams{ HTTPClient: client, } } -/*PutFilingTypesParams contains all the parameters to send to the API endpoint -for the put filing types operation typically these are written to a http.Request +/* PutFilingTypesParams contains all the parameters to send to the API endpoint + for the put filing types operation. + + Typically these are written to a http.Request. */ type PutFilingTypesParams struct { - /*FilingTypeRequest - A request with an array of FilingType Objects + /* FilingTypeRequest. + A request with an array of FilingType Objects */ FilingTypeRequest *regs_models.FilingTypeRequest @@ -77,6 +76,21 @@ type PutFilingTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingTypesParams) WithDefaults() *PutFilingTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put filing types params func (o *PutFilingTypesParams) WithTimeout(timeout time.Duration) *PutFilingTypesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutFilingTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.FilingTypeRequest != nil { if err := r.SetBodyParam(o.FilingTypeRequest); err != nil { return err diff --git a/api/regs/regs_client/filing_type/put_filing_types_responses.go b/api/regs/regs_client/filing_type/put_filing_types_responses.go index a5037c4..f615f7a 100644 --- a/api/regs/regs_client/filing_type/put_filing_types_responses.go +++ b/api/regs/regs_client/filing_type/put_filing_types_responses.go @@ -57,9 +57,8 @@ func (o *PutFilingTypesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,14 +67,13 @@ func NewPutFilingTypesOK() *PutFilingTypesOK { return &PutFilingTypesOK{} } -/*PutFilingTypesOK handles this case with default header values. +/* PutFilingTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of FilingType objects */ type PutFilingTypesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.FilingTypeResponse } @@ -83,18 +81,25 @@ type PutFilingTypesOK struct { func (o *PutFilingTypesOK) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesOK %+v", 200, o.Payload) } - func (o *PutFilingTypesOK) GetPayload() *regs_models.FilingTypeResponse { return o.Payload } func (o *PutFilingTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.FilingTypeResponse) @@ -111,7 +116,7 @@ func NewPutFilingTypesUnauthorized() *PutFilingTypesUnauthorized { return &PutFilingTypesUnauthorized{} } -/*PutFilingTypesUnauthorized handles this case with default header values. +/* PutFilingTypesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -124,15 +129,18 @@ type PutFilingTypesUnauthorized struct { func (o *PutFilingTypesUnauthorized) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesUnauthorized %+v", 401, o.Payload) } - func (o *PutFilingTypesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingTypesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -149,7 +157,7 @@ func NewPutFilingTypesForbidden() *PutFilingTypesForbidden { return &PutFilingTypesForbidden{} } -/*PutFilingTypesForbidden handles this case with default header values. +/* PutFilingTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -162,15 +170,18 @@ type PutFilingTypesForbidden struct { func (o *PutFilingTypesForbidden) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesForbidden %+v", 403, o.Payload) } - func (o *PutFilingTypesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingTypesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -187,7 +198,7 @@ func NewPutFilingTypesNotFound() *PutFilingTypesNotFound { return &PutFilingTypesNotFound{} } -/*PutFilingTypesNotFound handles this case with default header values. +/* PutFilingTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -200,15 +211,18 @@ type PutFilingTypesNotFound struct { func (o *PutFilingTypesNotFound) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesNotFound %+v", 404, o.Payload) } - func (o *PutFilingTypesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingTypesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -225,7 +239,7 @@ func NewPutFilingTypesInternalServerError() *PutFilingTypesInternalServerError { return &PutFilingTypesInternalServerError{} } -/*PutFilingTypesInternalServerError handles this case with default header values. +/* PutFilingTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -238,15 +252,18 @@ type PutFilingTypesInternalServerError struct { func (o *PutFilingTypesInternalServerError) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesInternalServerError %+v", 500, o.Payload) } - func (o *PutFilingTypesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutFilingTypesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/license/get_licenses_parameters.go b/api/regs/regs_client/license/get_licenses_parameters.go index 5f12c5d..8156b5d 100644 --- a/api/regs/regs_client/license/get_licenses_parameters.go +++ b/api/regs/regs_client/license/get_licenses_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetLicensesParams creates a new GetLicensesParams object -// with the default values initialized. +// NewGetLicensesParams creates a new GetLicensesParams 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 NewGetLicensesParams() *GetLicensesParams { - var () return &GetLicensesParams{ - timeout: cr.DefaultTimeout, } } // NewGetLicensesParamsWithTimeout creates a new GetLicensesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLicensesParamsWithTimeout(timeout time.Duration) *GetLicensesParams { - var () return &GetLicensesParams{ - timeout: timeout, } } // NewGetLicensesParamsWithContext creates a new GetLicensesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLicensesParamsWithContext(ctx context.Context) *GetLicensesParams { - var () return &GetLicensesParams{ - Context: ctx, } } // NewGetLicensesParamsWithHTTPClient creates a new GetLicensesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLicensesParamsWithHTTPClient(client *http.Client) *GetLicensesParams { - var () return &GetLicensesParams{ HTTPClient: client, } } -/*GetLicensesParams contains all the parameters to send to the API endpoint -for the get licenses operation typically these are written to a http.Request +/* GetLicensesParams contains all the parameters to send to the API endpoint + for the get licenses operation. + + Typically these are written to a http.Request. */ type GetLicensesParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + + Taxnexus Record Id of a Company */ CompanyID *string - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + + Taxnexus Id of the record to be retrieved */ ID *string - /*LicenseID - Taxnexus Record Id of a License + /* LicenseID. + + Taxnexus Record Id of a License */ LicenseID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetLicensesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicensesParams) WithDefaults() *GetLicensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicensesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get licenses params func (o *GetLicensesParams) WithTimeout(timeout time.Duration) *GetLicensesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetLicensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // 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.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if o.LicenseID != nil { // query param licenseId var qrLicenseID string + if o.LicenseID != nil { qrLicenseID = *o.LicenseID } qLicenseID := qrLicenseID if qLicenseID != "" { + if err := r.SetQueryParam("licenseId", qLicenseID); 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 { diff --git a/api/regs/regs_client/license/get_licenses_responses.go b/api/regs/regs_client/license/get_licenses_responses.go index d749a78..a0cfeaa 100644 --- a/api/regs/regs_client/license/get_licenses_responses.go +++ b/api/regs/regs_client/license/get_licenses_responses.go @@ -63,9 +63,8 @@ func (o *GetLicensesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetLicensesOK() *GetLicensesOK { return &GetLicensesOK{} } -/*GetLicensesOK handles this case with default header values. +/* GetLicensesOK describes a response with status code 200, with default header values. Taxnexus Response with License objects */ type GetLicensesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.LicenseResponse } @@ -89,18 +87,25 @@ type GetLicensesOK struct { func (o *GetLicensesOK) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesOK %+v", 200, o.Payload) } - func (o *GetLicensesOK) GetPayload() *regs_models.LicenseResponse { return o.Payload } func (o *GetLicensesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.LicenseResponse) @@ -117,7 +122,7 @@ func NewGetLicensesUnauthorized() *GetLicensesUnauthorized { return &GetLicensesUnauthorized{} } -/*GetLicensesUnauthorized handles this case with default header values. +/* GetLicensesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetLicensesUnauthorized struct { func (o *GetLicensesUnauthorized) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesUnauthorized %+v", 401, o.Payload) } - func (o *GetLicensesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicensesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetLicensesForbidden() *GetLicensesForbidden { return &GetLicensesForbidden{} } -/*GetLicensesForbidden handles this case with default header values. +/* GetLicensesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetLicensesForbidden struct { func (o *GetLicensesForbidden) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesForbidden %+v", 403, o.Payload) } - func (o *GetLicensesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicensesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetLicensesNotFound() *GetLicensesNotFound { return &GetLicensesNotFound{} } -/*GetLicensesNotFound handles this case with default header values. +/* GetLicensesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetLicensesNotFound struct { func (o *GetLicensesNotFound) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesNotFound %+v", 404, o.Payload) } - func (o *GetLicensesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicensesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetLicensesUnprocessableEntity() *GetLicensesUnprocessableEntity { return &GetLicensesUnprocessableEntity{} } -/*GetLicensesUnprocessableEntity handles this case with default header values. +/* GetLicensesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetLicensesUnprocessableEntity struct { func (o *GetLicensesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetLicensesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicensesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetLicensesInternalServerError() *GetLicensesInternalServerError { return &GetLicensesInternalServerError{} } -/*GetLicensesInternalServerError handles this case with default header values. +/* GetLicensesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetLicensesInternalServerError struct { func (o *GetLicensesInternalServerError) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesInternalServerError %+v", 500, o.Payload) } - func (o *GetLicensesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicensesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/license/license_client.go b/api/regs/regs_client/license/license_client.go index 85e0aa0..37ce67f 100644 --- a/api/regs/regs_client/license/license_client.go +++ b/api/regs/regs_client/license/license_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicensesOK, error) + GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicensesOK, error) - PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLicensesOK, error) + PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLicensesOK, error) - PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PutLicensesOK, error) + PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLicensesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Retrieve all licenses, filter with parameters */ -func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicensesOK, error) { +func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicensesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLicensesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLicenses", Method: "GET", PathPattern: "/licenses", @@ -63,7 +65,12 @@ func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientA Create new Licenses */ -func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLicensesOK, error) { +func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLicensesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostLicensesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postLicenses", Method: "POST", PathPattern: "/licenses", @@ -100,7 +106,12 @@ func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.Clien 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 } @@ -119,13 +130,12 @@ func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.Clien Add or update licenses */ -func (a *Client) PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PutLicensesOK, error) { +func (a *Client) PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLicensesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutLicensesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putLicenses", Method: "PUT", PathPattern: "/licenses", @@ -137,7 +147,12 @@ func (a *Client) PutLicenses(params *PutLicensesParams, authInfo runtime.ClientA 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 } diff --git a/api/regs/regs_client/license/post_licenses_parameters.go b/api/regs/regs_client/license/post_licenses_parameters.go index 98e5969..6f7216c 100644 --- a/api/regs/regs_client/license/post_licenses_parameters.go +++ b/api/regs/regs_client/license/post_licenses_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostLicensesParams creates a new PostLicensesParams object -// with the default values initialized. +// NewPostLicensesParams creates a new PostLicensesParams 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 NewPostLicensesParams() *PostLicensesParams { - var () return &PostLicensesParams{ - timeout: cr.DefaultTimeout, } } // NewPostLicensesParamsWithTimeout creates a new PostLicensesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostLicensesParamsWithTimeout(timeout time.Duration) *PostLicensesParams { - var () return &PostLicensesParams{ - timeout: timeout, } } // NewPostLicensesParamsWithContext creates a new PostLicensesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostLicensesParamsWithContext(ctx context.Context) *PostLicensesParams { - var () return &PostLicensesParams{ - Context: ctx, } } // NewPostLicensesParamsWithHTTPClient creates a new PostLicensesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostLicensesParamsWithHTTPClient(client *http.Client) *PostLicensesParams { - var () return &PostLicensesParams{ HTTPClient: client, } } -/*PostLicensesParams contains all the parameters to send to the API endpoint -for the post licenses operation typically these are written to a http.Request +/* PostLicensesParams contains all the parameters to send to the API endpoint + for the post licenses operation. + + Typically these are written to a http.Request. */ type PostLicensesParams struct { - /*LicenseRequest - The new licenses + /* LicenseRequest. + The new licenses */ LicenseRequest *regs_models.LicenseRequest @@ -77,6 +76,21 @@ type PostLicensesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLicensesParams) WithDefaults() *PostLicensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLicensesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post licenses params func (o *PostLicensesParams) WithTimeout(timeout time.Duration) *PostLicensesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostLicensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.LicenseRequest != nil { if err := r.SetBodyParam(o.LicenseRequest); err != nil { return err diff --git a/api/regs/regs_client/license/post_licenses_responses.go b/api/regs/regs_client/license/post_licenses_responses.go index 0773bbf..c2ddca0 100644 --- a/api/regs/regs_client/license/post_licenses_responses.go +++ b/api/regs/regs_client/license/post_licenses_responses.go @@ -63,9 +63,8 @@ func (o *PostLicensesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostLicensesOK() *PostLicensesOK { return &PostLicensesOK{} } -/*PostLicensesOK handles this case with default header values. +/* PostLicensesOK describes a response with status code 200, with default header values. Taxnexus Response with License objects */ type PostLicensesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.LicenseResponse } @@ -89,18 +87,25 @@ type PostLicensesOK struct { func (o *PostLicensesOK) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesOK %+v", 200, o.Payload) } - func (o *PostLicensesOK) GetPayload() *regs_models.LicenseResponse { return o.Payload } func (o *PostLicensesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.LicenseResponse) @@ -117,7 +122,7 @@ func NewPostLicensesUnauthorized() *PostLicensesUnauthorized { return &PostLicensesUnauthorized{} } -/*PostLicensesUnauthorized handles this case with default header values. +/* PostLicensesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostLicensesUnauthorized struct { func (o *PostLicensesUnauthorized) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesUnauthorized %+v", 401, o.Payload) } - func (o *PostLicensesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicensesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostLicensesForbidden() *PostLicensesForbidden { return &PostLicensesForbidden{} } -/*PostLicensesForbidden handles this case with default header values. +/* PostLicensesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostLicensesForbidden struct { func (o *PostLicensesForbidden) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesForbidden %+v", 403, o.Payload) } - func (o *PostLicensesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicensesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostLicensesNotFound() *PostLicensesNotFound { return &PostLicensesNotFound{} } -/*PostLicensesNotFound handles this case with default header values. +/* PostLicensesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostLicensesNotFound struct { func (o *PostLicensesNotFound) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesNotFound %+v", 404, o.Payload) } - func (o *PostLicensesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicensesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostLicensesUnprocessableEntity() *PostLicensesUnprocessableEntity { return &PostLicensesUnprocessableEntity{} } -/*PostLicensesUnprocessableEntity handles this case with default header values. +/* PostLicensesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostLicensesUnprocessableEntity struct { func (o *PostLicensesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostLicensesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicensesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostLicensesInternalServerError() *PostLicensesInternalServerError { return &PostLicensesInternalServerError{} } -/*PostLicensesInternalServerError handles this case with default header values. +/* PostLicensesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostLicensesInternalServerError struct { func (o *PostLicensesInternalServerError) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesInternalServerError %+v", 500, o.Payload) } - func (o *PostLicensesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicensesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/license/put_licenses_parameters.go b/api/regs/regs_client/license/put_licenses_parameters.go index dbb984c..cac5e5d 100644 --- a/api/regs/regs_client/license/put_licenses_parameters.go +++ b/api/regs/regs_client/license/put_licenses_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutLicensesParams creates a new PutLicensesParams object -// with the default values initialized. +// NewPutLicensesParams creates a new PutLicensesParams 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 NewPutLicensesParams() *PutLicensesParams { - var () return &PutLicensesParams{ - timeout: cr.DefaultTimeout, } } // NewPutLicensesParamsWithTimeout creates a new PutLicensesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutLicensesParamsWithTimeout(timeout time.Duration) *PutLicensesParams { - var () return &PutLicensesParams{ - timeout: timeout, } } // NewPutLicensesParamsWithContext creates a new PutLicensesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutLicensesParamsWithContext(ctx context.Context) *PutLicensesParams { - var () return &PutLicensesParams{ - Context: ctx, } } // NewPutLicensesParamsWithHTTPClient creates a new PutLicensesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutLicensesParamsWithHTTPClient(client *http.Client) *PutLicensesParams { - var () return &PutLicensesParams{ HTTPClient: client, } } -/*PutLicensesParams contains all the parameters to send to the API endpoint -for the put licenses operation typically these are written to a http.Request +/* PutLicensesParams contains all the parameters to send to the API endpoint + for the put licenses operation. + + Typically these are written to a http.Request. */ type PutLicensesParams struct { - /*LicenseRequest - The updated licenses + /* LicenseRequest. + The updated licenses */ LicenseRequest *regs_models.LicenseRequest @@ -77,6 +76,21 @@ type PutLicensesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutLicensesParams) WithDefaults() *PutLicensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutLicensesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put licenses params func (o *PutLicensesParams) WithTimeout(timeout time.Duration) *PutLicensesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutLicensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.LicenseRequest != nil { if err := r.SetBodyParam(o.LicenseRequest); err != nil { return err diff --git a/api/regs/regs_client/license/put_licenses_responses.go b/api/regs/regs_client/license/put_licenses_responses.go index d267c50..adb59ea 100644 --- a/api/regs/regs_client/license/put_licenses_responses.go +++ b/api/regs/regs_client/license/put_licenses_responses.go @@ -63,9 +63,8 @@ func (o *PutLicensesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutLicensesOK() *PutLicensesOK { return &PutLicensesOK{} } -/*PutLicensesOK handles this case with default header values. +/* PutLicensesOK describes a response with status code 200, with default header values. Taxnexus Response with License objects */ type PutLicensesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.LicenseResponse } @@ -89,18 +87,25 @@ type PutLicensesOK struct { func (o *PutLicensesOK) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesOK %+v", 200, o.Payload) } - func (o *PutLicensesOK) GetPayload() *regs_models.LicenseResponse { return o.Payload } func (o *PutLicensesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.LicenseResponse) @@ -117,7 +122,7 @@ func NewPutLicensesUnauthorized() *PutLicensesUnauthorized { return &PutLicensesUnauthorized{} } -/*PutLicensesUnauthorized handles this case with default header values. +/* PutLicensesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutLicensesUnauthorized struct { func (o *PutLicensesUnauthorized) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesUnauthorized %+v", 401, o.Payload) } - func (o *PutLicensesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutLicensesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutLicensesForbidden() *PutLicensesForbidden { return &PutLicensesForbidden{} } -/*PutLicensesForbidden handles this case with default header values. +/* PutLicensesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutLicensesForbidden struct { func (o *PutLicensesForbidden) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesForbidden %+v", 403, o.Payload) } - func (o *PutLicensesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutLicensesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutLicensesNotFound() *PutLicensesNotFound { return &PutLicensesNotFound{} } -/*PutLicensesNotFound handles this case with default header values. +/* PutLicensesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutLicensesNotFound struct { func (o *PutLicensesNotFound) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesNotFound %+v", 404, o.Payload) } - func (o *PutLicensesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutLicensesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutLicensesUnprocessableEntity() *PutLicensesUnprocessableEntity { return &PutLicensesUnprocessableEntity{} } -/*PutLicensesUnprocessableEntity handles this case with default header values. +/* PutLicensesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutLicensesUnprocessableEntity struct { func (o *PutLicensesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutLicensesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutLicensesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutLicensesInternalServerError() *PutLicensesInternalServerError { return &PutLicensesInternalServerError{} } -/*PutLicensesInternalServerError handles this case with default header values. +/* PutLicensesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutLicensesInternalServerError struct { func (o *PutLicensesInternalServerError) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesInternalServerError %+v", 500, o.Payload) } - func (o *PutLicensesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutLicensesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/license_type/get_license_types_parameters.go b/api/regs/regs_client/license_type/get_license_types_parameters.go index e4b5dab..39215d1 100644 --- a/api/regs/regs_client/license_type/get_license_types_parameters.go +++ b/api/regs/regs_client/license_type/get_license_types_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetLicenseTypesParams creates a new GetLicenseTypesParams object -// with the default values initialized. +// NewGetLicenseTypesParams creates a new GetLicenseTypesParams 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 NewGetLicenseTypesParams() *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetLicenseTypesParamsWithTimeout creates a new GetLicenseTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLicenseTypesParamsWithTimeout(timeout time.Duration) *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ - timeout: timeout, } } // NewGetLicenseTypesParamsWithContext creates a new GetLicenseTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLicenseTypesParamsWithContext(ctx context.Context) *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ - Context: ctx, } } // NewGetLicenseTypesParamsWithHTTPClient creates a new GetLicenseTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLicenseTypesParamsWithHTTPClient(client *http.Client) *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ HTTPClient: client, } } -/*GetLicenseTypesParams contains all the parameters to send to the API endpoint -for the get license types operation typically these are written to a http.Request +/* GetLicenseTypesParams contains all the parameters to send to the API endpoint + for the get license types operation. + + Typically these are written to a http.Request. */ type GetLicenseTypesParams struct { - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + Taxnexus Record Id of a Company */ CompanyID *string - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + + Taxnexus Id of the record to be retrieved */ ID *string - /*LicensetypeID - Taxnexus Record Id of a License Type + /* LicensetypeID. + + Taxnexus Record Id of a License Type */ LicensetypeID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -96,6 +103,21 @@ type GetLicenseTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get license types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicenseTypesParams) WithDefaults() *GetLicenseTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get license types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicenseTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get license types params func (o *GetLicenseTypesParams) WithTimeout(timeout time.Duration) *GetLicenseTypesParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetLicenseTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if o.LicensetypeID != nil { // query param licensetypeId var qrLicensetypeID string + if o.LicensetypeID != nil { qrLicensetypeID = *o.LicensetypeID } qLicensetypeID := qrLicensetypeID if qLicensetypeID != "" { + if err := r.SetQueryParam("licensetypeId", qLicensetypeID); 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 { diff --git a/api/regs/regs_client/license_type/get_license_types_responses.go b/api/regs/regs_client/license_type/get_license_types_responses.go index e441b84..738dc77 100644 --- a/api/regs/regs_client/license_type/get_license_types_responses.go +++ b/api/regs/regs_client/license_type/get_license_types_responses.go @@ -63,9 +63,8 @@ func (o *GetLicenseTypesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetLicenseTypesOK() *GetLicenseTypesOK { return &GetLicenseTypesOK{} } -/*GetLicenseTypesOK handles this case with default header values. +/* GetLicenseTypesOK describes a response with status code 200, with default header values. Taxnexus Response with License objects */ type GetLicenseTypesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.LicenseTypeResponse } @@ -89,18 +87,25 @@ type GetLicenseTypesOK struct { func (o *GetLicenseTypesOK) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesOK %+v", 200, o.Payload) } - func (o *GetLicenseTypesOK) GetPayload() *regs_models.LicenseTypeResponse { return o.Payload } func (o *GetLicenseTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.LicenseTypeResponse) @@ -117,7 +122,7 @@ func NewGetLicenseTypesUnauthorized() *GetLicenseTypesUnauthorized { return &GetLicenseTypesUnauthorized{} } -/*GetLicenseTypesUnauthorized handles this case with default header values. +/* GetLicenseTypesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetLicenseTypesUnauthorized struct { func (o *GetLicenseTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetLicenseTypesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicenseTypesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetLicenseTypesForbidden() *GetLicenseTypesForbidden { return &GetLicenseTypesForbidden{} } -/*GetLicenseTypesForbidden handles this case with default header values. +/* GetLicenseTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetLicenseTypesForbidden struct { func (o *GetLicenseTypesForbidden) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesForbidden %+v", 403, o.Payload) } - func (o *GetLicenseTypesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicenseTypesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetLicenseTypesNotFound() *GetLicenseTypesNotFound { return &GetLicenseTypesNotFound{} } -/*GetLicenseTypesNotFound handles this case with default header values. +/* GetLicenseTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetLicenseTypesNotFound struct { func (o *GetLicenseTypesNotFound) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesNotFound %+v", 404, o.Payload) } - func (o *GetLicenseTypesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicenseTypesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetLicenseTypesUnprocessableEntity() *GetLicenseTypesUnprocessableEntity return &GetLicenseTypesUnprocessableEntity{} } -/*GetLicenseTypesUnprocessableEntity handles this case with default header values. +/* GetLicenseTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetLicenseTypesUnprocessableEntity struct { func (o *GetLicenseTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetLicenseTypesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicenseTypesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetLicenseTypesInternalServerError() *GetLicenseTypesInternalServerError return &GetLicenseTypesInternalServerError{} } -/*GetLicenseTypesInternalServerError handles this case with default header values. +/* GetLicenseTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetLicenseTypesInternalServerError struct { func (o *GetLicenseTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetLicenseTypesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetLicenseTypesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/license_type/license_type_client.go b/api/regs/regs_client/license_type/license_type_client.go index 0520742..3e40927 100644 --- a/api/regs/regs_client/license_type/license_type_client.go +++ b/api/regs/regs_client/license_type/license_type_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicenseTypesOK, error) + GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicenseTypesOK, error) - PostLicenseTypes(params *PostLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLicenseTypesOK, error) + PostLicenseTypes(params *PostLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLicenseTypesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Retrieve LicenseType records */ -func (a *Client) GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicenseTypesOK, error) { +func (a *Client) GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicenseTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLicenseTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLicenseTypes", Method: "GET", PathPattern: "/licensetypes", @@ -61,7 +63,12 @@ func (a *Client) GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime 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 } @@ -80,13 +87,12 @@ func (a *Client) GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime Create new LicenseType */ -func (a *Client) PostLicenseTypes(params *PostLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLicenseTypesOK, error) { +func (a *Client) PostLicenseTypes(params *PostLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLicenseTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostLicenseTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postLicenseTypes", Method: "POST", PathPattern: "/licensetypes", @@ -98,7 +104,12 @@ func (a *Client) PostLicenseTypes(params *PostLicenseTypesParams, authInfo runti 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 } diff --git a/api/regs/regs_client/license_type/post_license_types_parameters.go b/api/regs/regs_client/license_type/post_license_types_parameters.go index 65b22c5..5fad7f6 100644 --- a/api/regs/regs_client/license_type/post_license_types_parameters.go +++ b/api/regs/regs_client/license_type/post_license_types_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostLicenseTypesParams creates a new PostLicenseTypesParams object -// with the default values initialized. +// NewPostLicenseTypesParams creates a new PostLicenseTypesParams 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 NewPostLicenseTypesParams() *PostLicenseTypesParams { - var () return &PostLicenseTypesParams{ - timeout: cr.DefaultTimeout, } } // NewPostLicenseTypesParamsWithTimeout creates a new PostLicenseTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostLicenseTypesParamsWithTimeout(timeout time.Duration) *PostLicenseTypesParams { - var () return &PostLicenseTypesParams{ - timeout: timeout, } } // NewPostLicenseTypesParamsWithContext creates a new PostLicenseTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostLicenseTypesParamsWithContext(ctx context.Context) *PostLicenseTypesParams { - var () return &PostLicenseTypesParams{ - Context: ctx, } } // NewPostLicenseTypesParamsWithHTTPClient creates a new PostLicenseTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostLicenseTypesParamsWithHTTPClient(client *http.Client) *PostLicenseTypesParams { - var () return &PostLicenseTypesParams{ HTTPClient: client, } } -/*PostLicenseTypesParams contains all the parameters to send to the API endpoint -for the post license types operation typically these are written to a http.Request +/* PostLicenseTypesParams contains all the parameters to send to the API endpoint + for the post license types operation. + + Typically these are written to a http.Request. */ type PostLicenseTypesParams struct { - /*LicenseTypeRequest - The new license types + /* LicenseTypeRequest. + The new license types */ LicenseTypeRequest *regs_models.LicenseTypeRequest @@ -77,6 +76,21 @@ type PostLicenseTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post license types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLicenseTypesParams) WithDefaults() *PostLicenseTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post license types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLicenseTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post license types params func (o *PostLicenseTypesParams) WithTimeout(timeout time.Duration) *PostLicenseTypesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostLicenseTypesParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.LicenseTypeRequest != nil { if err := r.SetBodyParam(o.LicenseTypeRequest); err != nil { return err diff --git a/api/regs/regs_client/license_type/post_license_types_responses.go b/api/regs/regs_client/license_type/post_license_types_responses.go index 4ad32c9..a0f2141 100644 --- a/api/regs/regs_client/license_type/post_license_types_responses.go +++ b/api/regs/regs_client/license_type/post_license_types_responses.go @@ -63,9 +63,8 @@ func (o *PostLicenseTypesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostLicenseTypesOK() *PostLicenseTypesOK { return &PostLicenseTypesOK{} } -/*PostLicenseTypesOK handles this case with default header values. +/* PostLicenseTypesOK describes a response with status code 200, with default header values. Taxnexus Response with License objects */ type PostLicenseTypesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.LicenseTypeResponse } @@ -89,18 +87,25 @@ type PostLicenseTypesOK struct { func (o *PostLicenseTypesOK) Error() string { return fmt.Sprintf("[POST /licensetypes][%d] postLicenseTypesOK %+v", 200, o.Payload) } - func (o *PostLicenseTypesOK) GetPayload() *regs_models.LicenseTypeResponse { return o.Payload } func (o *PostLicenseTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.LicenseTypeResponse) @@ -117,7 +122,7 @@ func NewPostLicenseTypesUnauthorized() *PostLicenseTypesUnauthorized { return &PostLicenseTypesUnauthorized{} } -/*PostLicenseTypesUnauthorized handles this case with default header values. +/* PostLicenseTypesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostLicenseTypesUnauthorized struct { func (o *PostLicenseTypesUnauthorized) Error() string { return fmt.Sprintf("[POST /licensetypes][%d] postLicenseTypesUnauthorized %+v", 401, o.Payload) } - func (o *PostLicenseTypesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicenseTypesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostLicenseTypesForbidden() *PostLicenseTypesForbidden { return &PostLicenseTypesForbidden{} } -/*PostLicenseTypesForbidden handles this case with default header values. +/* PostLicenseTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostLicenseTypesForbidden struct { func (o *PostLicenseTypesForbidden) Error() string { return fmt.Sprintf("[POST /licensetypes][%d] postLicenseTypesForbidden %+v", 403, o.Payload) } - func (o *PostLicenseTypesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicenseTypesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostLicenseTypesNotFound() *PostLicenseTypesNotFound { return &PostLicenseTypesNotFound{} } -/*PostLicenseTypesNotFound handles this case with default header values. +/* PostLicenseTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostLicenseTypesNotFound struct { func (o *PostLicenseTypesNotFound) Error() string { return fmt.Sprintf("[POST /licensetypes][%d] postLicenseTypesNotFound %+v", 404, o.Payload) } - func (o *PostLicenseTypesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicenseTypesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostLicenseTypesUnprocessableEntity() *PostLicenseTypesUnprocessableEnti return &PostLicenseTypesUnprocessableEntity{} } -/*PostLicenseTypesUnprocessableEntity handles this case with default header values. +/* PostLicenseTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostLicenseTypesUnprocessableEntity struct { func (o *PostLicenseTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /licensetypes][%d] postLicenseTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostLicenseTypesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicenseTypesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostLicenseTypesInternalServerError() *PostLicenseTypesInternalServerErr return &PostLicenseTypesInternalServerError{} } -/*PostLicenseTypesInternalServerError handles this case with default header values. +/* PostLicenseTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostLicenseTypesInternalServerError struct { func (o *PostLicenseTypesInternalServerError) Error() string { return fmt.Sprintf("[POST /licensetypes][%d] postLicenseTypesInternalServerError %+v", 500, o.Payload) } - func (o *PostLicenseTypesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostLicenseTypesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/notebook/get_notebooks_parameters.go b/api/regs/regs_client/notebook/get_notebooks_parameters.go index 266b1fa..ef99896 100644 --- a/api/regs/regs_client/notebook/get_notebooks_parameters.go +++ b/api/regs/regs_client/notebook/get_notebooks_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetNotebooksParams creates a new GetNotebooksParams object -// with the default values initialized. +// NewGetNotebooksParams creates a new GetNotebooksParams 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 NewGetNotebooksParams() *GetNotebooksParams { - var () return &GetNotebooksParams{ - timeout: cr.DefaultTimeout, } } // NewGetNotebooksParamsWithTimeout creates a new GetNotebooksParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetNotebooksParamsWithTimeout(timeout time.Duration) *GetNotebooksParams { - var () return &GetNotebooksParams{ - timeout: timeout, } } // NewGetNotebooksParamsWithContext creates a new GetNotebooksParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetNotebooksParamsWithContext(ctx context.Context) *GetNotebooksParams { - var () return &GetNotebooksParams{ - Context: ctx, } } // NewGetNotebooksParamsWithHTTPClient creates a new GetNotebooksParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetNotebooksParamsWithHTTPClient(client *http.Client) *GetNotebooksParams { - var () return &GetNotebooksParams{ HTTPClient: client, } } -/*GetNotebooksParams contains all the parameters to send to the API endpoint -for the get notebooks operation typically these are written to a http.Request +/* GetNotebooksParams contains all the parameters to send to the API endpoint + for the get notebooks operation. + + Typically these are written to a http.Request. */ type GetNotebooksParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*NotebookID - Template ID + /* NotebookID. + + Template ID */ NotebookID *string - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetNotebooksParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetNotebooksParams) WithDefaults() *GetNotebooksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetNotebooksParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get notebooks params func (o *GetNotebooksParams) WithTimeout(timeout time.Duration) *GetNotebooksParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetNotebooksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // 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.NotebookID != nil { // query param notebookId var qrNotebookID string + if o.NotebookID != nil { qrNotebookID = *o.NotebookID } qNotebookID := qrNotebookID if qNotebookID != "" { + if err := r.SetQueryParam("notebookId", qNotebookID); 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 { diff --git a/api/regs/regs_client/notebook/get_notebooks_responses.go b/api/regs/regs_client/notebook/get_notebooks_responses.go index 2bd3c5e..55fb663 100644 --- a/api/regs/regs_client/notebook/get_notebooks_responses.go +++ b/api/regs/regs_client/notebook/get_notebooks_responses.go @@ -63,9 +63,8 @@ func (o *GetNotebooksReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetNotebooksOK() *GetNotebooksOK { return &GetNotebooksOK{} } -/*GetNotebooksOK handles this case with default header values. +/* GetNotebooksOK describes a response with status code 200, with default header values. Taxnexus Response with Notebook objects */ type GetNotebooksOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.NotebookResponse } @@ -89,18 +87,25 @@ type GetNotebooksOK struct { func (o *GetNotebooksOK) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksOK %+v", 200, o.Payload) } - func (o *GetNotebooksOK) GetPayload() *regs_models.NotebookResponse { return o.Payload } func (o *GetNotebooksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.NotebookResponse) @@ -117,7 +122,7 @@ func NewGetNotebooksUnauthorized() *GetNotebooksUnauthorized { return &GetNotebooksUnauthorized{} } -/*GetNotebooksUnauthorized handles this case with default header values. +/* GetNotebooksUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetNotebooksUnauthorized struct { func (o *GetNotebooksUnauthorized) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksUnauthorized %+v", 401, o.Payload) } - func (o *GetNotebooksUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetNotebooksUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetNotebooksForbidden() *GetNotebooksForbidden { return &GetNotebooksForbidden{} } -/*GetNotebooksForbidden handles this case with default header values. +/* GetNotebooksForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetNotebooksForbidden struct { func (o *GetNotebooksForbidden) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksForbidden %+v", 403, o.Payload) } - func (o *GetNotebooksForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetNotebooksForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetNotebooksNotFound() *GetNotebooksNotFound { return &GetNotebooksNotFound{} } -/*GetNotebooksNotFound handles this case with default header values. +/* GetNotebooksNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetNotebooksNotFound struct { func (o *GetNotebooksNotFound) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksNotFound %+v", 404, o.Payload) } - func (o *GetNotebooksNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetNotebooksNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetNotebooksUnprocessableEntity() *GetNotebooksUnprocessableEntity { return &GetNotebooksUnprocessableEntity{} } -/*GetNotebooksUnprocessableEntity handles this case with default header values. +/* GetNotebooksUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetNotebooksUnprocessableEntity struct { func (o *GetNotebooksUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetNotebooksUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetNotebooksUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetNotebooksInternalServerError() *GetNotebooksInternalServerError { return &GetNotebooksInternalServerError{} } -/*GetNotebooksInternalServerError handles this case with default header values. +/* GetNotebooksInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetNotebooksInternalServerError struct { func (o *GetNotebooksInternalServerError) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksInternalServerError %+v", 500, o.Payload) } - func (o *GetNotebooksInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetNotebooksInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/notebook/notebook_client.go b/api/regs/regs_client/notebook/notebook_client.go index 1dcedd7..650dfe3 100644 --- a/api/regs/regs_client/notebook/notebook_client.go +++ b/api/regs/regs_client/notebook/notebook_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*GetNotebooksOK, error) + GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetNotebooksOK, error) - PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PostNotebooksOK, error) + PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostNotebooksOK, error) - PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PutNotebooksOK, error) + PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutNotebooksOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Notebook records from the datastore */ -func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*GetNotebooksOK, error) { +func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetNotebooksOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetNotebooksParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getNotebooks", Method: "GET", PathPattern: "/notebooks", @@ -63,7 +65,12 @@ func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.Clien 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 } @@ -82,13 +89,12 @@ func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.Clien Create Notebooks in Taxnexus */ -func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PostNotebooksOK, error) { +func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostNotebooksOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostNotebooksParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postNotebooks", Method: "POST", PathPattern: "/notebooks", @@ -100,7 +106,12 @@ func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.Cli 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 } @@ -119,13 +130,12 @@ func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.Cli Update Notebooks in Taxnexus */ -func (a *Client) PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PutNotebooksOK, error) { +func (a *Client) PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutNotebooksOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutNotebooksParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putNotebooks", Method: "PUT", PathPattern: "/notebooks", @@ -137,7 +147,12 @@ func (a *Client) PutNotebooks(params *PutNotebooksParams, authInfo runtime.Clien 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 } diff --git a/api/regs/regs_client/notebook/post_notebooks_parameters.go b/api/regs/regs_client/notebook/post_notebooks_parameters.go index c748edb..e3e8f47 100644 --- a/api/regs/regs_client/notebook/post_notebooks_parameters.go +++ b/api/regs/regs_client/notebook/post_notebooks_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostNotebooksParams creates a new PostNotebooksParams object -// with the default values initialized. +// NewPostNotebooksParams creates a new PostNotebooksParams 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 NewPostNotebooksParams() *PostNotebooksParams { - var () return &PostNotebooksParams{ - timeout: cr.DefaultTimeout, } } // NewPostNotebooksParamsWithTimeout creates a new PostNotebooksParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostNotebooksParamsWithTimeout(timeout time.Duration) *PostNotebooksParams { - var () return &PostNotebooksParams{ - timeout: timeout, } } // NewPostNotebooksParamsWithContext creates a new PostNotebooksParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostNotebooksParamsWithContext(ctx context.Context) *PostNotebooksParams { - var () return &PostNotebooksParams{ - Context: ctx, } } // NewPostNotebooksParamsWithHTTPClient creates a new PostNotebooksParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostNotebooksParamsWithHTTPClient(client *http.Client) *PostNotebooksParams { - var () return &PostNotebooksParams{ HTTPClient: client, } } -/*PostNotebooksParams contains all the parameters to send to the API endpoint -for the post notebooks operation typically these are written to a http.Request +/* PostNotebooksParams contains all the parameters to send to the API endpoint + for the post notebooks operation. + + Typically these are written to a http.Request. */ type PostNotebooksParams struct { - /*NotebookRequest - An array of Notebook records + /* NotebookRequest. + An array of Notebook records */ NotebookRequest *regs_models.NotebookRequest @@ -77,6 +76,21 @@ type PostNotebooksParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostNotebooksParams) WithDefaults() *PostNotebooksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostNotebooksParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post notebooks params func (o *PostNotebooksParams) WithTimeout(timeout time.Duration) *PostNotebooksParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostNotebooksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.NotebookRequest != nil { if err := r.SetBodyParam(o.NotebookRequest); err != nil { return err diff --git a/api/regs/regs_client/notebook/post_notebooks_responses.go b/api/regs/regs_client/notebook/post_notebooks_responses.go index a2d691a..aeff179 100644 --- a/api/regs/regs_client/notebook/post_notebooks_responses.go +++ b/api/regs/regs_client/notebook/post_notebooks_responses.go @@ -63,9 +63,8 @@ func (o *PostNotebooksReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostNotebooksOK() *PostNotebooksOK { return &PostNotebooksOK{} } -/*PostNotebooksOK handles this case with default header values. +/* PostNotebooksOK describes a response with status code 200, with default header values. Taxnexus Response with Notebook objects */ type PostNotebooksOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.NotebookResponse } @@ -89,18 +87,25 @@ type PostNotebooksOK struct { func (o *PostNotebooksOK) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksOK %+v", 200, o.Payload) } - func (o *PostNotebooksOK) GetPayload() *regs_models.NotebookResponse { return o.Payload } func (o *PostNotebooksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.NotebookResponse) @@ -117,7 +122,7 @@ func NewPostNotebooksUnauthorized() *PostNotebooksUnauthorized { return &PostNotebooksUnauthorized{} } -/*PostNotebooksUnauthorized handles this case with default header values. +/* PostNotebooksUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostNotebooksUnauthorized struct { func (o *PostNotebooksUnauthorized) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksUnauthorized %+v", 401, o.Payload) } - func (o *PostNotebooksUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostNotebooksUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostNotebooksForbidden() *PostNotebooksForbidden { return &PostNotebooksForbidden{} } -/*PostNotebooksForbidden handles this case with default header values. +/* PostNotebooksForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostNotebooksForbidden struct { func (o *PostNotebooksForbidden) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksForbidden %+v", 403, o.Payload) } - func (o *PostNotebooksForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostNotebooksForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostNotebooksNotFound() *PostNotebooksNotFound { return &PostNotebooksNotFound{} } -/*PostNotebooksNotFound handles this case with default header values. +/* PostNotebooksNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostNotebooksNotFound struct { func (o *PostNotebooksNotFound) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksNotFound %+v", 404, o.Payload) } - func (o *PostNotebooksNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostNotebooksNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostNotebooksUnprocessableEntity() *PostNotebooksUnprocessableEntity { return &PostNotebooksUnprocessableEntity{} } -/*PostNotebooksUnprocessableEntity handles this case with default header values. +/* PostNotebooksUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostNotebooksUnprocessableEntity struct { func (o *PostNotebooksUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostNotebooksUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostNotebooksUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostNotebooksInternalServerError() *PostNotebooksInternalServerError { return &PostNotebooksInternalServerError{} } -/*PostNotebooksInternalServerError handles this case with default header values. +/* PostNotebooksInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostNotebooksInternalServerError struct { func (o *PostNotebooksInternalServerError) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksInternalServerError %+v", 500, o.Payload) } - func (o *PostNotebooksInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostNotebooksInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/notebook/put_notebooks_parameters.go b/api/regs/regs_client/notebook/put_notebooks_parameters.go index c09f46d..2f2fd36 100644 --- a/api/regs/regs_client/notebook/put_notebooks_parameters.go +++ b/api/regs/regs_client/notebook/put_notebooks_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutNotebooksParams creates a new PutNotebooksParams object -// with the default values initialized. +// NewPutNotebooksParams creates a new PutNotebooksParams 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 NewPutNotebooksParams() *PutNotebooksParams { - var () return &PutNotebooksParams{ - timeout: cr.DefaultTimeout, } } // NewPutNotebooksParamsWithTimeout creates a new PutNotebooksParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutNotebooksParamsWithTimeout(timeout time.Duration) *PutNotebooksParams { - var () return &PutNotebooksParams{ - timeout: timeout, } } // NewPutNotebooksParamsWithContext creates a new PutNotebooksParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutNotebooksParamsWithContext(ctx context.Context) *PutNotebooksParams { - var () return &PutNotebooksParams{ - Context: ctx, } } // NewPutNotebooksParamsWithHTTPClient creates a new PutNotebooksParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutNotebooksParamsWithHTTPClient(client *http.Client) *PutNotebooksParams { - var () return &PutNotebooksParams{ HTTPClient: client, } } -/*PutNotebooksParams contains all the parameters to send to the API endpoint -for the put notebooks operation typically these are written to a http.Request +/* PutNotebooksParams contains all the parameters to send to the API endpoint + for the put notebooks operation. + + Typically these are written to a http.Request. */ type PutNotebooksParams struct { - /*NotebookRequest - An array of Notebook records + /* NotebookRequest. + An array of Notebook records */ NotebookRequest *regs_models.NotebookRequest @@ -77,6 +76,21 @@ type PutNotebooksParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutNotebooksParams) WithDefaults() *PutNotebooksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutNotebooksParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put notebooks params func (o *PutNotebooksParams) WithTimeout(timeout time.Duration) *PutNotebooksParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutNotebooksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.NotebookRequest != nil { if err := r.SetBodyParam(o.NotebookRequest); err != nil { return err diff --git a/api/regs/regs_client/notebook/put_notebooks_responses.go b/api/regs/regs_client/notebook/put_notebooks_responses.go index 1713ee7..b071786 100644 --- a/api/regs/regs_client/notebook/put_notebooks_responses.go +++ b/api/regs/regs_client/notebook/put_notebooks_responses.go @@ -63,9 +63,8 @@ func (o *PutNotebooksReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutNotebooksOK() *PutNotebooksOK { return &PutNotebooksOK{} } -/*PutNotebooksOK handles this case with default header values. +/* PutNotebooksOK describes a response with status code 200, with default header values. Taxnexus Response with Notebook objects */ type PutNotebooksOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.NotebookResponse } @@ -89,18 +87,25 @@ type PutNotebooksOK struct { func (o *PutNotebooksOK) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksOK %+v", 200, o.Payload) } - func (o *PutNotebooksOK) GetPayload() *regs_models.NotebookResponse { return o.Payload } func (o *PutNotebooksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.NotebookResponse) @@ -117,7 +122,7 @@ func NewPutNotebooksUnauthorized() *PutNotebooksUnauthorized { return &PutNotebooksUnauthorized{} } -/*PutNotebooksUnauthorized handles this case with default header values. +/* PutNotebooksUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutNotebooksUnauthorized struct { func (o *PutNotebooksUnauthorized) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksUnauthorized %+v", 401, o.Payload) } - func (o *PutNotebooksUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutNotebooksUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutNotebooksForbidden() *PutNotebooksForbidden { return &PutNotebooksForbidden{} } -/*PutNotebooksForbidden handles this case with default header values. +/* PutNotebooksForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutNotebooksForbidden struct { func (o *PutNotebooksForbidden) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksForbidden %+v", 403, o.Payload) } - func (o *PutNotebooksForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutNotebooksForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutNotebooksNotFound() *PutNotebooksNotFound { return &PutNotebooksNotFound{} } -/*PutNotebooksNotFound handles this case with default header values. +/* PutNotebooksNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutNotebooksNotFound struct { func (o *PutNotebooksNotFound) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksNotFound %+v", 404, o.Payload) } - func (o *PutNotebooksNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutNotebooksNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutNotebooksUnprocessableEntity() *PutNotebooksUnprocessableEntity { return &PutNotebooksUnprocessableEntity{} } -/*PutNotebooksUnprocessableEntity handles this case with default header values. +/* PutNotebooksUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutNotebooksUnprocessableEntity struct { func (o *PutNotebooksUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutNotebooksUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutNotebooksUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutNotebooksInternalServerError() *PutNotebooksInternalServerError { return &PutNotebooksInternalServerError{} } -/*PutNotebooksInternalServerError handles this case with default header values. +/* PutNotebooksInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutNotebooksInternalServerError struct { func (o *PutNotebooksInternalServerError) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksInternalServerError %+v", 500, o.Payload) } - func (o *PutNotebooksInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutNotebooksInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/rating_engine/delete_rating_engine_parameters.go b/api/regs/regs_client/rating_engine/delete_rating_engine_parameters.go index 97af395..a19bd54 100644 --- a/api/regs/regs_client/rating_engine/delete_rating_engine_parameters.go +++ b/api/regs/regs_client/rating_engine/delete_rating_engine_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteRatingEngineParams creates a new DeleteRatingEngineParams object -// with the default values initialized. +// NewDeleteRatingEngineParams creates a new DeleteRatingEngineParams 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 NewDeleteRatingEngineParams() *DeleteRatingEngineParams { - var () return &DeleteRatingEngineParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteRatingEngineParamsWithTimeout creates a new DeleteRatingEngineParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteRatingEngineParamsWithTimeout(timeout time.Duration) *DeleteRatingEngineParams { - var () return &DeleteRatingEngineParams{ - timeout: timeout, } } // NewDeleteRatingEngineParamsWithContext creates a new DeleteRatingEngineParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteRatingEngineParamsWithContext(ctx context.Context) *DeleteRatingEngineParams { - var () return &DeleteRatingEngineParams{ - Context: ctx, } } // NewDeleteRatingEngineParamsWithHTTPClient creates a new DeleteRatingEngineParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteRatingEngineParamsWithHTTPClient(client *http.Client) *DeleteRatingEngineParams { - var () return &DeleteRatingEngineParams{ HTTPClient: client, } } -/*DeleteRatingEngineParams contains all the parameters to send to the API endpoint -for the delete rating engine operation typically these are written to a http.Request +/* DeleteRatingEngineParams contains all the parameters to send to the API endpoint + for the delete rating engine operation. + + Typically these are written to a http.Request. */ type DeleteRatingEngineParams struct { - /*ID - Taxnexus Id of the Record to be retrieved + /* ID. + Taxnexus Id of the Record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeleteRatingEngineParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete rating engine params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRatingEngineParams) WithDefaults() *DeleteRatingEngineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete rating engine params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRatingEngineParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete rating engine params func (o *DeleteRatingEngineParams) WithTimeout(timeout time.Duration) *DeleteRatingEngineParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteRatingEngineParams) WriteToRequest(r runtime.ClientRequest, reg s // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/rating_engine/delete_rating_engine_responses.go b/api/regs/regs_client/rating_engine/delete_rating_engine_responses.go index 0c11680..f5127fc 100644 --- a/api/regs/regs_client/rating_engine/delete_rating_engine_responses.go +++ b/api/regs/regs_client/rating_engine/delete_rating_engine_responses.go @@ -63,9 +63,8 @@ func (o *DeleteRatingEngineReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteRatingEngineOK() *DeleteRatingEngineOK { return &DeleteRatingEngineOK{} } -/*DeleteRatingEngineOK handles this case with default header values. +/* DeleteRatingEngineOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteRatingEngineOK struct { func (o *DeleteRatingEngineOK) Error() string { return fmt.Sprintf("[DELETE /ratingengines][%d] deleteRatingEngineOK %+v", 200, o.Payload) } - func (o *DeleteRatingEngineOK) GetPayload() *regs_models.DeleteResponse { return o.Payload } func (o *DeleteRatingEngineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteRatingEngineUnauthorized() *DeleteRatingEngineUnauthorized { return &DeleteRatingEngineUnauthorized{} } -/*DeleteRatingEngineUnauthorized handles this case with default header values. +/* DeleteRatingEngineUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteRatingEngineUnauthorized struct { func (o *DeleteRatingEngineUnauthorized) Error() string { return fmt.Sprintf("[DELETE /ratingengines][%d] deleteRatingEngineUnauthorized %+v", 401, o.Payload) } - func (o *DeleteRatingEngineUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteRatingEngineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -150,7 +155,7 @@ func NewDeleteRatingEngineForbidden() *DeleteRatingEngineForbidden { return &DeleteRatingEngineForbidden{} } -/*DeleteRatingEngineForbidden handles this case with default header values. +/* DeleteRatingEngineForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteRatingEngineForbidden struct { func (o *DeleteRatingEngineForbidden) Error() string { return fmt.Sprintf("[DELETE /ratingengines][%d] deleteRatingEngineForbidden %+v", 403, o.Payload) } - func (o *DeleteRatingEngineForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteRatingEngineForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -188,7 +196,7 @@ func NewDeleteRatingEngineNotFound() *DeleteRatingEngineNotFound { return &DeleteRatingEngineNotFound{} } -/*DeleteRatingEngineNotFound handles this case with default header values. +/* DeleteRatingEngineNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteRatingEngineNotFound struct { func (o *DeleteRatingEngineNotFound) Error() string { return fmt.Sprintf("[DELETE /ratingengines][%d] deleteRatingEngineNotFound %+v", 404, o.Payload) } - func (o *DeleteRatingEngineNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteRatingEngineNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -226,7 +237,7 @@ func NewDeleteRatingEngineUnprocessableEntity() *DeleteRatingEngineUnprocessable return &DeleteRatingEngineUnprocessableEntity{} } -/*DeleteRatingEngineUnprocessableEntity handles this case with default header values. +/* DeleteRatingEngineUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteRatingEngineUnprocessableEntity struct { func (o *DeleteRatingEngineUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /ratingengines][%d] deleteRatingEngineUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteRatingEngineUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteRatingEngineUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -264,7 +278,7 @@ func NewDeleteRatingEngineInternalServerError() *DeleteRatingEngineInternalServe return &DeleteRatingEngineInternalServerError{} } -/*DeleteRatingEngineInternalServerError handles this case with default header values. +/* DeleteRatingEngineInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteRatingEngineInternalServerError struct { func (o *DeleteRatingEngineInternalServerError) Error() string { return fmt.Sprintf("[DELETE /ratingengines][%d] deleteRatingEngineInternalServerError %+v", 500, o.Payload) } - func (o *DeleteRatingEngineInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteRatingEngineInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/rating_engine/get_rating_engines_parameters.go b/api/regs/regs_client/rating_engine/get_rating_engines_parameters.go index c8118c7..52b956f 100644 --- a/api/regs/regs_client/rating_engine/get_rating_engines_parameters.go +++ b/api/regs/regs_client/rating_engine/get_rating_engines_parameters.go @@ -21,88 +21,98 @@ import ( "github.com/go-openapi/swag" ) -// NewGetRatingEnginesParams creates a new GetRatingEnginesParams object -// with the default values initialized. +// NewGetRatingEnginesParams creates a new GetRatingEnginesParams 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 NewGetRatingEnginesParams() *GetRatingEnginesParams { - var () return &GetRatingEnginesParams{ - timeout: cr.DefaultTimeout, } } // NewGetRatingEnginesParamsWithTimeout creates a new GetRatingEnginesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetRatingEnginesParamsWithTimeout(timeout time.Duration) *GetRatingEnginesParams { - var () return &GetRatingEnginesParams{ - timeout: timeout, } } // NewGetRatingEnginesParamsWithContext creates a new GetRatingEnginesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetRatingEnginesParamsWithContext(ctx context.Context) *GetRatingEnginesParams { - var () return &GetRatingEnginesParams{ - Context: ctx, } } // NewGetRatingEnginesParamsWithHTTPClient creates a new GetRatingEnginesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetRatingEnginesParamsWithHTTPClient(client *http.Client) *GetRatingEnginesParams { - var () return &GetRatingEnginesParams{ HTTPClient: client, } } -/*GetRatingEnginesParams contains all the parameters to send to the API endpoint -for the get rating engines operation typically these are written to a http.Request +/* GetRatingEnginesParams contains all the parameters to send to the API endpoint + for the get rating engines operation. + + Typically these are written to a http.Request. */ type GetRatingEnginesParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*AccountNumber - The Taxnexus Account Number of the Account to be used a record retrieval + /* AccountNumber. + + The Taxnexus Account Number of the Account to be used a record retrieval */ AccountNumber *string - /*BackendID - Taxnexus Id of the Backend to be retrieved + /* BackendID. + + Taxnexus Id of the Backend to be retrieved */ BackendID *string - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + + Taxnexus Record Id of a Company */ CompanyID *string - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + + Taxnexus Id of the record to be retrieved */ ID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Name - The Name of this Object + /* Name. + + The Name of this Object */ Name *string - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -111,6 +121,21 @@ type GetRatingEnginesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get rating engines params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRatingEnginesParams) WithDefaults() *GetRatingEnginesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get rating engines params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRatingEnginesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get rating engines params func (o *GetRatingEnginesParams) WithTimeout(timeout time.Duration) *GetRatingEnginesParams { o.SetTimeout(timeout) @@ -244,128 +269,136 @@ func (o *GetRatingEnginesParams) WriteToRequest(r runtime.ClientRequest, reg str // 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.AccountNumber != nil { // query param accountNumber var qrAccountNumber string + if o.AccountNumber != nil { qrAccountNumber = *o.AccountNumber } qAccountNumber := qrAccountNumber if qAccountNumber != "" { + if err := r.SetQueryParam("accountNumber", qAccountNumber); err != nil { return err } } - } if o.BackendID != nil { // query param backendId var qrBackendID string + if o.BackendID != nil { qrBackendID = *o.BackendID } qBackendID := qrBackendID if qBackendID != "" { + if err := r.SetQueryParam("backendId", qBackendID); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/rating_engine/get_rating_engines_responses.go b/api/regs/regs_client/rating_engine/get_rating_engines_responses.go index 5f7ebd2..0c92a7b 100644 --- a/api/regs/regs_client/rating_engine/get_rating_engines_responses.go +++ b/api/regs/regs_client/rating_engine/get_rating_engines_responses.go @@ -63,9 +63,8 @@ func (o *GetRatingEnginesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetRatingEnginesOK() *GetRatingEnginesOK { return &GetRatingEnginesOK{} } -/*GetRatingEnginesOK handles this case with default header values. +/* GetRatingEnginesOK describes a response with status code 200, with default header values. Taxnexus Response with Rating Engine objects */ type GetRatingEnginesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.RatingEngineResponse } @@ -89,18 +87,25 @@ type GetRatingEnginesOK struct { func (o *GetRatingEnginesOK) Error() string { return fmt.Sprintf("[GET /ratingengines][%d] getRatingEnginesOK %+v", 200, o.Payload) } - func (o *GetRatingEnginesOK) GetPayload() *regs_models.RatingEngineResponse { return o.Payload } func (o *GetRatingEnginesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.RatingEngineResponse) @@ -117,7 +122,7 @@ func NewGetRatingEnginesUnauthorized() *GetRatingEnginesUnauthorized { return &GetRatingEnginesUnauthorized{} } -/*GetRatingEnginesUnauthorized handles this case with default header values. +/* GetRatingEnginesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetRatingEnginesUnauthorized struct { func (o *GetRatingEnginesUnauthorized) Error() string { return fmt.Sprintf("[GET /ratingengines][%d] getRatingEnginesUnauthorized %+v", 401, o.Payload) } - func (o *GetRatingEnginesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetRatingEnginesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetRatingEnginesForbidden() *GetRatingEnginesForbidden { return &GetRatingEnginesForbidden{} } -/*GetRatingEnginesForbidden handles this case with default header values. +/* GetRatingEnginesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetRatingEnginesForbidden struct { func (o *GetRatingEnginesForbidden) Error() string { return fmt.Sprintf("[GET /ratingengines][%d] getRatingEnginesForbidden %+v", 403, o.Payload) } - func (o *GetRatingEnginesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetRatingEnginesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetRatingEnginesNotFound() *GetRatingEnginesNotFound { return &GetRatingEnginesNotFound{} } -/*GetRatingEnginesNotFound handles this case with default header values. +/* GetRatingEnginesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetRatingEnginesNotFound struct { func (o *GetRatingEnginesNotFound) Error() string { return fmt.Sprintf("[GET /ratingengines][%d] getRatingEnginesNotFound %+v", 404, o.Payload) } - func (o *GetRatingEnginesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetRatingEnginesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetRatingEnginesUnprocessableEntity() *GetRatingEnginesUnprocessableEnti return &GetRatingEnginesUnprocessableEntity{} } -/*GetRatingEnginesUnprocessableEntity handles this case with default header values. +/* GetRatingEnginesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetRatingEnginesUnprocessableEntity struct { func (o *GetRatingEnginesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /ratingengines][%d] getRatingEnginesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetRatingEnginesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetRatingEnginesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetRatingEnginesInternalServerError() *GetRatingEnginesInternalServerErr return &GetRatingEnginesInternalServerError{} } -/*GetRatingEnginesInternalServerError handles this case with default header values. +/* GetRatingEnginesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetRatingEnginesInternalServerError struct { func (o *GetRatingEnginesInternalServerError) Error() string { return fmt.Sprintf("[GET /ratingengines][%d] getRatingEnginesInternalServerError %+v", 500, o.Payload) } - func (o *GetRatingEnginesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetRatingEnginesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/rating_engine/post_rating_engines_parameters.go b/api/regs/regs_client/rating_engine/post_rating_engines_parameters.go index 6033b16..09d22dd 100644 --- a/api/regs/regs_client/rating_engine/post_rating_engines_parameters.go +++ b/api/regs/regs_client/rating_engine/post_rating_engines_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostRatingEnginesParams creates a new PostRatingEnginesParams object -// with the default values initialized. +// NewPostRatingEnginesParams creates a new PostRatingEnginesParams 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 NewPostRatingEnginesParams() *PostRatingEnginesParams { - var () return &PostRatingEnginesParams{ - timeout: cr.DefaultTimeout, } } // NewPostRatingEnginesParamsWithTimeout creates a new PostRatingEnginesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostRatingEnginesParamsWithTimeout(timeout time.Duration) *PostRatingEnginesParams { - var () return &PostRatingEnginesParams{ - timeout: timeout, } } // NewPostRatingEnginesParamsWithContext creates a new PostRatingEnginesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostRatingEnginesParamsWithContext(ctx context.Context) *PostRatingEnginesParams { - var () return &PostRatingEnginesParams{ - Context: ctx, } } // NewPostRatingEnginesParamsWithHTTPClient creates a new PostRatingEnginesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostRatingEnginesParamsWithHTTPClient(client *http.Client) *PostRatingEnginesParams { - var () return &PostRatingEnginesParams{ HTTPClient: client, } } -/*PostRatingEnginesParams contains all the parameters to send to the API endpoint -for the post rating engines operation typically these are written to a http.Request +/* PostRatingEnginesParams contains all the parameters to send to the API endpoint + for the post rating engines operation. + + Typically these are written to a http.Request. */ type PostRatingEnginesParams struct { - /*RatingEngineRequest - An array of new Submission records + /* RatingEngineRequest. + An array of new Submission records */ RatingEngineRequest *regs_models.RatingEngineRequest @@ -77,6 +76,21 @@ type PostRatingEnginesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post rating engines params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostRatingEnginesParams) WithDefaults() *PostRatingEnginesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post rating engines params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostRatingEnginesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post rating engines params func (o *PostRatingEnginesParams) WithTimeout(timeout time.Duration) *PostRatingEnginesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostRatingEnginesParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.RatingEngineRequest != nil { if err := r.SetBodyParam(o.RatingEngineRequest); err != nil { return err diff --git a/api/regs/regs_client/rating_engine/post_rating_engines_responses.go b/api/regs/regs_client/rating_engine/post_rating_engines_responses.go index e108fbd..0585927 100644 --- a/api/regs/regs_client/rating_engine/post_rating_engines_responses.go +++ b/api/regs/regs_client/rating_engine/post_rating_engines_responses.go @@ -63,9 +63,8 @@ func (o *PostRatingEnginesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostRatingEnginesOK() *PostRatingEnginesOK { return &PostRatingEnginesOK{} } -/*PostRatingEnginesOK handles this case with default header values. +/* PostRatingEnginesOK describes a response with status code 200, with default header values. Taxnexus Response with License objects */ type PostRatingEnginesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.LicenseTypeResponse } @@ -89,18 +87,25 @@ type PostRatingEnginesOK struct { func (o *PostRatingEnginesOK) Error() string { return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesOK %+v", 200, o.Payload) } - func (o *PostRatingEnginesOK) GetPayload() *regs_models.LicenseTypeResponse { return o.Payload } func (o *PostRatingEnginesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.LicenseTypeResponse) @@ -117,7 +122,7 @@ func NewPostRatingEnginesUnauthorized() *PostRatingEnginesUnauthorized { return &PostRatingEnginesUnauthorized{} } -/*PostRatingEnginesUnauthorized handles this case with default header values. +/* PostRatingEnginesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostRatingEnginesUnauthorized struct { func (o *PostRatingEnginesUnauthorized) Error() string { return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesUnauthorized %+v", 401, o.Payload) } - func (o *PostRatingEnginesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostRatingEnginesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostRatingEnginesForbidden() *PostRatingEnginesForbidden { return &PostRatingEnginesForbidden{} } -/*PostRatingEnginesForbidden handles this case with default header values. +/* PostRatingEnginesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostRatingEnginesForbidden struct { func (o *PostRatingEnginesForbidden) Error() string { return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesForbidden %+v", 403, o.Payload) } - func (o *PostRatingEnginesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostRatingEnginesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostRatingEnginesNotFound() *PostRatingEnginesNotFound { return &PostRatingEnginesNotFound{} } -/*PostRatingEnginesNotFound handles this case with default header values. +/* PostRatingEnginesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostRatingEnginesNotFound struct { func (o *PostRatingEnginesNotFound) Error() string { return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesNotFound %+v", 404, o.Payload) } - func (o *PostRatingEnginesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostRatingEnginesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostRatingEnginesUnprocessableEntity() *PostRatingEnginesUnprocessableEn return &PostRatingEnginesUnprocessableEntity{} } -/*PostRatingEnginesUnprocessableEntity handles this case with default header values. +/* PostRatingEnginesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostRatingEnginesUnprocessableEntity struct { func (o *PostRatingEnginesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostRatingEnginesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostRatingEnginesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostRatingEnginesInternalServerError() *PostRatingEnginesInternalServerE return &PostRatingEnginesInternalServerError{} } -/*PostRatingEnginesInternalServerError handles this case with default header values. +/* PostRatingEnginesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostRatingEnginesInternalServerError struct { func (o *PostRatingEnginesInternalServerError) Error() string { return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesInternalServerError %+v", 500, o.Payload) } - func (o *PostRatingEnginesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostRatingEnginesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/rating_engine/put_rating_engines_parameters.go b/api/regs/regs_client/rating_engine/put_rating_engines_parameters.go index 328bc9d..8be2d8c 100644 --- a/api/regs/regs_client/rating_engine/put_rating_engines_parameters.go +++ b/api/regs/regs_client/rating_engine/put_rating_engines_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutRatingEnginesParams creates a new PutRatingEnginesParams object -// with the default values initialized. +// NewPutRatingEnginesParams creates a new PutRatingEnginesParams 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 NewPutRatingEnginesParams() *PutRatingEnginesParams { - var () return &PutRatingEnginesParams{ - timeout: cr.DefaultTimeout, } } // NewPutRatingEnginesParamsWithTimeout creates a new PutRatingEnginesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutRatingEnginesParamsWithTimeout(timeout time.Duration) *PutRatingEnginesParams { - var () return &PutRatingEnginesParams{ - timeout: timeout, } } // NewPutRatingEnginesParamsWithContext creates a new PutRatingEnginesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutRatingEnginesParamsWithContext(ctx context.Context) *PutRatingEnginesParams { - var () return &PutRatingEnginesParams{ - Context: ctx, } } // NewPutRatingEnginesParamsWithHTTPClient creates a new PutRatingEnginesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutRatingEnginesParamsWithHTTPClient(client *http.Client) *PutRatingEnginesParams { - var () return &PutRatingEnginesParams{ HTTPClient: client, } } -/*PutRatingEnginesParams contains all the parameters to send to the API endpoint -for the put rating engines operation typically these are written to a http.Request +/* PutRatingEnginesParams contains all the parameters to send to the API endpoint + for the put rating engines operation. + + Typically these are written to a http.Request. */ type PutRatingEnginesParams struct { - /*RatingEngineRequest - An array of new Submission records + /* RatingEngineRequest. + An array of new Submission records */ RatingEngineRequest *regs_models.RatingEngineRequest @@ -77,6 +76,21 @@ type PutRatingEnginesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put rating engines params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutRatingEnginesParams) WithDefaults() *PutRatingEnginesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put rating engines params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutRatingEnginesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put rating engines params func (o *PutRatingEnginesParams) WithTimeout(timeout time.Duration) *PutRatingEnginesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutRatingEnginesParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.RatingEngineRequest != nil { if err := r.SetBodyParam(o.RatingEngineRequest); err != nil { return err diff --git a/api/regs/regs_client/rating_engine/put_rating_engines_responses.go b/api/regs/regs_client/rating_engine/put_rating_engines_responses.go index e9be928..ae12bfb 100644 --- a/api/regs/regs_client/rating_engine/put_rating_engines_responses.go +++ b/api/regs/regs_client/rating_engine/put_rating_engines_responses.go @@ -63,9 +63,8 @@ func (o *PutRatingEnginesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutRatingEnginesOK() *PutRatingEnginesOK { return &PutRatingEnginesOK{} } -/*PutRatingEnginesOK handles this case with default header values. +/* PutRatingEnginesOK describes a response with status code 200, with default header values. Taxnexus Response with License objects */ type PutRatingEnginesOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.LicenseTypeResponse } @@ -89,18 +87,25 @@ type PutRatingEnginesOK struct { func (o *PutRatingEnginesOK) Error() string { return fmt.Sprintf("[PUT /ratingengines][%d] putRatingEnginesOK %+v", 200, o.Payload) } - func (o *PutRatingEnginesOK) GetPayload() *regs_models.LicenseTypeResponse { return o.Payload } func (o *PutRatingEnginesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.LicenseTypeResponse) @@ -117,7 +122,7 @@ func NewPutRatingEnginesUnauthorized() *PutRatingEnginesUnauthorized { return &PutRatingEnginesUnauthorized{} } -/*PutRatingEnginesUnauthorized handles this case with default header values. +/* PutRatingEnginesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutRatingEnginesUnauthorized struct { func (o *PutRatingEnginesUnauthorized) Error() string { return fmt.Sprintf("[PUT /ratingengines][%d] putRatingEnginesUnauthorized %+v", 401, o.Payload) } - func (o *PutRatingEnginesUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutRatingEnginesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutRatingEnginesForbidden() *PutRatingEnginesForbidden { return &PutRatingEnginesForbidden{} } -/*PutRatingEnginesForbidden handles this case with default header values. +/* PutRatingEnginesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutRatingEnginesForbidden struct { func (o *PutRatingEnginesForbidden) Error() string { return fmt.Sprintf("[PUT /ratingengines][%d] putRatingEnginesForbidden %+v", 403, o.Payload) } - func (o *PutRatingEnginesForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutRatingEnginesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutRatingEnginesNotFound() *PutRatingEnginesNotFound { return &PutRatingEnginesNotFound{} } -/*PutRatingEnginesNotFound handles this case with default header values. +/* PutRatingEnginesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutRatingEnginesNotFound struct { func (o *PutRatingEnginesNotFound) Error() string { return fmt.Sprintf("[PUT /ratingengines][%d] putRatingEnginesNotFound %+v", 404, o.Payload) } - func (o *PutRatingEnginesNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutRatingEnginesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutRatingEnginesUnprocessableEntity() *PutRatingEnginesUnprocessableEnti return &PutRatingEnginesUnprocessableEntity{} } -/*PutRatingEnginesUnprocessableEntity handles this case with default header values. +/* PutRatingEnginesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutRatingEnginesUnprocessableEntity struct { func (o *PutRatingEnginesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /ratingengines][%d] putRatingEnginesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutRatingEnginesUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutRatingEnginesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutRatingEnginesInternalServerError() *PutRatingEnginesInternalServerErr return &PutRatingEnginesInternalServerError{} } -/*PutRatingEnginesInternalServerError handles this case with default header values. +/* PutRatingEnginesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutRatingEnginesInternalServerError struct { func (o *PutRatingEnginesInternalServerError) Error() string { return fmt.Sprintf("[PUT /ratingengines][%d] putRatingEnginesInternalServerError %+v", 500, o.Payload) } - func (o *PutRatingEnginesInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutRatingEnginesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/rating_engine/rating_engine_client.go b/api/regs/regs_client/rating_engine/rating_engine_client.go index 483ac80..6c63214 100644 --- a/api/regs/regs_client/rating_engine/rating_engine_client.go +++ b/api/regs/regs_client/rating_engine/rating_engine_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteRatingEngine(params *DeleteRatingEngineParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteRatingEngineOK, error) + DeleteRatingEngine(params *DeleteRatingEngineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteRatingEngineOK, error) - GetRatingEngines(params *GetRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter) (*GetRatingEnginesOK, error) + GetRatingEngines(params *GetRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRatingEnginesOK, error) - PostRatingEngines(params *PostRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter) (*PostRatingEnginesOK, error) + PostRatingEngines(params *PostRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostRatingEnginesOK, error) - PutRatingEngines(params *PutRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter) (*PutRatingEnginesOK, error) + PutRatingEngines(params *PutRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutRatingEnginesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete Taxnexus Backend record */ -func (a *Client) DeleteRatingEngine(params *DeleteRatingEngineParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteRatingEngineOK, error) { +func (a *Client) DeleteRatingEngine(params *DeleteRatingEngineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteRatingEngineOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteRatingEngineParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteRatingEngine", Method: "DELETE", PathPattern: "/ratingengines", @@ -65,7 +67,12 @@ func (a *Client) DeleteRatingEngine(params *DeleteRatingEngineParams, authInfo r 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteRatingEngine(params *DeleteRatingEngineParams, authInfo r Return a list of Rating Engines */ -func (a *Client) GetRatingEngines(params *GetRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter) (*GetRatingEnginesOK, error) { +func (a *Client) GetRatingEngines(params *GetRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRatingEnginesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRatingEnginesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRatingEngines", Method: "GET", PathPattern: "/ratingengines", @@ -102,7 +108,12 @@ func (a *Client) GetRatingEngines(params *GetRatingEnginesParams, authInfo runti 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 } @@ -121,13 +132,12 @@ func (a *Client) GetRatingEngines(params *GetRatingEnginesParams, authInfo runti Rating Engine records to be added */ -func (a *Client) PostRatingEngines(params *PostRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter) (*PostRatingEnginesOK, error) { +func (a *Client) PostRatingEngines(params *PostRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostRatingEnginesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostRatingEnginesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postRatingEngines", Method: "POST", PathPattern: "/ratingengines", @@ -139,7 +149,12 @@ func (a *Client) PostRatingEngines(params *PostRatingEnginesParams, authInfo run 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 } @@ -158,13 +173,12 @@ func (a *Client) PostRatingEngines(params *PostRatingEnginesParams, authInfo run Update Rating Engine records */ -func (a *Client) PutRatingEngines(params *PutRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter) (*PutRatingEnginesOK, error) { +func (a *Client) PutRatingEngines(params *PutRatingEnginesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutRatingEnginesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutRatingEnginesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putRatingEngines", Method: "PUT", PathPattern: "/ratingengines", @@ -176,7 +190,12 @@ func (a *Client) PutRatingEngines(params *PutRatingEnginesParams, authInfo runti 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 } diff --git a/api/regs/regs_client/submission/get_submissions_parameters.go b/api/regs/regs_client/submission/get_submissions_parameters.go index 1d2acbf..bb8779f 100644 --- a/api/regs/regs_client/submission/get_submissions_parameters.go +++ b/api/regs/regs_client/submission/get_submissions_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSubmissionsParams creates a new GetSubmissionsParams object -// with the default values initialized. +// NewGetSubmissionsParams creates a new GetSubmissionsParams 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 NewGetSubmissionsParams() *GetSubmissionsParams { - var () return &GetSubmissionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetSubmissionsParamsWithTimeout creates a new GetSubmissionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSubmissionsParamsWithTimeout(timeout time.Duration) *GetSubmissionsParams { - var () return &GetSubmissionsParams{ - timeout: timeout, } } // NewGetSubmissionsParamsWithContext creates a new GetSubmissionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSubmissionsParamsWithContext(ctx context.Context) *GetSubmissionsParams { - var () return &GetSubmissionsParams{ - Context: ctx, } } // NewGetSubmissionsParamsWithHTTPClient creates a new GetSubmissionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSubmissionsParamsWithHTTPClient(client *http.Client) *GetSubmissionsParams { - var () return &GetSubmissionsParams{ HTTPClient: client, } } -/*GetSubmissionsParams contains all the parameters to send to the API endpoint -for the get submissions operation typically these are written to a http.Request +/* GetSubmissionsParams contains all the parameters to send to the API endpoint + for the get submissions operation. + + Typically these are written to a http.Request. */ type GetSubmissionsParams struct { - /*CompanyID - Taxnexus Record Id of a Company + /* CompanyID. + Taxnexus Record Id of a Company */ CompanyID *string - /*ID - Taxnexus Id of the record to be retrieved + /* ID. + + Taxnexus Id of the record to be retrieved */ ID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*SubmissionID - Taxnexus Record Id of a Submisssion + /* SubmissionID. + + Taxnexus Record Id of a Submisssion */ SubmissionID *string @@ -96,6 +103,21 @@ type GetSubmissionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSubmissionsParams) WithDefaults() *GetSubmissionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSubmissionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get submissions params func (o *GetSubmissionsParams) WithTimeout(timeout time.Duration) *GetSubmissionsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetSubmissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); 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 o.SubmissionID != nil { // query param submissionId var qrSubmissionID string + if o.SubmissionID != nil { qrSubmissionID = *o.SubmissionID } qSubmissionID := qrSubmissionID if qSubmissionID != "" { + if err := r.SetQueryParam("submissionId", qSubmissionID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/submission/get_submissions_responses.go b/api/regs/regs_client/submission/get_submissions_responses.go index 74c7fff..35830f1 100644 --- a/api/regs/regs_client/submission/get_submissions_responses.go +++ b/api/regs/regs_client/submission/get_submissions_responses.go @@ -63,9 +63,8 @@ func (o *GetSubmissionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetSubmissionsOK() *GetSubmissionsOK { return &GetSubmissionsOK{} } -/*GetSubmissionsOK handles this case with default header values. +/* GetSubmissionsOK describes a response with status code 200, with default header values. Taxnexus Response with Submission objects */ type GetSubmissionsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.SubmissionResponse } @@ -89,18 +87,25 @@ type GetSubmissionsOK struct { func (o *GetSubmissionsOK) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsOK %+v", 200, o.Payload) } - func (o *GetSubmissionsOK) GetPayload() *regs_models.SubmissionResponse { return o.Payload } func (o *GetSubmissionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.SubmissionResponse) @@ -117,7 +122,7 @@ func NewGetSubmissionsUnauthorized() *GetSubmissionsUnauthorized { return &GetSubmissionsUnauthorized{} } -/*GetSubmissionsUnauthorized handles this case with default header values. +/* GetSubmissionsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetSubmissionsUnauthorized struct { func (o *GetSubmissionsUnauthorized) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsUnauthorized %+v", 401, o.Payload) } - func (o *GetSubmissionsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetSubmissionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetSubmissionsForbidden() *GetSubmissionsForbidden { return &GetSubmissionsForbidden{} } -/*GetSubmissionsForbidden handles this case with default header values. +/* GetSubmissionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetSubmissionsForbidden struct { func (o *GetSubmissionsForbidden) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsForbidden %+v", 403, o.Payload) } - func (o *GetSubmissionsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetSubmissionsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetSubmissionsNotFound() *GetSubmissionsNotFound { return &GetSubmissionsNotFound{} } -/*GetSubmissionsNotFound handles this case with default header values. +/* GetSubmissionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetSubmissionsNotFound struct { func (o *GetSubmissionsNotFound) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsNotFound %+v", 404, o.Payload) } - func (o *GetSubmissionsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetSubmissionsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetSubmissionsUnprocessableEntity() *GetSubmissionsUnprocessableEntity { return &GetSubmissionsUnprocessableEntity{} } -/*GetSubmissionsUnprocessableEntity handles this case with default header values. +/* GetSubmissionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetSubmissionsUnprocessableEntity struct { func (o *GetSubmissionsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetSubmissionsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetSubmissionsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetSubmissionsInternalServerError() *GetSubmissionsInternalServerError { return &GetSubmissionsInternalServerError{} } -/*GetSubmissionsInternalServerError handles this case with default header values. +/* GetSubmissionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetSubmissionsInternalServerError struct { func (o *GetSubmissionsInternalServerError) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsInternalServerError %+v", 500, o.Payload) } - func (o *GetSubmissionsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetSubmissionsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/submission/post_submissions_parameters.go b/api/regs/regs_client/submission/post_submissions_parameters.go index 6c0dc6c..072634e 100644 --- a/api/regs/regs_client/submission/post_submissions_parameters.go +++ b/api/regs/regs_client/submission/post_submissions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostSubmissionsParams creates a new PostSubmissionsParams object -// with the default values initialized. +// NewPostSubmissionsParams creates a new PostSubmissionsParams 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 NewPostSubmissionsParams() *PostSubmissionsParams { - var () return &PostSubmissionsParams{ - timeout: cr.DefaultTimeout, } } // NewPostSubmissionsParamsWithTimeout creates a new PostSubmissionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostSubmissionsParamsWithTimeout(timeout time.Duration) *PostSubmissionsParams { - var () return &PostSubmissionsParams{ - timeout: timeout, } } // NewPostSubmissionsParamsWithContext creates a new PostSubmissionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostSubmissionsParamsWithContext(ctx context.Context) *PostSubmissionsParams { - var () return &PostSubmissionsParams{ - Context: ctx, } } // NewPostSubmissionsParamsWithHTTPClient creates a new PostSubmissionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostSubmissionsParamsWithHTTPClient(client *http.Client) *PostSubmissionsParams { - var () return &PostSubmissionsParams{ HTTPClient: client, } } -/*PostSubmissionsParams contains all the parameters to send to the API endpoint -for the post submissions operation typically these are written to a http.Request +/* PostSubmissionsParams contains all the parameters to send to the API endpoint + for the post submissions operation. + + Typically these are written to a http.Request. */ type PostSubmissionsParams struct { - /*SubmissionRequest - An array of new Submission records + /* SubmissionRequest. + An array of new Submission records */ SubmissionRequest *regs_models.SubmissionRequest @@ -77,6 +76,21 @@ type PostSubmissionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSubmissionsParams) WithDefaults() *PostSubmissionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSubmissionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post submissions params func (o *PostSubmissionsParams) WithTimeout(timeout time.Duration) *PostSubmissionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostSubmissionsParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.SubmissionRequest != nil { if err := r.SetBodyParam(o.SubmissionRequest); err != nil { return err diff --git a/api/regs/regs_client/submission/post_submissions_responses.go b/api/regs/regs_client/submission/post_submissions_responses.go index 32e01b1..7f81643 100644 --- a/api/regs/regs_client/submission/post_submissions_responses.go +++ b/api/regs/regs_client/submission/post_submissions_responses.go @@ -63,9 +63,8 @@ func (o *PostSubmissionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostSubmissionsOK() *PostSubmissionsOK { return &PostSubmissionsOK{} } -/*PostSubmissionsOK handles this case with default header values. +/* PostSubmissionsOK describes a response with status code 200, with default header values. Taxnexus Response with Submission objects */ type PostSubmissionsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.SubmissionResponse } @@ -89,18 +87,25 @@ type PostSubmissionsOK struct { func (o *PostSubmissionsOK) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsOK %+v", 200, o.Payload) } - func (o *PostSubmissionsOK) GetPayload() *regs_models.SubmissionResponse { return o.Payload } func (o *PostSubmissionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.SubmissionResponse) @@ -117,7 +122,7 @@ func NewPostSubmissionsUnauthorized() *PostSubmissionsUnauthorized { return &PostSubmissionsUnauthorized{} } -/*PostSubmissionsUnauthorized handles this case with default header values. +/* PostSubmissionsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostSubmissionsUnauthorized struct { func (o *PostSubmissionsUnauthorized) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsUnauthorized %+v", 401, o.Payload) } - func (o *PostSubmissionsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostSubmissionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostSubmissionsForbidden() *PostSubmissionsForbidden { return &PostSubmissionsForbidden{} } -/*PostSubmissionsForbidden handles this case with default header values. +/* PostSubmissionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostSubmissionsForbidden struct { func (o *PostSubmissionsForbidden) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsForbidden %+v", 403, o.Payload) } - func (o *PostSubmissionsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostSubmissionsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostSubmissionsNotFound() *PostSubmissionsNotFound { return &PostSubmissionsNotFound{} } -/*PostSubmissionsNotFound handles this case with default header values. +/* PostSubmissionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostSubmissionsNotFound struct { func (o *PostSubmissionsNotFound) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsNotFound %+v", 404, o.Payload) } - func (o *PostSubmissionsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostSubmissionsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostSubmissionsUnprocessableEntity() *PostSubmissionsUnprocessableEntity return &PostSubmissionsUnprocessableEntity{} } -/*PostSubmissionsUnprocessableEntity handles this case with default header values. +/* PostSubmissionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostSubmissionsUnprocessableEntity struct { func (o *PostSubmissionsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostSubmissionsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostSubmissionsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostSubmissionsInternalServerError() *PostSubmissionsInternalServerError return &PostSubmissionsInternalServerError{} } -/*PostSubmissionsInternalServerError handles this case with default header values. +/* PostSubmissionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostSubmissionsInternalServerError struct { func (o *PostSubmissionsInternalServerError) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsInternalServerError %+v", 500, o.Payload) } - func (o *PostSubmissionsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostSubmissionsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/submission/put_submissions_parameters.go b/api/regs/regs_client/submission/put_submissions_parameters.go index 1fa98ab..5ca94ab 100644 --- a/api/regs/regs_client/submission/put_submissions_parameters.go +++ b/api/regs/regs_client/submission/put_submissions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutSubmissionsParams creates a new PutSubmissionsParams object -// with the default values initialized. +// NewPutSubmissionsParams creates a new PutSubmissionsParams 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 NewPutSubmissionsParams() *PutSubmissionsParams { - var () return &PutSubmissionsParams{ - timeout: cr.DefaultTimeout, } } // NewPutSubmissionsParamsWithTimeout creates a new PutSubmissionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutSubmissionsParamsWithTimeout(timeout time.Duration) *PutSubmissionsParams { - var () return &PutSubmissionsParams{ - timeout: timeout, } } // NewPutSubmissionsParamsWithContext creates a new PutSubmissionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutSubmissionsParamsWithContext(ctx context.Context) *PutSubmissionsParams { - var () return &PutSubmissionsParams{ - Context: ctx, } } // NewPutSubmissionsParamsWithHTTPClient creates a new PutSubmissionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutSubmissionsParamsWithHTTPClient(client *http.Client) *PutSubmissionsParams { - var () return &PutSubmissionsParams{ HTTPClient: client, } } -/*PutSubmissionsParams contains all the parameters to send to the API endpoint -for the put submissions operation typically these are written to a http.Request +/* PutSubmissionsParams contains all the parameters to send to the API endpoint + for the put submissions operation. + + Typically these are written to a http.Request. */ type PutSubmissionsParams struct { - /*SubmissionRequest - An array of new Submission records + /* SubmissionRequest. + An array of new Submission records */ SubmissionRequest *regs_models.SubmissionRequest @@ -77,6 +76,21 @@ type PutSubmissionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSubmissionsParams) WithDefaults() *PutSubmissionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSubmissionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put submissions params func (o *PutSubmissionsParams) WithTimeout(timeout time.Duration) *PutSubmissionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutSubmissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.SubmissionRequest != nil { if err := r.SetBodyParam(o.SubmissionRequest); err != nil { return err diff --git a/api/regs/regs_client/submission/put_submissions_responses.go b/api/regs/regs_client/submission/put_submissions_responses.go index c2f1e0a..8d93110 100644 --- a/api/regs/regs_client/submission/put_submissions_responses.go +++ b/api/regs/regs_client/submission/put_submissions_responses.go @@ -63,9 +63,8 @@ func (o *PutSubmissionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutSubmissionsOK() *PutSubmissionsOK { return &PutSubmissionsOK{} } -/*PutSubmissionsOK handles this case with default header values. +/* PutSubmissionsOK describes a response with status code 200, with default header values. Taxnexus Response with Submission objects */ type PutSubmissionsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.SubmissionResponse } @@ -89,18 +87,25 @@ type PutSubmissionsOK struct { func (o *PutSubmissionsOK) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsOK %+v", 200, o.Payload) } - func (o *PutSubmissionsOK) GetPayload() *regs_models.SubmissionResponse { return o.Payload } func (o *PutSubmissionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.SubmissionResponse) @@ -117,7 +122,7 @@ func NewPutSubmissionsUnauthorized() *PutSubmissionsUnauthorized { return &PutSubmissionsUnauthorized{} } -/*PutSubmissionsUnauthorized handles this case with default header values. +/* PutSubmissionsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutSubmissionsUnauthorized struct { func (o *PutSubmissionsUnauthorized) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsUnauthorized %+v", 401, o.Payload) } - func (o *PutSubmissionsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutSubmissionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutSubmissionsForbidden() *PutSubmissionsForbidden { return &PutSubmissionsForbidden{} } -/*PutSubmissionsForbidden handles this case with default header values. +/* PutSubmissionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutSubmissionsForbidden struct { func (o *PutSubmissionsForbidden) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsForbidden %+v", 403, o.Payload) } - func (o *PutSubmissionsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutSubmissionsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutSubmissionsNotFound() *PutSubmissionsNotFound { return &PutSubmissionsNotFound{} } -/*PutSubmissionsNotFound handles this case with default header values. +/* PutSubmissionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutSubmissionsNotFound struct { func (o *PutSubmissionsNotFound) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsNotFound %+v", 404, o.Payload) } - func (o *PutSubmissionsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutSubmissionsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutSubmissionsUnprocessableEntity() *PutSubmissionsUnprocessableEntity { return &PutSubmissionsUnprocessableEntity{} } -/*PutSubmissionsUnprocessableEntity handles this case with default header values. +/* PutSubmissionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutSubmissionsUnprocessableEntity struct { func (o *PutSubmissionsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutSubmissionsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutSubmissionsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutSubmissionsInternalServerError() *PutSubmissionsInternalServerError { return &PutSubmissionsInternalServerError{} } -/*PutSubmissionsInternalServerError handles this case with default header values. +/* PutSubmissionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutSubmissionsInternalServerError struct { func (o *PutSubmissionsInternalServerError) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsInternalServerError %+v", 500, o.Payload) } - func (o *PutSubmissionsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutSubmissionsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/submission/submission_client.go b/api/regs/regs_client/submission/submission_client.go index c50dac4..83fb6a5 100644 --- a/api/regs/regs_client/submission/submission_client.go +++ b/api/regs/regs_client/submission/submission_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubmissionsOK, error) + GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSubmissionsOK, error) - PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubmissionsOK, error) + PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSubmissionsOK, error) - PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubmissionsOK, error) + PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSubmissionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Submissions */ -func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubmissionsOK, error) { +func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSubmissionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSubmissionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSubmissions", Method: "GET", PathPattern: "/submissions", @@ -63,7 +65,12 @@ func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.C 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 } @@ -82,13 +89,12 @@ func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.C Create new Sumissions */ -func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubmissionsOK, error) { +func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSubmissionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostSubmissionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postSubmissions", Method: "POST", PathPattern: "/submissions", @@ -100,7 +106,12 @@ func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime 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 } @@ -119,13 +130,12 @@ func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime Update all the fields in a Submission record identified by Taxnexus Id */ -func (a *Client) PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubmissionsOK, error) { +func (a *Client) PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSubmissionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutSubmissionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putSubmissions", Method: "PUT", PathPattern: "/submissions", @@ -137,7 +147,12 @@ func (a *Client) PutSubmissions(params *PutSubmissionsParams, authInfo runtime.C 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 } diff --git a/api/regs/regs_client/tax_type_account/delete_type_accounts_parameters.go b/api/regs/regs_client/tax_type_account/delete_type_accounts_parameters.go index f3a4ee7..5ff4075 100644 --- a/api/regs/regs_client/tax_type_account/delete_type_accounts_parameters.go +++ b/api/regs/regs_client/tax_type_account/delete_type_accounts_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteTypeAccountsParams creates a new DeleteTypeAccountsParams object -// with the default values initialized. +// NewDeleteTypeAccountsParams creates a new DeleteTypeAccountsParams 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 NewDeleteTypeAccountsParams() *DeleteTypeAccountsParams { - var () return &DeleteTypeAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteTypeAccountsParamsWithTimeout creates a new DeleteTypeAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteTypeAccountsParamsWithTimeout(timeout time.Duration) *DeleteTypeAccountsParams { - var () return &DeleteTypeAccountsParams{ - timeout: timeout, } } // NewDeleteTypeAccountsParamsWithContext creates a new DeleteTypeAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteTypeAccountsParamsWithContext(ctx context.Context) *DeleteTypeAccountsParams { - var () return &DeleteTypeAccountsParams{ - Context: ctx, } } // NewDeleteTypeAccountsParamsWithHTTPClient creates a new DeleteTypeAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteTypeAccountsParamsWithHTTPClient(client *http.Client) *DeleteTypeAccountsParams { - var () return &DeleteTypeAccountsParams{ HTTPClient: client, } } -/*DeleteTypeAccountsParams contains all the parameters to send to the API endpoint -for the delete type accounts operation typically these are written to a http.Request +/* DeleteTypeAccountsParams contains all the parameters to send to the API endpoint + for the delete type accounts operation. + + Typically these are written to a http.Request. */ type DeleteTypeAccountsParams struct { - /*ID - Taxnexus Id of the Record to be retrieved + /* ID. + Taxnexus Id of the Record to be retrieved */ ID *string @@ -75,6 +74,21 @@ type DeleteTypeAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteTypeAccountsParams) WithDefaults() *DeleteTypeAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteTypeAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete type accounts params func (o *DeleteTypeAccountsParams) WithTimeout(timeout time.Duration) *DeleteTypeAccountsParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteTypeAccountsParams) WriteToRequest(r runtime.ClientRequest, reg s // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/tax_type_account/delete_type_accounts_responses.go b/api/regs/regs_client/tax_type_account/delete_type_accounts_responses.go index a0660b5..e2d7748 100644 --- a/api/regs/regs_client/tax_type_account/delete_type_accounts_responses.go +++ b/api/regs/regs_client/tax_type_account/delete_type_accounts_responses.go @@ -63,9 +63,8 @@ func (o *DeleteTypeAccountsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewDeleteTypeAccountsOK() *DeleteTypeAccountsOK { return &DeleteTypeAccountsOK{} } -/*DeleteTypeAccountsOK handles this case with default header values. +/* DeleteTypeAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Message Objects with Delete Status */ @@ -87,15 +86,18 @@ type DeleteTypeAccountsOK struct { func (o *DeleteTypeAccountsOK) Error() string { return fmt.Sprintf("[DELETE /taxtypeaccounts][%d] deleteTypeAccountsOK %+v", 200, o.Payload) } - func (o *DeleteTypeAccountsOK) GetPayload() *regs_models.DeleteResponse { return o.Payload } func (o *DeleteTypeAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.DeleteResponse) @@ -112,7 +114,7 @@ func NewDeleteTypeAccountsUnauthorized() *DeleteTypeAccountsUnauthorized { return &DeleteTypeAccountsUnauthorized{} } -/*DeleteTypeAccountsUnauthorized handles this case with default header values. +/* DeleteTypeAccountsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type DeleteTypeAccountsUnauthorized struct { func (o *DeleteTypeAccountsUnauthorized) Error() string { return fmt.Sprintf("[DELETE /taxtypeaccounts][%d] deleteTypeAccountsUnauthorized %+v", 401, o.Payload) } - func (o *DeleteTypeAccountsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteTypeAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -150,7 +155,7 @@ func NewDeleteTypeAccountsForbidden() *DeleteTypeAccountsForbidden { return &DeleteTypeAccountsForbidden{} } -/*DeleteTypeAccountsForbidden handles this case with default header values. +/* DeleteTypeAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type DeleteTypeAccountsForbidden struct { func (o *DeleteTypeAccountsForbidden) Error() string { return fmt.Sprintf("[DELETE /taxtypeaccounts][%d] deleteTypeAccountsForbidden %+v", 403, o.Payload) } - func (o *DeleteTypeAccountsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteTypeAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -188,7 +196,7 @@ func NewDeleteTypeAccountsNotFound() *DeleteTypeAccountsNotFound { return &DeleteTypeAccountsNotFound{} } -/*DeleteTypeAccountsNotFound handles this case with default header values. +/* DeleteTypeAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type DeleteTypeAccountsNotFound struct { func (o *DeleteTypeAccountsNotFound) Error() string { return fmt.Sprintf("[DELETE /taxtypeaccounts][%d] deleteTypeAccountsNotFound %+v", 404, o.Payload) } - func (o *DeleteTypeAccountsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteTypeAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -226,7 +237,7 @@ func NewDeleteTypeAccountsUnprocessableEntity() *DeleteTypeAccountsUnprocessable return &DeleteTypeAccountsUnprocessableEntity{} } -/*DeleteTypeAccountsUnprocessableEntity handles this case with default header values. +/* DeleteTypeAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type DeleteTypeAccountsUnprocessableEntity struct { func (o *DeleteTypeAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /taxtypeaccounts][%d] deleteTypeAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *DeleteTypeAccountsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteTypeAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -264,7 +278,7 @@ func NewDeleteTypeAccountsInternalServerError() *DeleteTypeAccountsInternalServe return &DeleteTypeAccountsInternalServerError{} } -/*DeleteTypeAccountsInternalServerError handles this case with default header values. +/* DeleteTypeAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type DeleteTypeAccountsInternalServerError struct { func (o *DeleteTypeAccountsInternalServerError) Error() string { return fmt.Sprintf("[DELETE /taxtypeaccounts][%d] deleteTypeAccountsInternalServerError %+v", 500, o.Payload) } - func (o *DeleteTypeAccountsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *DeleteTypeAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/tax_type_account/get_tax_type_accounts_parameters.go b/api/regs/regs_client/tax_type_account/get_tax_type_accounts_parameters.go index d9ba27a..0e944cc 100644 --- a/api/regs/regs_client/tax_type_account/get_tax_type_accounts_parameters.go +++ b/api/regs/regs_client/tax_type_account/get_tax_type_accounts_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTaxTypeAccountsParams creates a new GetTaxTypeAccountsParams object -// with the default values initialized. +// NewGetTaxTypeAccountsParams creates a new GetTaxTypeAccountsParams 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 NewGetTaxTypeAccountsParams() *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxTypeAccountsParamsWithTimeout creates a new GetTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxTypeAccountsParamsWithTimeout(timeout time.Duration) *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ - timeout: timeout, } } // NewGetTaxTypeAccountsParamsWithContext creates a new GetTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxTypeAccountsParamsWithContext(ctx context.Context) *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ - Context: ctx, } } // NewGetTaxTypeAccountsParamsWithHTTPClient creates a new GetTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxTypeAccountsParamsWithHTTPClient(client *http.Client) *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ HTTPClient: client, } } -/*GetTaxTypeAccountsParams contains all the parameters to send to the API endpoint -for the get tax type accounts operation typically these are written to a http.Request +/* GetTaxTypeAccountsParams contains all the parameters to send to the API endpoint + for the get tax type accounts operation. + + Typically these are written to a http.Request. */ type GetTaxTypeAccountsParams struct { - /*AccountID - Taxnexus Record Id of an Account + /* AccountID. + Taxnexus Record Id of an Account */ AccountID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TaxTypeAccountID - Taxnexus Record Id of the Tax Type Account + /* TaxTypeAccountID. + + Taxnexus Record Id of the Tax Type Account */ TaxTypeAccountID *string - /*TaxTypeID - Taxnexus Record Id of the Tax Type + /* TaxTypeID. + + Taxnexus Record Id of the Tax Type */ TaxTypeID *string @@ -96,6 +103,21 @@ type GetTaxTypeAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypeAccountsParams) WithDefaults() *GetTaxTypeAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypeAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax type accounts params func (o *GetTaxTypeAccountsParams) WithTimeout(timeout time.Duration) *GetTaxTypeAccountsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetTaxTypeAccountsParams) WriteToRequest(r runtime.ClientRequest, reg s // 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.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 o.TaxTypeAccountID != nil { // query param taxTypeAccountId var qrTaxTypeAccountID string + if o.TaxTypeAccountID != nil { qrTaxTypeAccountID = *o.TaxTypeAccountID } qTaxTypeAccountID := qrTaxTypeAccountID if qTaxTypeAccountID != "" { + if err := r.SetQueryParam("taxTypeAccountId", qTaxTypeAccountID); err != nil { return err } } - } if o.TaxTypeID != nil { // query param taxTypeId var qrTaxTypeID string + if o.TaxTypeID != nil { qrTaxTypeID = *o.TaxTypeID } qTaxTypeID := qrTaxTypeID if qTaxTypeID != "" { + if err := r.SetQueryParam("taxTypeId", qTaxTypeID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/tax_type_account/get_tax_type_accounts_responses.go b/api/regs/regs_client/tax_type_account/get_tax_type_accounts_responses.go index bc4ffb9..c128faa 100644 --- a/api/regs/regs_client/tax_type_account/get_tax_type_accounts_responses.go +++ b/api/regs/regs_client/tax_type_account/get_tax_type_accounts_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxTypeAccountsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTaxTypeAccountsOK() *GetTaxTypeAccountsOK { return &GetTaxTypeAccountsOK{} } -/*GetTaxTypeAccountsOK handles this case with default header values. +/* GetTaxTypeAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Tax Type Account objects */ type GetTaxTypeAccountsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.TaxTypeAccountResponse } @@ -89,18 +87,25 @@ type GetTaxTypeAccountsOK struct { func (o *GetTaxTypeAccountsOK) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsOK %+v", 200, o.Payload) } - func (o *GetTaxTypeAccountsOK) GetPayload() *regs_models.TaxTypeAccountResponse { return o.Payload } func (o *GetTaxTypeAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.TaxTypeAccountResponse) @@ -117,7 +122,7 @@ func NewGetTaxTypeAccountsUnauthorized() *GetTaxTypeAccountsUnauthorized { return &GetTaxTypeAccountsUnauthorized{} } -/*GetTaxTypeAccountsUnauthorized handles this case with default header values. +/* GetTaxTypeAccountsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetTaxTypeAccountsUnauthorized struct { func (o *GetTaxTypeAccountsUnauthorized) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxTypeAccountsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTaxTypeAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetTaxTypeAccountsForbidden() *GetTaxTypeAccountsForbidden { return &GetTaxTypeAccountsForbidden{} } -/*GetTaxTypeAccountsForbidden handles this case with default header values. +/* GetTaxTypeAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetTaxTypeAccountsForbidden struct { func (o *GetTaxTypeAccountsForbidden) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsForbidden %+v", 403, o.Payload) } - func (o *GetTaxTypeAccountsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTaxTypeAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetTaxTypeAccountsNotFound() *GetTaxTypeAccountsNotFound { return &GetTaxTypeAccountsNotFound{} } -/*GetTaxTypeAccountsNotFound handles this case with default header values. +/* GetTaxTypeAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetTaxTypeAccountsNotFound struct { func (o *GetTaxTypeAccountsNotFound) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsNotFound %+v", 404, o.Payload) } - func (o *GetTaxTypeAccountsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTaxTypeAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetTaxTypeAccountsUnprocessableEntity() *GetTaxTypeAccountsUnprocessable return &GetTaxTypeAccountsUnprocessableEntity{} } -/*GetTaxTypeAccountsUnprocessableEntity handles this case with default header values. +/* GetTaxTypeAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetTaxTypeAccountsUnprocessableEntity struct { func (o *GetTaxTypeAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxTypeAccountsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTaxTypeAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetTaxTypeAccountsInternalServerError() *GetTaxTypeAccountsInternalServe return &GetTaxTypeAccountsInternalServerError{} } -/*GetTaxTypeAccountsInternalServerError handles this case with default header values. +/* GetTaxTypeAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetTaxTypeAccountsInternalServerError struct { func (o *GetTaxTypeAccountsInternalServerError) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxTypeAccountsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTaxTypeAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/tax_type_account/post_tax_type_accounts_parameters.go b/api/regs/regs_client/tax_type_account/post_tax_type_accounts_parameters.go index cb4c49b..c548024 100644 --- a/api/regs/regs_client/tax_type_account/post_tax_type_accounts_parameters.go +++ b/api/regs/regs_client/tax_type_account/post_tax_type_accounts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostTaxTypeAccountsParams creates a new PostTaxTypeAccountsParams object -// with the default values initialized. +// NewPostTaxTypeAccountsParams creates a new PostTaxTypeAccountsParams 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 NewPostTaxTypeAccountsParams() *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxTypeAccountsParamsWithTimeout creates a new PostTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxTypeAccountsParamsWithTimeout(timeout time.Duration) *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ - timeout: timeout, } } // NewPostTaxTypeAccountsParamsWithContext creates a new PostTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxTypeAccountsParamsWithContext(ctx context.Context) *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ - Context: ctx, } } // NewPostTaxTypeAccountsParamsWithHTTPClient creates a new PostTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxTypeAccountsParamsWithHTTPClient(client *http.Client) *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ HTTPClient: client, } } -/*PostTaxTypeAccountsParams contains all the parameters to send to the API endpoint -for the post tax type accounts operation typically these are written to a http.Request +/* PostTaxTypeAccountsParams contains all the parameters to send to the API endpoint + for the post tax type accounts operation. + + Typically these are written to a http.Request. */ type PostTaxTypeAccountsParams struct { - /*TaxTypeAccountRequest - A request with an array of Tax Type Account Objects + /* TaxTypeAccountRequest. + A request with an array of Tax Type Account Objects */ TaxTypeAccountRequest *regs_models.TaxTypeAccountRequest @@ -77,6 +76,21 @@ type PostTaxTypeAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxTypeAccountsParams) WithDefaults() *PostTaxTypeAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxTypeAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post tax type accounts params func (o *PostTaxTypeAccountsParams) WithTimeout(timeout time.Duration) *PostTaxTypeAccountsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxTypeAccountsParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.TaxTypeAccountRequest != nil { if err := r.SetBodyParam(o.TaxTypeAccountRequest); err != nil { return err diff --git a/api/regs/regs_client/tax_type_account/post_tax_type_accounts_responses.go b/api/regs/regs_client/tax_type_account/post_tax_type_accounts_responses.go index d51c1ec..2576b86 100644 --- a/api/regs/regs_client/tax_type_account/post_tax_type_accounts_responses.go +++ b/api/regs/regs_client/tax_type_account/post_tax_type_accounts_responses.go @@ -63,9 +63,8 @@ func (o *PostTaxTypeAccountsReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTaxTypeAccountsOK() *PostTaxTypeAccountsOK { return &PostTaxTypeAccountsOK{} } -/*PostTaxTypeAccountsOK handles this case with default header values. +/* PostTaxTypeAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Tax Type Account objects */ type PostTaxTypeAccountsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.TaxTypeAccountResponse } @@ -89,18 +87,25 @@ type PostTaxTypeAccountsOK struct { func (o *PostTaxTypeAccountsOK) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsOK %+v", 200, o.Payload) } - func (o *PostTaxTypeAccountsOK) GetPayload() *regs_models.TaxTypeAccountResponse { return o.Payload } func (o *PostTaxTypeAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.TaxTypeAccountResponse) @@ -117,7 +122,7 @@ func NewPostTaxTypeAccountsUnauthorized() *PostTaxTypeAccountsUnauthorized { return &PostTaxTypeAccountsUnauthorized{} } -/*PostTaxTypeAccountsUnauthorized handles this case with default header values. +/* PostTaxTypeAccountsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTaxTypeAccountsUnauthorized struct { func (o *PostTaxTypeAccountsUnauthorized) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxTypeAccountsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTaxTypeAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostTaxTypeAccountsForbidden() *PostTaxTypeAccountsForbidden { return &PostTaxTypeAccountsForbidden{} } -/*PostTaxTypeAccountsForbidden handles this case with default header values. +/* PostTaxTypeAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTaxTypeAccountsForbidden struct { func (o *PostTaxTypeAccountsForbidden) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsForbidden %+v", 403, o.Payload) } - func (o *PostTaxTypeAccountsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTaxTypeAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostTaxTypeAccountsNotFound() *PostTaxTypeAccountsNotFound { return &PostTaxTypeAccountsNotFound{} } -/*PostTaxTypeAccountsNotFound handles this case with default header values. +/* PostTaxTypeAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTaxTypeAccountsNotFound struct { func (o *PostTaxTypeAccountsNotFound) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsNotFound %+v", 404, o.Payload) } - func (o *PostTaxTypeAccountsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTaxTypeAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostTaxTypeAccountsUnprocessableEntity() *PostTaxTypeAccountsUnprocessab return &PostTaxTypeAccountsUnprocessableEntity{} } -/*PostTaxTypeAccountsUnprocessableEntity handles this case with default header values. +/* PostTaxTypeAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTaxTypeAccountsUnprocessableEntity struct { func (o *PostTaxTypeAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTaxTypeAccountsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTaxTypeAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostTaxTypeAccountsInternalServerError() *PostTaxTypeAccountsInternalSer return &PostTaxTypeAccountsInternalServerError{} } -/*PostTaxTypeAccountsInternalServerError handles this case with default header values. +/* PostTaxTypeAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTaxTypeAccountsInternalServerError struct { func (o *PostTaxTypeAccountsInternalServerError) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxTypeAccountsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTaxTypeAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/tax_type_account/put_tax_type_accounts_parameters.go b/api/regs/regs_client/tax_type_account/put_tax_type_accounts_parameters.go index b20295b..cddfb65 100644 --- a/api/regs/regs_client/tax_type_account/put_tax_type_accounts_parameters.go +++ b/api/regs/regs_client/tax_type_account/put_tax_type_accounts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutTaxTypeAccountsParams creates a new PutTaxTypeAccountsParams object -// with the default values initialized. +// NewPutTaxTypeAccountsParams creates a new PutTaxTypeAccountsParams 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 NewPutTaxTypeAccountsParams() *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPutTaxTypeAccountsParamsWithTimeout creates a new PutTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutTaxTypeAccountsParamsWithTimeout(timeout time.Duration) *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ - timeout: timeout, } } // NewPutTaxTypeAccountsParamsWithContext creates a new PutTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutTaxTypeAccountsParamsWithContext(ctx context.Context) *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ - Context: ctx, } } // NewPutTaxTypeAccountsParamsWithHTTPClient creates a new PutTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutTaxTypeAccountsParamsWithHTTPClient(client *http.Client) *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ HTTPClient: client, } } -/*PutTaxTypeAccountsParams contains all the parameters to send to the API endpoint -for the put tax type accounts operation typically these are written to a http.Request +/* PutTaxTypeAccountsParams contains all the parameters to send to the API endpoint + for the put tax type accounts operation. + + Typically these are written to a http.Request. */ type PutTaxTypeAccountsParams struct { - /*TaxTypeAccountRequest - A request with an array of Tax Type Account Objects + /* TaxTypeAccountRequest. + A request with an array of Tax Type Account Objects */ TaxTypeAccountRequest *regs_models.TaxTypeAccountRequest @@ -77,6 +76,21 @@ type PutTaxTypeAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTaxTypeAccountsParams) WithDefaults() *PutTaxTypeAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTaxTypeAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put tax type accounts params func (o *PutTaxTypeAccountsParams) WithTimeout(timeout time.Duration) *PutTaxTypeAccountsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutTaxTypeAccountsParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if o.TaxTypeAccountRequest != nil { if err := r.SetBodyParam(o.TaxTypeAccountRequest); err != nil { return err diff --git a/api/regs/regs_client/tax_type_account/put_tax_type_accounts_responses.go b/api/regs/regs_client/tax_type_account/put_tax_type_accounts_responses.go index 5ac801e..4259e57 100644 --- a/api/regs/regs_client/tax_type_account/put_tax_type_accounts_responses.go +++ b/api/regs/regs_client/tax_type_account/put_tax_type_accounts_responses.go @@ -63,9 +63,8 @@ func (o *PutTaxTypeAccountsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutTaxTypeAccountsOK() *PutTaxTypeAccountsOK { return &PutTaxTypeAccountsOK{} } -/*PutTaxTypeAccountsOK handles this case with default header values. +/* PutTaxTypeAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Tax Type Account objects */ type PutTaxTypeAccountsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.TaxTypeAccountResponse } @@ -89,18 +87,25 @@ type PutTaxTypeAccountsOK struct { func (o *PutTaxTypeAccountsOK) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsOK %+v", 200, o.Payload) } - func (o *PutTaxTypeAccountsOK) GetPayload() *regs_models.TaxTypeAccountResponse { return o.Payload } func (o *PutTaxTypeAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.TaxTypeAccountResponse) @@ -117,7 +122,7 @@ func NewPutTaxTypeAccountsUnauthorized() *PutTaxTypeAccountsUnauthorized { return &PutTaxTypeAccountsUnauthorized{} } -/*PutTaxTypeAccountsUnauthorized handles this case with default header values. +/* PutTaxTypeAccountsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutTaxTypeAccountsUnauthorized struct { func (o *PutTaxTypeAccountsUnauthorized) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsUnauthorized %+v", 401, o.Payload) } - func (o *PutTaxTypeAccountsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTaxTypeAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutTaxTypeAccountsForbidden() *PutTaxTypeAccountsForbidden { return &PutTaxTypeAccountsForbidden{} } -/*PutTaxTypeAccountsForbidden handles this case with default header values. +/* PutTaxTypeAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutTaxTypeAccountsForbidden struct { func (o *PutTaxTypeAccountsForbidden) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsForbidden %+v", 403, o.Payload) } - func (o *PutTaxTypeAccountsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTaxTypeAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutTaxTypeAccountsNotFound() *PutTaxTypeAccountsNotFound { return &PutTaxTypeAccountsNotFound{} } -/*PutTaxTypeAccountsNotFound handles this case with default header values. +/* PutTaxTypeAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutTaxTypeAccountsNotFound struct { func (o *PutTaxTypeAccountsNotFound) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsNotFound %+v", 404, o.Payload) } - func (o *PutTaxTypeAccountsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTaxTypeAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutTaxTypeAccountsUnprocessableEntity() *PutTaxTypeAccountsUnprocessable return &PutTaxTypeAccountsUnprocessableEntity{} } -/*PutTaxTypeAccountsUnprocessableEntity handles this case with default header values. +/* PutTaxTypeAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutTaxTypeAccountsUnprocessableEntity struct { func (o *PutTaxTypeAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutTaxTypeAccountsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTaxTypeAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutTaxTypeAccountsInternalServerError() *PutTaxTypeAccountsInternalServe return &PutTaxTypeAccountsInternalServerError{} } -/*PutTaxTypeAccountsInternalServerError handles this case with default header values. +/* PutTaxTypeAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutTaxTypeAccountsInternalServerError struct { func (o *PutTaxTypeAccountsInternalServerError) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsInternalServerError %+v", 500, o.Payload) } - func (o *PutTaxTypeAccountsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTaxTypeAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/tax_type_account/tax_type_account_client.go b/api/regs/regs_client/tax_type_account/tax_type_account_client.go index 7d065ac..db82938 100644 --- a/api/regs/regs_client/tax_type_account/tax_type_account_client.go +++ b/api/regs/regs_client/tax_type_account/tax_type_account_client.go @@ -29,15 +29,18 @@ type Client struct { 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 { - DeleteTypeAccounts(params *DeleteTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteTypeAccountsOK, error) + DeleteTypeAccounts(params *DeleteTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteTypeAccountsOK, error) - GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypeAccountsOK, error) + GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypeAccountsOK, error) - PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxTypeAccountsOK, error) + PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxTypeAccountsOK, error) - PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTaxTypeAccountsOK, error) + PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTaxTypeAccountsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete Taxnexus Tax Type Accounts */ -func (a *Client) DeleteTypeAccounts(params *DeleteTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteTypeAccountsOK, error) { +func (a *Client) DeleteTypeAccounts(params *DeleteTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteTypeAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteTypeAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteTypeAccounts", Method: "DELETE", PathPattern: "/taxtypeaccounts", @@ -65,7 +67,12 @@ func (a *Client) DeleteTypeAccounts(params *DeleteTypeAccountsParams, authInfo r 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteTypeAccounts(params *DeleteTypeAccountsParams, authInfo r Return a list of Tax Type Accounts */ -func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypeAccountsOK, error) { +func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypeAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxTypeAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxTypeAccounts", Method: "GET", PathPattern: "/taxtypeaccounts", @@ -102,7 +108,12 @@ func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo r 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 } @@ -121,13 +132,12 @@ func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo r Tax Type Accounts to be added */ -func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxTypeAccountsOK, error) { +func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxTypeAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxTypeAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxTypeAccounts", Method: "POST", PathPattern: "/taxtypeaccounts", @@ -139,7 +149,12 @@ func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo 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 } @@ -158,13 +173,12 @@ func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo Update Tax Type Accounts records */ -func (a *Client) PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTaxTypeAccountsOK, error) { +func (a *Client) PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTaxTypeAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutTaxTypeAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putTaxTypeAccounts", Method: "PUT", PathPattern: "/taxtypeaccounts", @@ -176,7 +190,12 @@ func (a *Client) PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo r 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 } diff --git a/api/regs/regs_client/transaction/get_transactions_parameters.go b/api/regs/regs_client/transaction/get_transactions_parameters.go index d56f3eb..9a57081 100644 --- a/api/regs/regs_client/transaction/get_transactions_parameters.go +++ b/api/regs/regs_client/transaction/get_transactions_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTransactionsParams creates a new GetTransactionsParams object -// with the default values initialized. +// NewGetTransactionsParams creates a new GetTransactionsParams 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 NewGetTransactionsParams() *GetTransactionsParams { - var () return &GetTransactionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTransactionsParamsWithTimeout creates a new GetTransactionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTransactionsParamsWithTimeout(timeout time.Duration) *GetTransactionsParams { - var () return &GetTransactionsParams{ - timeout: timeout, } } // NewGetTransactionsParamsWithContext creates a new GetTransactionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTransactionsParamsWithContext(ctx context.Context) *GetTransactionsParams { - var () return &GetTransactionsParams{ - Context: ctx, } } // NewGetTransactionsParamsWithHTTPClient creates a new GetTransactionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTransactionsParamsWithHTTPClient(client *http.Client) *GetTransactionsParams { - var () return &GetTransactionsParams{ HTTPClient: client, } } -/*GetTransactionsParams contains all the parameters to send to the API endpoint -for the get transactions operation typically these are written to a http.Request +/* GetTransactionsParams contains all the parameters to send to the API endpoint + for the get transactions operation. + + Typically these are written to a http.Request. */ type GetTransactionsParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TransactionID - Template ID + /* TransactionID. + + Template ID */ TransactionID *string @@ -86,6 +91,21 @@ type GetTransactionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionsParams) WithDefaults() *GetTransactionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get transactions params func (o *GetTransactionsParams) WithTimeout(timeout time.Duration) *GetTransactionsParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg strf // 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 o.TransactionID != nil { // query param transactionId var qrTransactionID string + if o.TransactionID != nil { qrTransactionID = *o.TransactionID } qTransactionID := qrTransactionID if qTransactionID != "" { + if err := r.SetQueryParam("transactionId", qTransactionID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/regs/regs_client/transaction/get_transactions_responses.go b/api/regs/regs_client/transaction/get_transactions_responses.go index 8ade714..ccd9a5e 100644 --- a/api/regs/regs_client/transaction/get_transactions_responses.go +++ b/api/regs/regs_client/transaction/get_transactions_responses.go @@ -63,9 +63,8 @@ func (o *GetTransactionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewGetTransactionsOK() *GetTransactionsOK { return &GetTransactionsOK{} } -/*GetTransactionsOK handles this case with default header values. +/* GetTransactionsOK describes a response with status code 200, with default header values. Taxnexus Response with Transaction objects */ type GetTransactionsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.TransactionResponse } @@ -89,18 +87,25 @@ type GetTransactionsOK struct { func (o *GetTransactionsOK) Error() string { return fmt.Sprintf("[GET /transactions][%d] getTransactionsOK %+v", 200, o.Payload) } - func (o *GetTransactionsOK) GetPayload() *regs_models.TransactionResponse { return o.Payload } func (o *GetTransactionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.TransactionResponse) @@ -117,7 +122,7 @@ func NewGetTransactionsUnauthorized() *GetTransactionsUnauthorized { return &GetTransactionsUnauthorized{} } -/*GetTransactionsUnauthorized handles this case with default header values. +/* GetTransactionsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type GetTransactionsUnauthorized struct { func (o *GetTransactionsUnauthorized) Error() string { return fmt.Sprintf("[GET /transactions][%d] getTransactionsUnauthorized %+v", 401, o.Payload) } - func (o *GetTransactionsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTransactionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewGetTransactionsForbidden() *GetTransactionsForbidden { return &GetTransactionsForbidden{} } -/*GetTransactionsForbidden handles this case with default header values. +/* GetTransactionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type GetTransactionsForbidden struct { func (o *GetTransactionsForbidden) Error() string { return fmt.Sprintf("[GET /transactions][%d] getTransactionsForbidden %+v", 403, o.Payload) } - func (o *GetTransactionsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTransactionsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewGetTransactionsNotFound() *GetTransactionsNotFound { return &GetTransactionsNotFound{} } -/*GetTransactionsNotFound handles this case with default header values. +/* GetTransactionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type GetTransactionsNotFound struct { func (o *GetTransactionsNotFound) Error() string { return fmt.Sprintf("[GET /transactions][%d] getTransactionsNotFound %+v", 404, o.Payload) } - func (o *GetTransactionsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTransactionsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewGetTransactionsUnprocessableEntity() *GetTransactionsUnprocessableEntity return &GetTransactionsUnprocessableEntity{} } -/*GetTransactionsUnprocessableEntity handles this case with default header values. +/* GetTransactionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type GetTransactionsUnprocessableEntity struct { func (o *GetTransactionsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /transactions][%d] getTransactionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTransactionsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTransactionsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewGetTransactionsInternalServerError() *GetTransactionsInternalServerError return &GetTransactionsInternalServerError{} } -/*GetTransactionsInternalServerError handles this case with default header values. +/* GetTransactionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type GetTransactionsInternalServerError struct { func (o *GetTransactionsInternalServerError) Error() string { return fmt.Sprintf("[GET /transactions][%d] getTransactionsInternalServerError %+v", 500, o.Payload) } - func (o *GetTransactionsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *GetTransactionsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/transaction/post_transactions_parameters.go b/api/regs/regs_client/transaction/post_transactions_parameters.go index af4b170..09b1399 100644 --- a/api/regs/regs_client/transaction/post_transactions_parameters.go +++ b/api/regs/regs_client/transaction/post_transactions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPostTransactionsParams creates a new PostTransactionsParams object -// with the default values initialized. +// NewPostTransactionsParams creates a new PostTransactionsParams 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 NewPostTransactionsParams() *PostTransactionsParams { - var () return &PostTransactionsParams{ - timeout: cr.DefaultTimeout, } } // NewPostTransactionsParamsWithTimeout creates a new PostTransactionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTransactionsParamsWithTimeout(timeout time.Duration) *PostTransactionsParams { - var () return &PostTransactionsParams{ - timeout: timeout, } } // NewPostTransactionsParamsWithContext creates a new PostTransactionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTransactionsParamsWithContext(ctx context.Context) *PostTransactionsParams { - var () return &PostTransactionsParams{ - Context: ctx, } } // NewPostTransactionsParamsWithHTTPClient creates a new PostTransactionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTransactionsParamsWithHTTPClient(client *http.Client) *PostTransactionsParams { - var () return &PostTransactionsParams{ HTTPClient: client, } } -/*PostTransactionsParams contains all the parameters to send to the API endpoint -for the post transactions operation typically these are written to a http.Request +/* PostTransactionsParams contains all the parameters to send to the API endpoint + for the post transactions operation. + + Typically these are written to a http.Request. */ type PostTransactionsParams struct { - /*TransactionRequest - An array of Transaction records + /* TransactionRequest. + An array of Transaction records */ TransactionRequest *regs_models.TransactionRequest @@ -77,6 +76,21 @@ type PostTransactionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTransactionsParams) WithDefaults() *PostTransactionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTransactionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post transactions params func (o *PostTransactionsParams) WithTimeout(timeout time.Duration) *PostTransactionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.TransactionRequest != nil { if err := r.SetBodyParam(o.TransactionRequest); err != nil { return err diff --git a/api/regs/regs_client/transaction/post_transactions_responses.go b/api/regs/regs_client/transaction/post_transactions_responses.go index 8a28d4b..6c52692 100644 --- a/api/regs/regs_client/transaction/post_transactions_responses.go +++ b/api/regs/regs_client/transaction/post_transactions_responses.go @@ -63,9 +63,8 @@ func (o *PostTransactionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPostTransactionsOK() *PostTransactionsOK { return &PostTransactionsOK{} } -/*PostTransactionsOK handles this case with default header values. +/* PostTransactionsOK describes a response with status code 200, with default header values. Taxnexus Response with Transaction objects */ type PostTransactionsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.TransactionResponse } @@ -89,18 +87,25 @@ type PostTransactionsOK struct { func (o *PostTransactionsOK) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionsOK %+v", 200, o.Payload) } - func (o *PostTransactionsOK) GetPayload() *regs_models.TransactionResponse { return o.Payload } func (o *PostTransactionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.TransactionResponse) @@ -117,7 +122,7 @@ func NewPostTransactionsUnauthorized() *PostTransactionsUnauthorized { return &PostTransactionsUnauthorized{} } -/*PostTransactionsUnauthorized handles this case with default header values. +/* PostTransactionsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PostTransactionsUnauthorized struct { func (o *PostTransactionsUnauthorized) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionsUnauthorized %+v", 401, o.Payload) } - func (o *PostTransactionsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTransactionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPostTransactionsForbidden() *PostTransactionsForbidden { return &PostTransactionsForbidden{} } -/*PostTransactionsForbidden handles this case with default header values. +/* PostTransactionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PostTransactionsForbidden struct { func (o *PostTransactionsForbidden) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionsForbidden %+v", 403, o.Payload) } - func (o *PostTransactionsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTransactionsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPostTransactionsNotFound() *PostTransactionsNotFound { return &PostTransactionsNotFound{} } -/*PostTransactionsNotFound handles this case with default header values. +/* PostTransactionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PostTransactionsNotFound struct { func (o *PostTransactionsNotFound) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionsNotFound %+v", 404, o.Payload) } - func (o *PostTransactionsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTransactionsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPostTransactionsUnprocessableEntity() *PostTransactionsUnprocessableEnti return &PostTransactionsUnprocessableEntity{} } -/*PostTransactionsUnprocessableEntity handles this case with default header values. +/* PostTransactionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PostTransactionsUnprocessableEntity struct { func (o *PostTransactionsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostTransactionsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTransactionsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPostTransactionsInternalServerError() *PostTransactionsInternalServerErr return &PostTransactionsInternalServerError{} } -/*PostTransactionsInternalServerError handles this case with default header values. +/* PostTransactionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PostTransactionsInternalServerError struct { func (o *PostTransactionsInternalServerError) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionsInternalServerError %+v", 500, o.Payload) } - func (o *PostTransactionsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PostTransactionsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/transaction/put_transactions_parameters.go b/api/regs/regs_client/transaction/put_transactions_parameters.go index 97948ef..5346c0f 100644 --- a/api/regs/regs_client/transaction/put_transactions_parameters.go +++ b/api/regs/regs_client/transaction/put_transactions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/regs/regs_models" ) -// NewPutTransactionsParams creates a new PutTransactionsParams object -// with the default values initialized. +// NewPutTransactionsParams creates a new PutTransactionsParams 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 NewPutTransactionsParams() *PutTransactionsParams { - var () return &PutTransactionsParams{ - timeout: cr.DefaultTimeout, } } // NewPutTransactionsParamsWithTimeout creates a new PutTransactionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutTransactionsParamsWithTimeout(timeout time.Duration) *PutTransactionsParams { - var () return &PutTransactionsParams{ - timeout: timeout, } } // NewPutTransactionsParamsWithContext creates a new PutTransactionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutTransactionsParamsWithContext(ctx context.Context) *PutTransactionsParams { - var () return &PutTransactionsParams{ - Context: ctx, } } // NewPutTransactionsParamsWithHTTPClient creates a new PutTransactionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutTransactionsParamsWithHTTPClient(client *http.Client) *PutTransactionsParams { - var () return &PutTransactionsParams{ HTTPClient: client, } } -/*PutTransactionsParams contains all the parameters to send to the API endpoint -for the put transactions operation typically these are written to a http.Request +/* PutTransactionsParams contains all the parameters to send to the API endpoint + for the put transactions operation. + + Typically these are written to a http.Request. */ type PutTransactionsParams struct { - /*TransactionRequest - An array of Transaction records + /* TransactionRequest. + An array of Transaction records */ TransactionRequest *regs_models.TransactionRequest @@ -77,6 +76,21 @@ type PutTransactionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTransactionsParams) WithDefaults() *PutTransactionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put transactions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTransactionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put transactions params func (o *PutTransactionsParams) WithTimeout(timeout time.Duration) *PutTransactionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.TransactionRequest != nil { if err := r.SetBodyParam(o.TransactionRequest); err != nil { return err diff --git a/api/regs/regs_client/transaction/put_transactions_responses.go b/api/regs/regs_client/transaction/put_transactions_responses.go index 1bc8ffa..f66e5b0 100644 --- a/api/regs/regs_client/transaction/put_transactions_responses.go +++ b/api/regs/regs_client/transaction/put_transactions_responses.go @@ -63,9 +63,8 @@ func (o *PutTransactionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,14 +73,13 @@ func NewPutTransactionsOK() *PutTransactionsOK { return &PutTransactionsOK{} } -/*PutTransactionsOK handles this case with default header values. +/* PutTransactionsOK describes a response with status code 200, with default header values. Taxnexus Response with Transaction objects */ type PutTransactionsOK struct { AccessControlAllowOrigin string - - CacheControl string + CacheControl string Payload *regs_models.TransactionResponse } @@ -89,18 +87,25 @@ type PutTransactionsOK struct { func (o *PutTransactionsOK) Error() string { return fmt.Sprintf("[PUT /transactions][%d] putTransactionsOK %+v", 200, o.Payload) } - func (o *PutTransactionsOK) GetPayload() *regs_models.TransactionResponse { return o.Payload } func (o *PutTransactionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Cache-Control + hdrCacheControl := response.GetHeader("Cache-Control") + + if hdrCacheControl != "" { + o.CacheControl = hdrCacheControl + } o.Payload = new(regs_models.TransactionResponse) @@ -117,7 +122,7 @@ func NewPutTransactionsUnauthorized() *PutTransactionsUnauthorized { return &PutTransactionsUnauthorized{} } -/*PutTransactionsUnauthorized handles this case with default header values. +/* PutTransactionsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -130,15 +135,18 @@ type PutTransactionsUnauthorized struct { func (o *PutTransactionsUnauthorized) Error() string { return fmt.Sprintf("[PUT /transactions][%d] putTransactionsUnauthorized %+v", 401, o.Payload) } - func (o *PutTransactionsUnauthorized) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTransactionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -155,7 +163,7 @@ func NewPutTransactionsForbidden() *PutTransactionsForbidden { return &PutTransactionsForbidden{} } -/*PutTransactionsForbidden handles this case with default header values. +/* PutTransactionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -168,15 +176,18 @@ type PutTransactionsForbidden struct { func (o *PutTransactionsForbidden) Error() string { return fmt.Sprintf("[PUT /transactions][%d] putTransactionsForbidden %+v", 403, o.Payload) } - func (o *PutTransactionsForbidden) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTransactionsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -193,7 +204,7 @@ func NewPutTransactionsNotFound() *PutTransactionsNotFound { return &PutTransactionsNotFound{} } -/*PutTransactionsNotFound handles this case with default header values. +/* PutTransactionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -206,15 +217,18 @@ type PutTransactionsNotFound struct { func (o *PutTransactionsNotFound) Error() string { return fmt.Sprintf("[PUT /transactions][%d] putTransactionsNotFound %+v", 404, o.Payload) } - func (o *PutTransactionsNotFound) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTransactionsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -231,7 +245,7 @@ func NewPutTransactionsUnprocessableEntity() *PutTransactionsUnprocessableEntity return &PutTransactionsUnprocessableEntity{} } -/*PutTransactionsUnprocessableEntity handles this case with default header values. +/* PutTransactionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -244,15 +258,18 @@ type PutTransactionsUnprocessableEntity struct { func (o *PutTransactionsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /transactions][%d] putTransactionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutTransactionsUnprocessableEntity) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTransactionsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) @@ -269,7 +286,7 @@ func NewPutTransactionsInternalServerError() *PutTransactionsInternalServerError return &PutTransactionsInternalServerError{} } -/*PutTransactionsInternalServerError handles this case with default header values. +/* PutTransactionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -282,15 +299,18 @@ type PutTransactionsInternalServerError struct { func (o *PutTransactionsInternalServerError) Error() string { return fmt.Sprintf("[PUT /transactions][%d] putTransactionsInternalServerError %+v", 500, o.Payload) } - func (o *PutTransactionsInternalServerError) GetPayload() *regs_models.Error { return o.Payload } func (o *PutTransactionsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(regs_models.Error) diff --git a/api/regs/regs_client/transaction/transaction_client.go b/api/regs/regs_client/transaction/transaction_client.go index 0c9b73c..f4c30e4 100644 --- a/api/regs/regs_client/transaction/transaction_client.go +++ b/api/regs/regs_client/transaction/transaction_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransactionsOK, error) + GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransactionsOK, error) - PostTransactions(params *PostTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTransactionsOK, error) + PostTransactions(params *PostTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTransactionsOK, error) - PutTransactions(params *PutTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTransactionsOK, error) + PutTransactions(params *PutTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTransactionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Transaction records from the datastore */ -func (a *Client) GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTransactionsOK, error) { +func (a *Client) GetTransactions(params *GetTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTransactionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTransactionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTransactions", Method: "GET", PathPattern: "/transactions", @@ -63,7 +65,12 @@ func (a *Client) GetTransactions(params *GetTransactionsParams, authInfo runtime 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 } @@ -82,13 +89,12 @@ func (a *Client) GetTransactions(params *GetTransactionsParams, authInfo runtime Create Transactions in Taxnexus */ -func (a *Client) PostTransactions(params *PostTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTransactionsOK, error) { +func (a *Client) PostTransactions(params *PostTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTransactionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTransactionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTransactions", Method: "POST", PathPattern: "/transactions", @@ -100,7 +106,12 @@ func (a *Client) PostTransactions(params *PostTransactionsParams, authInfo runti 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 } @@ -119,13 +130,12 @@ func (a *Client) PostTransactions(params *PostTransactionsParams, authInfo runti Update Transactions in Taxnexus */ -func (a *Client) PutTransactions(params *PutTransactionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTransactionsOK, error) { +func (a *Client) PutTransactions(params *PutTransactionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTransactionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutTransactionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putTransactions", Method: "PUT", PathPattern: "/transactions", @@ -137,7 +147,12 @@ func (a *Client) PutTransactions(params *PutTransactionsParams, authInfo runtime 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 } diff --git a/api/regs/regs_models/authority.go b/api/regs/regs_models/authority.go index b6a54cb..80dca89 100644 --- a/api/regs/regs_models/authority.go +++ b/api/regs/regs_models/authority.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -115,6 +117,11 @@ func (m *Authority) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this authority based on context it is used +func (m *Authority) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Authority) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/authority_request.go b/api/regs/regs_models/authority_request.go index 73f90fb..7faaf09 100644 --- a/api/regs/regs_models/authority_request.go +++ b/api/regs/regs_models/authority_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *AuthorityRequest) Validate(formats strfmt.Registry) error { } func (m *AuthorityRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *AuthorityRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this authority request based on the context it is used +func (m *AuthorityRequest) 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 *AuthorityRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *AuthorityRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/authority_response.go b/api/regs/regs_models/authority_response.go index 7f78475..180394b 100644 --- a/api/regs/regs_models/authority_response.go +++ b/api/regs/regs_models/authority_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AuthorityResponse) Validate(formats strfmt.Registry) error { } func (m *AuthorityResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AuthorityResponse) validateData(formats strfmt.Registry) error { } func (m *AuthorityResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AuthorityResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this authority response based on the context it is used +func (m *AuthorityResponse) 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 *AuthorityResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AuthorityResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AuthorityResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/backend.go b/api/regs/regs_models/backend.go index c7ed807..1cb659a 100644 --- a/api/regs/regs_models/backend.go +++ b/api/regs/regs_models/backend.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -136,6 +138,11 @@ func (m *Backend) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this backend based on context it is used +func (m *Backend) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Backend) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/backend_request.go b/api/regs/regs_models/backend_request.go index 8f63d7d..49a903f 100644 --- a/api/regs/regs_models/backend_request.go +++ b/api/regs/regs_models/backend_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *BackendRequest) Validate(formats strfmt.Registry) error { } func (m *BackendRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *BackendRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this backend request based on the context it is used +func (m *BackendRequest) 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 *BackendRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *BackendRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/backend_response.go b/api/regs/regs_models/backend_response.go index dff39d7..d8087f2 100644 --- a/api/regs/regs_models/backend_response.go +++ b/api/regs/regs_models/backend_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *BackendResponse) Validate(formats strfmt.Registry) error { } func (m *BackendResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *BackendResponse) validateData(formats strfmt.Registry) error { } func (m *BackendResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *BackendResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this backend response based on the context it is used +func (m *BackendResponse) 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 *BackendResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *BackendResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *BackendResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/delete_response.go b/api/regs/regs_models/delete_response.go index a799f9c..0b44f8a 100644 --- a/api/regs/regs_models/delete_response.go +++ b/api/regs/regs_models/delete_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DeleteResponse) Validate(formats strfmt.Registry) error { } func (m *DeleteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DeleteResponse) validateData(formats strfmt.Registry) error { } func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DeleteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this delete response based on the context it is used +func (m *DeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeleteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DeleteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DeleteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/error.go b/api/regs/regs_models/error.go index ff68365..9802c13 100644 --- a/api/regs/regs_models/error.go +++ b/api/regs/regs_models/error.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing.go b/api/regs/regs_models/filing.go index 10e5c81..caadee7 100644 --- a/api/regs/regs_models/filing.go +++ b/api/regs/regs_models/filing.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -151,6 +153,11 @@ func (m *Filing) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this filing based on context it is used +func (m *Filing) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Filing) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing_request.go b/api/regs/regs_models/filing_request.go index 74e2c7f..0962956 100644 --- a/api/regs/regs_models/filing_request.go +++ b/api/regs/regs_models/filing_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *FilingRequest) Validate(formats strfmt.Registry) error { } func (m *FilingRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *FilingRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing request based on the context it is used +func (m *FilingRequest) 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 *FilingRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing_response.go b/api/regs/regs_models/filing_response.go index e5bda04..25abb21 100644 --- a/api/regs/regs_models/filing_response.go +++ b/api/regs/regs_models/filing_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *FilingResponse) Validate(formats strfmt.Registry) error { } func (m *FilingResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *FilingResponse) validateData(formats strfmt.Registry) error { } func (m *FilingResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *FilingResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing response based on the context it is used +func (m *FilingResponse) 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 *FilingResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing_schedule_item.go b/api/regs/regs_models/filing_schedule_item.go index 0a4dbd5..3bf9956 100644 --- a/api/regs/regs_models/filing_schedule_item.go +++ b/api/regs/regs_models/filing_schedule_item.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *FilingScheduleItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this filing schedule item based on context it is used +func (m *FilingScheduleItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *FilingScheduleItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing_type.go b/api/regs/regs_models/filing_type.go index 7bf8f00..08816ad 100644 --- a/api/regs/regs_models/filing_type.go +++ b/api/regs/regs_models/filing_type.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -117,7 +118,6 @@ func (m *FilingType) Validate(formats strfmt.Registry) error { } func (m *FilingType) validateDueDates(formats strfmt.Registry) error { - if swag.IsZero(m.DueDates) { // not required return nil } @@ -142,7 +142,6 @@ func (m *FilingType) validateDueDates(formats strfmt.Registry) error { } func (m *FilingType) validateInstances(formats strfmt.Registry) error { - if swag.IsZero(m.Instances) { // not required return nil } @@ -166,6 +165,60 @@ func (m *FilingType) validateInstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing type based on the context it is used +func (m *FilingType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDueDates(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilingType) contextValidateDueDates(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DueDates); i++ { + + if m.DueDates[i] != nil { + if err := m.DueDates[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("DueDates" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingType) contextValidateInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Instances); i++ { + + if m.Instances[i] != nil { + if err := m.Instances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Instances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing_type_instance.go b/api/regs/regs_models/filing_type_instance.go index d2d9fd3..9824d17 100644 --- a/api/regs/regs_models/filing_type_instance.go +++ b/api/regs/regs_models/filing_type_instance.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -43,6 +45,11 @@ func (m *FilingTypeInstance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this filing type instance based on context it is used +func (m *FilingTypeInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *FilingTypeInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing_type_request.go b/api/regs/regs_models/filing_type_request.go index fd7a371..98c46b9 100644 --- a/api/regs/regs_models/filing_type_request.go +++ b/api/regs/regs_models/filing_type_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *FilingTypeRequest) Validate(formats strfmt.Registry) error { } func (m *FilingTypeRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *FilingTypeRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing type request based on the context it is used +func (m *FilingTypeRequest) 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 *FilingTypeRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingTypeRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/filing_type_response.go b/api/regs/regs_models/filing_type_response.go index 5e6efb8..87ee2c6 100644 --- a/api/regs/regs_models/filing_type_response.go +++ b/api/regs/regs_models/filing_type_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *FilingTypeResponse) Validate(formats strfmt.Registry) error { } func (m *FilingTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *FilingTypeResponse) validateData(formats strfmt.Registry) error { } func (m *FilingTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *FilingTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing type response based on the context it is used +func (m *FilingTypeResponse) 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 *FilingTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/geo_license_type_instance.go b/api/regs/regs_models/geo_license_type_instance.go index d91492b..1caef14 100644 --- a/api/regs/regs_models/geo_license_type_instance.go +++ b/api/regs/regs_models/geo_license_type_instance.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *GeoLicenseTypeInstance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this geo license type instance based on context it is used +func (m *GeoLicenseTypeInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GeoLicenseTypeInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/invalid_error.go b/api/regs/regs_models/invalid_error.go index 828dfdc..f8f09e6 100644 --- a/api/regs/regs_models/invalid_error.go +++ b/api/regs/regs_models/invalid_error.go @@ -10,6 +10,8 @@ package regs_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/license.go b/api/regs/regs_models/license.go index 285d1de..170a360 100644 --- a/api/regs/regs_models/license.go +++ b/api/regs/regs_models/license.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -85,6 +87,11 @@ func (m *License) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this license based on context it is used +func (m *License) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *License) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/license_request.go b/api/regs/regs_models/license_request.go index f7223c2..5147ed9 100644 --- a/api/regs/regs_models/license_request.go +++ b/api/regs/regs_models/license_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *LicenseRequest) Validate(formats strfmt.Registry) error { } func (m *LicenseRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *LicenseRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license request based on the context it is used +func (m *LicenseRequest) 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 *LicenseRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/license_response.go b/api/regs/regs_models/license_response.go index 246b754..a11beb8 100644 --- a/api/regs/regs_models/license_response.go +++ b/api/regs/regs_models/license_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LicenseResponse) Validate(formats strfmt.Registry) error { } func (m *LicenseResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LicenseResponse) validateData(formats strfmt.Registry) error { } func (m *LicenseResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LicenseResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license response based on the context it is used +func (m *LicenseResponse) 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 *LicenseResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LicenseResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/license_type.go b/api/regs/regs_models/license_type.go index d66902c..bd38533 100644 --- a/api/regs/regs_models/license_type.go +++ b/api/regs/regs_models/license_type.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -98,7 +99,6 @@ func (m *LicenseType) Validate(formats strfmt.Registry) error { } func (m *LicenseType) validateJurisdictions(formats strfmt.Registry) error { - if swag.IsZero(m.Jurisdictions) { // not required return nil } @@ -122,6 +122,38 @@ func (m *LicenseType) validateJurisdictions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license type based on the context it is used +func (m *LicenseType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateJurisdictions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LicenseType) contextValidateJurisdictions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Jurisdictions); i++ { + + if m.Jurisdictions[i] != nil { + if err := m.Jurisdictions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Jurisdictions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/license_type_request.go b/api/regs/regs_models/license_type_request.go index 83c4e12..98e890c 100644 --- a/api/regs/regs_models/license_type_request.go +++ b/api/regs/regs_models/license_type_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *LicenseTypeRequest) Validate(formats strfmt.Registry) error { } func (m *LicenseTypeRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *LicenseTypeRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license type request based on the context it is used +func (m *LicenseTypeRequest) 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 *LicenseTypeRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseTypeRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/license_type_response.go b/api/regs/regs_models/license_type_response.go index 65e96d2..c77472b 100644 --- a/api/regs/regs_models/license_type_response.go +++ b/api/regs/regs_models/license_type_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LicenseTypeResponse) Validate(formats strfmt.Registry) error { } func (m *LicenseTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LicenseTypeResponse) validateData(formats strfmt.Registry) error { } func (m *LicenseTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LicenseTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license type response based on the context it is used +func (m *LicenseTypeResponse) 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 *LicenseTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LicenseTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/message.go b/api/regs/regs_models/message.go index e05012c..0f0f398 100644 --- a/api/regs/regs_models/message.go +++ b/api/regs/regs_models/message.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/notebook.go b/api/regs/regs_models/notebook.go index 8e34cc0..4a40ce0 100644 --- a/api/regs/regs_models/notebook.go +++ b/api/regs/regs_models/notebook.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -89,7 +90,6 @@ func (m *Notebook) Validate(formats strfmt.Registry) error { } func (m *Notebook) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -113,6 +113,38 @@ func (m *Notebook) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this notebook based on the context it is used +func (m *Notebook) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Notebook) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Notebook) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/notebook_item.go b/api/regs/regs_models/notebook_item.go index 448934c..cc0ab2c 100644 --- a/api/regs/regs_models/notebook_item.go +++ b/api/regs/regs_models/notebook_item.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *NotebookItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this notebook item based on context it is used +func (m *NotebookItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NotebookItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/notebook_request.go b/api/regs/regs_models/notebook_request.go index 1cdfd33..386a9c9 100644 --- a/api/regs/regs_models/notebook_request.go +++ b/api/regs/regs_models/notebook_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *NotebookRequest) Validate(formats strfmt.Registry) error { } func (m *NotebookRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *NotebookRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this notebook request based on the context it is used +func (m *NotebookRequest) 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 *NotebookRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NotebookRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/notebook_response.go b/api/regs/regs_models/notebook_response.go index d2f890c..cc5ec5a 100644 --- a/api/regs/regs_models/notebook_response.go +++ b/api/regs/regs_models/notebook_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *NotebookResponse) Validate(formats strfmt.Registry) error { } func (m *NotebookResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *NotebookResponse) validateData(formats strfmt.Registry) error { } func (m *NotebookResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *NotebookResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this notebook response based on the context it is used +func (m *NotebookResponse) 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 *NotebookResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NotebookResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *NotebookResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/pagination.go b/api/regs/regs_models/pagination.go index c3b0cce..2138117 100644 --- a/api/regs/regs_models/pagination.go +++ b/api/regs/regs_models/pagination.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/rating_engine.go b/api/regs/regs_models/rating_engine.go index a56c82c..db36b42 100644 --- a/api/regs/regs_models/rating_engine.go +++ b/api/regs/regs_models/rating_engine.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -65,7 +66,6 @@ func (m *RatingEngine) Validate(formats strfmt.Registry) error { } func (m *RatingEngine) validateRules(formats strfmt.Registry) error { - if swag.IsZero(m.Rules) { // not required return nil } @@ -89,6 +89,38 @@ func (m *RatingEngine) validateRules(formats strfmt.Registry) error { return nil } +// ContextValidate validate this rating engine based on the context it is used +func (m *RatingEngine) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RatingEngine) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *RatingEngine) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/rating_engine_item.go b/api/regs/regs_models/rating_engine_item.go index fa33792..249df2b 100644 --- a/api/regs/regs_models/rating_engine_item.go +++ b/api/regs/regs_models/rating_engine_item.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -55,6 +57,11 @@ func (m *RatingEngineItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this rating engine item based on context it is used +func (m *RatingEngineItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RatingEngineItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/rating_engine_request.go b/api/regs/regs_models/rating_engine_request.go index dc9e34c..9739f9e 100644 --- a/api/regs/regs_models/rating_engine_request.go +++ b/api/regs/regs_models/rating_engine_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *RatingEngineRequest) Validate(formats strfmt.Registry) error { } func (m *RatingEngineRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *RatingEngineRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this rating engine request based on the context it is used +func (m *RatingEngineRequest) 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 *RatingEngineRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *RatingEngineRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/rating_engine_response.go b/api/regs/regs_models/rating_engine_response.go index 7c6db5d..79f2582 100644 --- a/api/regs/regs_models/rating_engine_response.go +++ b/api/regs/regs_models/rating_engine_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *RatingEngineResponse) Validate(formats strfmt.Registry) error { } func (m *RatingEngineResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *RatingEngineResponse) validateData(formats strfmt.Registry) error { } func (m *RatingEngineResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *RatingEngineResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this rating engine response based on the context it is used +func (m *RatingEngineResponse) 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 *RatingEngineResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RatingEngineResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *RatingEngineResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/request_meta.go b/api/regs/regs_models/request_meta.go index e881f17..bde965f 100644 --- a/api/regs/regs_models/request_meta.go +++ b/api/regs/regs_models/request_meta.go @@ -10,6 +10,8 @@ package regs_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/response_meta.go b/api/regs/regs_models/response_meta.go index ece1dda..fa68f44 100644 --- a/api/regs/regs_models/response_meta.go +++ b/api/regs/regs_models/response_meta.go @@ -10,6 +10,8 @@ package regs_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/submission.go b/api/regs/regs_models/submission.go index 89e7807..4834897 100644 --- a/api/regs/regs_models/submission.go +++ b/api/regs/regs_models/submission.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -103,6 +105,11 @@ func (m *Submission) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this submission based on context it is used +func (m *Submission) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Submission) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/submission_request.go b/api/regs/regs_models/submission_request.go index a7dce88..3822891 100644 --- a/api/regs/regs_models/submission_request.go +++ b/api/regs/regs_models/submission_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *SubmissionRequest) Validate(formats strfmt.Registry) error { } func (m *SubmissionRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *SubmissionRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this submission request based on the context it is used +func (m *SubmissionRequest) 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 *SubmissionRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *SubmissionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/submission_response.go b/api/regs/regs_models/submission_response.go index a3b735e..a384c66 100644 --- a/api/regs/regs_models/submission_response.go +++ b/api/regs/regs_models/submission_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SubmissionResponse) Validate(formats strfmt.Registry) error { } func (m *SubmissionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SubmissionResponse) validateData(formats strfmt.Registry) error { } func (m *SubmissionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SubmissionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this submission response based on the context it is used +func (m *SubmissionResponse) 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 *SubmissionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SubmissionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SubmissionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/tax_type_account.go b/api/regs/regs_models/tax_type_account.go index ad1310d..6ec68ae 100644 --- a/api/regs/regs_models/tax_type_account.go +++ b/api/regs/regs_models/tax_type_account.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -124,6 +126,11 @@ func (m *TaxTypeAccount) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax type account based on context it is used +func (m *TaxTypeAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeAccount) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/tax_type_account_request.go b/api/regs/regs_models/tax_type_account_request.go index 36151b6..1848ea8 100644 --- a/api/regs/regs_models/tax_type_account_request.go +++ b/api/regs/regs_models/tax_type_account_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *TaxTypeAccountRequest) Validate(formats strfmt.Registry) error { } func (m *TaxTypeAccountRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *TaxTypeAccountRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax type account request based on the context it is used +func (m *TaxTypeAccountRequest) 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 *TaxTypeAccountRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeAccountRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/tax_type_account_response.go b/api/regs/regs_models/tax_type_account_response.go index 9b30c3e..df57cc3 100644 --- a/api/regs/regs_models/tax_type_account_response.go +++ b/api/regs/regs_models/tax_type_account_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxTypeAccountResponse) Validate(formats strfmt.Registry) error { } func (m *TaxTypeAccountResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxTypeAccountResponse) validateData(formats strfmt.Registry) error { } func (m *TaxTypeAccountResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxTypeAccountResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax type account response based on the context it is used +func (m *TaxTypeAccountResponse) 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 *TaxTypeAccountResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxTypeAccountResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeAccountResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/transaction.go b/api/regs/regs_models/transaction.go index 75a4787..7f75b48 100644 --- a/api/regs/regs_models/transaction.go +++ b/api/regs/regs_models/transaction.go @@ -10,6 +10,8 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -55,6 +57,11 @@ func (m *Transaction) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this transaction based on context it is used +func (m *Transaction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Transaction) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/transaction_request.go b/api/regs/regs_models/transaction_request.go index 6bde796..6e0d46f 100644 --- a/api/regs/regs_models/transaction_request.go +++ b/api/regs/regs_models/transaction_request.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *TransactionRequest) Validate(formats strfmt.Registry) error { } func (m *TransactionRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -65,6 +65,38 @@ func (m *TransactionRequest) validateData(formats strfmt.Registry) error { return nil } +// ContextValidate validate this transaction request based on the context it is used +func (m *TransactionRequest) 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 *TransactionRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/regs/regs_models/transaction_response.go b/api/regs/regs_models/transaction_response.go index 7879a5d..5cf1967 100644 --- a/api/regs/regs_models/transaction_response.go +++ b/api/regs/regs_models/transaction_response.go @@ -10,6 +10,7 @@ package regs_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TransactionResponse) Validate(formats strfmt.Registry) error { } func (m *TransactionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TransactionResponse) validateData(formats strfmt.Registry) error { } func (m *TransactionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TransactionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this transaction response based on the context it is used +func (m *TransactionResponse) 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 *TransactionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TransactionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TransactionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/render/render_client/account/account_client.go b/api/render/render_client/account/account_client.go index 3f0a3b9..a434e3e 100644 --- a/api/render/render_client/account/account_client.go +++ b/api/render/render_client/account/account_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetRenderAccountIQ(params *GetRenderAccountIQParams, authInfo runtime.ClientAuthInfoWriter) (*GetRenderAccountIQOK, error) + GetRenderAccountIQ(params *GetRenderAccountIQParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRenderAccountIQOK, error) - GetRenderAccountPandL(params *GetRenderAccountPandLParams, authInfo runtime.ClientAuthInfoWriter) (*GetRenderAccountPandLOK, error) + GetRenderAccountPandL(params *GetRenderAccountPandLParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRenderAccountPandLOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Generate Taxnexus IQ PDF from an Account ID */ -func (a *Client) GetRenderAccountIQ(params *GetRenderAccountIQParams, authInfo runtime.ClientAuthInfoWriter) (*GetRenderAccountIQOK, error) { +func (a *Client) GetRenderAccountIQ(params *GetRenderAccountIQParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRenderAccountIQOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRenderAccountIQParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRenderAccountIQ", Method: "GET", PathPattern: "/accounts/iq", @@ -61,7 +63,12 @@ func (a *Client) GetRenderAccountIQ(params *GetRenderAccountIQParams, authInfo r 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 } @@ -80,13 +87,12 @@ func (a *Client) GetRenderAccountIQ(params *GetRenderAccountIQParams, authInfo r Generate Profit and Loss PDF from an Account ID */ -func (a *Client) GetRenderAccountPandL(params *GetRenderAccountPandLParams, authInfo runtime.ClientAuthInfoWriter) (*GetRenderAccountPandLOK, error) { +func (a *Client) GetRenderAccountPandL(params *GetRenderAccountPandLParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRenderAccountPandLOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRenderAccountPandLParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRenderAccountPandL", Method: "GET", PathPattern: "/accounts/profitloss", @@ -98,7 +104,12 @@ func (a *Client) GetRenderAccountPandL(params *GetRenderAccountPandLParams, auth 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 } diff --git a/api/render/render_client/account/get_render_account_i_q_parameters.go b/api/render/render_client/account/get_render_account_i_q_parameters.go index 9cc9ab7..41dc594 100644 --- a/api/render/render_client/account/get_render_account_i_q_parameters.go +++ b/api/render/render_client/account/get_render_account_i_q_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetRenderAccountIQParams creates a new GetRenderAccountIQParams object -// with the default values initialized. +// NewGetRenderAccountIQParams creates a new GetRenderAccountIQParams 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 NewGetRenderAccountIQParams() *GetRenderAccountIQParams { - var () return &GetRenderAccountIQParams{ - timeout: cr.DefaultTimeout, } } // NewGetRenderAccountIQParamsWithTimeout creates a new GetRenderAccountIQParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetRenderAccountIQParamsWithTimeout(timeout time.Duration) *GetRenderAccountIQParams { - var () return &GetRenderAccountIQParams{ - timeout: timeout, } } // NewGetRenderAccountIQParamsWithContext creates a new GetRenderAccountIQParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetRenderAccountIQParamsWithContext(ctx context.Context) *GetRenderAccountIQParams { - var () return &GetRenderAccountIQParams{ - Context: ctx, } } // NewGetRenderAccountIQParamsWithHTTPClient creates a new GetRenderAccountIQParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetRenderAccountIQParamsWithHTTPClient(client *http.Client) *GetRenderAccountIQParams { - var () return &GetRenderAccountIQParams{ HTTPClient: client, } } -/*GetRenderAccountIQParams contains all the parameters to send to the API endpoint -for the get render account i q operation typically these are written to a http.Request +/* GetRenderAccountIQParams contains all the parameters to send to the API endpoint + for the get render account i q operation. + + Typically these are written to a http.Request. */ type GetRenderAccountIQParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID string @@ -75,6 +74,21 @@ type GetRenderAccountIQParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get render account i q params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRenderAccountIQParams) WithDefaults() *GetRenderAccountIQParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get render account i q params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRenderAccountIQParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get render account i q params func (o *GetRenderAccountIQParams) WithTimeout(timeout time.Duration) *GetRenderAccountIQParams { o.SetTimeout(timeout) @@ -131,6 +145,7 @@ func (o *GetRenderAccountIQParams) WriteToRequest(r runtime.ClientRequest, reg s qrAccountID := o.AccountID qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } diff --git a/api/render/render_client/account/get_render_account_i_q_responses.go b/api/render/render_client/account/get_render_account_i_q_responses.go index 2a8bc97..40ea87f 100644 --- a/api/render/render_client/account/get_render_account_i_q_responses.go +++ b/api/render/render_client/account/get_render_account_i_q_responses.go @@ -63,9 +63,8 @@ func (o *GetRenderAccountIQReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetRenderAccountIQOK() *GetRenderAccountIQOK { return &GetRenderAccountIQOK{} } -/*GetRenderAccountIQOK handles this case with default header values. +/* GetRenderAccountIQOK describes a response with status code 200, with default header values. Rendered documents response */ @@ -87,15 +86,18 @@ type GetRenderAccountIQOK struct { func (o *GetRenderAccountIQOK) Error() string { return fmt.Sprintf("[GET /accounts/iq][%d] getRenderAccountIQOK %+v", 200, o.Payload) } - func (o *GetRenderAccountIQOK) GetPayload() *render_models.DocumentResponse { return o.Payload } func (o *GetRenderAccountIQOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.DocumentResponse) @@ -112,7 +114,7 @@ func NewGetRenderAccountIQUnauthorized() *GetRenderAccountIQUnauthorized { return &GetRenderAccountIQUnauthorized{} } -/*GetRenderAccountIQUnauthorized handles this case with default header values. +/* GetRenderAccountIQUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type GetRenderAccountIQUnauthorized struct { func (o *GetRenderAccountIQUnauthorized) Error() string { return fmt.Sprintf("[GET /accounts/iq][%d] getRenderAccountIQUnauthorized %+v", 401, o.Payload) } - func (o *GetRenderAccountIQUnauthorized) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountIQUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -150,7 +155,7 @@ func NewGetRenderAccountIQForbidden() *GetRenderAccountIQForbidden { return &GetRenderAccountIQForbidden{} } -/*GetRenderAccountIQForbidden handles this case with default header values. +/* GetRenderAccountIQForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type GetRenderAccountIQForbidden struct { func (o *GetRenderAccountIQForbidden) Error() string { return fmt.Sprintf("[GET /accounts/iq][%d] getRenderAccountIQForbidden %+v", 403, o.Payload) } - func (o *GetRenderAccountIQForbidden) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountIQForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -188,7 +196,7 @@ func NewGetRenderAccountIQNotFound() *GetRenderAccountIQNotFound { return &GetRenderAccountIQNotFound{} } -/*GetRenderAccountIQNotFound handles this case with default header values. +/* GetRenderAccountIQNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type GetRenderAccountIQNotFound struct { func (o *GetRenderAccountIQNotFound) Error() string { return fmt.Sprintf("[GET /accounts/iq][%d] getRenderAccountIQNotFound %+v", 404, o.Payload) } - func (o *GetRenderAccountIQNotFound) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountIQNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -226,7 +237,7 @@ func NewGetRenderAccountIQUnprocessableEntity() *GetRenderAccountIQUnprocessable return &GetRenderAccountIQUnprocessableEntity{} } -/*GetRenderAccountIQUnprocessableEntity handles this case with default header values. +/* GetRenderAccountIQUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type GetRenderAccountIQUnprocessableEntity struct { func (o *GetRenderAccountIQUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accounts/iq][%d] getRenderAccountIQUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetRenderAccountIQUnprocessableEntity) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountIQUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -264,7 +278,7 @@ func NewGetRenderAccountIQInternalServerError() *GetRenderAccountIQInternalServe return &GetRenderAccountIQInternalServerError{} } -/*GetRenderAccountIQInternalServerError handles this case with default header values. +/* GetRenderAccountIQInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type GetRenderAccountIQInternalServerError struct { func (o *GetRenderAccountIQInternalServerError) Error() string { return fmt.Sprintf("[GET /accounts/iq][%d] getRenderAccountIQInternalServerError %+v", 500, o.Payload) } - func (o *GetRenderAccountIQInternalServerError) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountIQInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) diff --git a/api/render/render_client/account/get_render_account_pand_l_parameters.go b/api/render/render_client/account/get_render_account_pand_l_parameters.go index ae2456e..20801ad 100644 --- a/api/render/render_client/account/get_render_account_pand_l_parameters.go +++ b/api/render/render_client/account/get_render_account_pand_l_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetRenderAccountPandLParams creates a new GetRenderAccountPandLParams object -// with the default values initialized. +// NewGetRenderAccountPandLParams creates a new GetRenderAccountPandLParams 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 NewGetRenderAccountPandLParams() *GetRenderAccountPandLParams { - var () return &GetRenderAccountPandLParams{ - timeout: cr.DefaultTimeout, } } // NewGetRenderAccountPandLParamsWithTimeout creates a new GetRenderAccountPandLParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetRenderAccountPandLParamsWithTimeout(timeout time.Duration) *GetRenderAccountPandLParams { - var () return &GetRenderAccountPandLParams{ - timeout: timeout, } } // NewGetRenderAccountPandLParamsWithContext creates a new GetRenderAccountPandLParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetRenderAccountPandLParamsWithContext(ctx context.Context) *GetRenderAccountPandLParams { - var () return &GetRenderAccountPandLParams{ - Context: ctx, } } // NewGetRenderAccountPandLParamsWithHTTPClient creates a new GetRenderAccountPandLParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetRenderAccountPandLParamsWithHTTPClient(client *http.Client) *GetRenderAccountPandLParams { - var () return &GetRenderAccountPandLParams{ HTTPClient: client, } } -/*GetRenderAccountPandLParams contains all the parameters to send to the API endpoint -for the get render account pand l operation typically these are written to a http.Request +/* GetRenderAccountPandLParams contains all the parameters to send to the API endpoint + for the get render account pand l operation. + + Typically these are written to a http.Request. */ type GetRenderAccountPandLParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID string @@ -75,6 +74,21 @@ type GetRenderAccountPandLParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get render account pand l params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRenderAccountPandLParams) WithDefaults() *GetRenderAccountPandLParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get render account pand l params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRenderAccountPandLParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get render account pand l params func (o *GetRenderAccountPandLParams) WithTimeout(timeout time.Duration) *GetRenderAccountPandLParams { o.SetTimeout(timeout) @@ -131,6 +145,7 @@ func (o *GetRenderAccountPandLParams) WriteToRequest(r runtime.ClientRequest, re qrAccountID := o.AccountID qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } diff --git a/api/render/render_client/account/get_render_account_pand_l_responses.go b/api/render/render_client/account/get_render_account_pand_l_responses.go index a3b1c03..b86f9a5 100644 --- a/api/render/render_client/account/get_render_account_pand_l_responses.go +++ b/api/render/render_client/account/get_render_account_pand_l_responses.go @@ -63,9 +63,8 @@ func (o *GetRenderAccountPandLReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetRenderAccountPandLOK() *GetRenderAccountPandLOK { return &GetRenderAccountPandLOK{} } -/*GetRenderAccountPandLOK handles this case with default header values. +/* GetRenderAccountPandLOK describes a response with status code 200, with default header values. Rendered documents response */ @@ -87,15 +86,18 @@ type GetRenderAccountPandLOK struct { func (o *GetRenderAccountPandLOK) Error() string { return fmt.Sprintf("[GET /accounts/profitloss][%d] getRenderAccountPandLOK %+v", 200, o.Payload) } - func (o *GetRenderAccountPandLOK) GetPayload() *render_models.DocumentResponse { return o.Payload } func (o *GetRenderAccountPandLOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.DocumentResponse) @@ -112,7 +114,7 @@ func NewGetRenderAccountPandLUnauthorized() *GetRenderAccountPandLUnauthorized { return &GetRenderAccountPandLUnauthorized{} } -/*GetRenderAccountPandLUnauthorized handles this case with default header values. +/* GetRenderAccountPandLUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type GetRenderAccountPandLUnauthorized struct { func (o *GetRenderAccountPandLUnauthorized) Error() string { return fmt.Sprintf("[GET /accounts/profitloss][%d] getRenderAccountPandLUnauthorized %+v", 401, o.Payload) } - func (o *GetRenderAccountPandLUnauthorized) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountPandLUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -150,7 +155,7 @@ func NewGetRenderAccountPandLForbidden() *GetRenderAccountPandLForbidden { return &GetRenderAccountPandLForbidden{} } -/*GetRenderAccountPandLForbidden handles this case with default header values. +/* GetRenderAccountPandLForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type GetRenderAccountPandLForbidden struct { func (o *GetRenderAccountPandLForbidden) Error() string { return fmt.Sprintf("[GET /accounts/profitloss][%d] getRenderAccountPandLForbidden %+v", 403, o.Payload) } - func (o *GetRenderAccountPandLForbidden) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountPandLForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -188,7 +196,7 @@ func NewGetRenderAccountPandLNotFound() *GetRenderAccountPandLNotFound { return &GetRenderAccountPandLNotFound{} } -/*GetRenderAccountPandLNotFound handles this case with default header values. +/* GetRenderAccountPandLNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type GetRenderAccountPandLNotFound struct { func (o *GetRenderAccountPandLNotFound) Error() string { return fmt.Sprintf("[GET /accounts/profitloss][%d] getRenderAccountPandLNotFound %+v", 404, o.Payload) } - func (o *GetRenderAccountPandLNotFound) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountPandLNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -226,7 +237,7 @@ func NewGetRenderAccountPandLUnprocessableEntity() *GetRenderAccountPandLUnproce return &GetRenderAccountPandLUnprocessableEntity{} } -/*GetRenderAccountPandLUnprocessableEntity handles this case with default header values. +/* GetRenderAccountPandLUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type GetRenderAccountPandLUnprocessableEntity struct { func (o *GetRenderAccountPandLUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accounts/profitloss][%d] getRenderAccountPandLUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetRenderAccountPandLUnprocessableEntity) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountPandLUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -264,7 +278,7 @@ func NewGetRenderAccountPandLInternalServerError() *GetRenderAccountPandLInterna return &GetRenderAccountPandLInternalServerError{} } -/*GetRenderAccountPandLInternalServerError handles this case with default header values. +/* GetRenderAccountPandLInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type GetRenderAccountPandLInternalServerError struct { func (o *GetRenderAccountPandLInternalServerError) Error() string { return fmt.Sprintf("[GET /accounts/profitloss][%d] getRenderAccountPandLInternalServerError %+v", 500, o.Payload) } - func (o *GetRenderAccountPandLInternalServerError) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderAccountPandLInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) diff --git a/api/render/render_client/cors/account_i_q_options_parameters.go b/api/render/render_client/cors/account_i_q_options_parameters.go index 6a347d3..8909821 100644 --- a/api/render/render_client/cors/account_i_q_options_parameters.go +++ b/api/render/render_client/cors/account_i_q_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewAccountIQOptionsParams creates a new AccountIQOptionsParams object -// with the default values initialized. +// NewAccountIQOptionsParams creates a new AccountIQOptionsParams 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 NewAccountIQOptionsParams() *AccountIQOptionsParams { - return &AccountIQOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewAccountIQOptionsParamsWithTimeout creates a new AccountIQOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAccountIQOptionsParamsWithTimeout(timeout time.Duration) *AccountIQOptionsParams { - return &AccountIQOptionsParams{ - timeout: timeout, } } // NewAccountIQOptionsParamsWithContext creates a new AccountIQOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAccountIQOptionsParamsWithContext(ctx context.Context) *AccountIQOptionsParams { - return &AccountIQOptionsParams{ - Context: ctx, } } // NewAccountIQOptionsParamsWithHTTPClient creates a new AccountIQOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAccountIQOptionsParamsWithHTTPClient(client *http.Client) *AccountIQOptionsParams { - return &AccountIQOptionsParams{ HTTPClient: client, } } -/*AccountIQOptionsParams contains all the parameters to send to the API endpoint -for the account i q options operation typically these are written to a http.Request +/* AccountIQOptionsParams contains all the parameters to send to the API endpoint + for the account i q options operation. + + Typically these are written to a http.Request. */ type AccountIQOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type AccountIQOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the account i q options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountIQOptionsParams) WithDefaults() *AccountIQOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account i q options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountIQOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the account i q options params func (o *AccountIQOptionsParams) WithTimeout(timeout time.Duration) *AccountIQOptionsParams { o.SetTimeout(timeout) diff --git a/api/render/render_client/cors/account_i_q_options_responses.go b/api/render/render_client/cors/account_i_q_options_responses.go index 5711b1c..ddd9d08 100644 --- a/api/render/render_client/cors/account_i_q_options_responses.go +++ b/api/render/render_client/cors/account_i_q_options_responses.go @@ -30,9 +30,8 @@ func (o *AccountIQOptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewAccountIQOptionsOK() *AccountIQOptionsOK { return &AccountIQOptionsOK{} } -/*AccountIQOptionsOK handles this case with default header values. +/* AccountIQOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type AccountIQOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *AccountIQOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *AccountIQOptionsOK) Error() string { func (o *AccountIQOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/render/render_client/cors/account_pand_l_options_parameters.go b/api/render/render_client/cors/account_pand_l_options_parameters.go index 1326ea4..499e063 100644 --- a/api/render/render_client/cors/account_pand_l_options_parameters.go +++ b/api/render/render_client/cors/account_pand_l_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewAccountPandLOptionsParams creates a new AccountPandLOptionsParams object -// with the default values initialized. +// NewAccountPandLOptionsParams creates a new AccountPandLOptionsParams 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 NewAccountPandLOptionsParams() *AccountPandLOptionsParams { - return &AccountPandLOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewAccountPandLOptionsParamsWithTimeout creates a new AccountPandLOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAccountPandLOptionsParamsWithTimeout(timeout time.Duration) *AccountPandLOptionsParams { - return &AccountPandLOptionsParams{ - timeout: timeout, } } // NewAccountPandLOptionsParamsWithContext creates a new AccountPandLOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAccountPandLOptionsParamsWithContext(ctx context.Context) *AccountPandLOptionsParams { - return &AccountPandLOptionsParams{ - Context: ctx, } } // NewAccountPandLOptionsParamsWithHTTPClient creates a new AccountPandLOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAccountPandLOptionsParamsWithHTTPClient(client *http.Client) *AccountPandLOptionsParams { - return &AccountPandLOptionsParams{ HTTPClient: client, } } -/*AccountPandLOptionsParams contains all the parameters to send to the API endpoint -for the account pand l options operation typically these are written to a http.Request +/* AccountPandLOptionsParams contains all the parameters to send to the API endpoint + for the account pand l options operation. + + Typically these are written to a http.Request. */ type AccountPandLOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type AccountPandLOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the account pand l options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountPandLOptionsParams) WithDefaults() *AccountPandLOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account pand l options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountPandLOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the account pand l options params func (o *AccountPandLOptionsParams) WithTimeout(timeout time.Duration) *AccountPandLOptionsParams { o.SetTimeout(timeout) diff --git a/api/render/render_client/cors/account_pand_l_options_responses.go b/api/render/render_client/cors/account_pand_l_options_responses.go index 813b9f1..f069ba5 100644 --- a/api/render/render_client/cors/account_pand_l_options_responses.go +++ b/api/render/render_client/cors/account_pand_l_options_responses.go @@ -30,9 +30,8 @@ func (o *AccountPandLOptionsReader) ReadResponse(response runtime.ClientResponse return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewAccountPandLOptionsOK() *AccountPandLOptionsOK { return &AccountPandLOptionsOK{} } -/*AccountPandLOptionsOK handles this case with default header values. +/* AccountPandLOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type AccountPandLOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *AccountPandLOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *AccountPandLOptionsOK) Error() string { func (o *AccountPandLOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/render/render_client/cors/cors_client.go b/api/render/render_client/cors/cors_client.go index 5d06554..d897df0 100644 --- a/api/render/render_client/cors/cors_client.go +++ b/api/render/render_client/cors/cors_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - AccountIQOptions(params *AccountIQOptionsParams) (*AccountIQOptionsOK, error) + AccountIQOptions(params *AccountIQOptionsParams, opts ...ClientOption) (*AccountIQOptionsOK, error) - AccountPandLOptions(params *AccountPandLOptionsParams) (*AccountPandLOptionsOK, error) + AccountPandLOptions(params *AccountPandLOptionsParams, opts ...ClientOption) (*AccountPandLOptionsOK, error) - TaxOptions(params *TaxOptionsParams) (*TaxOptionsOK, error) + TaxOptions(params *TaxOptionsParams, opts ...ClientOption) (*TaxOptionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { /* AccountIQOptions CORS support */ -func (a *Client) AccountIQOptions(params *AccountIQOptionsParams) (*AccountIQOptionsOK, error) { +func (a *Client) AccountIQOptions(params *AccountIQOptionsParams, opts ...ClientOption) (*AccountIQOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAccountIQOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "accountIQOptions", Method: "OPTIONS", PathPattern: "/accounts/iq", @@ -60,7 +62,12 @@ func (a *Client) AccountIQOptions(params *AccountIQOptionsParams) (*AccountIQOpt Reader: &AccountIQOptionsReader{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 } @@ -77,13 +84,12 @@ func (a *Client) AccountIQOptions(params *AccountIQOptionsParams) (*AccountIQOpt /* AccountPandLOptions CORS support */ -func (a *Client) AccountPandLOptions(params *AccountPandLOptionsParams) (*AccountPandLOptionsOK, error) { +func (a *Client) AccountPandLOptions(params *AccountPandLOptionsParams, opts ...ClientOption) (*AccountPandLOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAccountPandLOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "accountPandLOptions", Method: "OPTIONS", PathPattern: "/accounts/profitloss", @@ -94,7 +100,12 @@ func (a *Client) AccountPandLOptions(params *AccountPandLOptionsParams) (*Accoun Reader: &AccountPandLOptionsReader{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 } @@ -111,13 +122,12 @@ func (a *Client) AccountPandLOptions(params *AccountPandLOptionsParams) (*Accoun /* TaxOptions CORS support */ -func (a *Client) TaxOptions(params *TaxOptionsParams) (*TaxOptionsOK, error) { +func (a *Client) TaxOptions(params *TaxOptionsParams, opts ...ClientOption) (*TaxOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTaxOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "taxOptions", Method: "OPTIONS", PathPattern: "/accounts/tax", @@ -128,7 +138,12 @@ func (a *Client) TaxOptions(params *TaxOptionsParams) (*TaxOptionsOK, error) { Reader: &TaxOptionsReader{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 } diff --git a/api/render/render_client/cors/tax_options_parameters.go b/api/render/render_client/cors/tax_options_parameters.go index 32e4507..5beebed 100644 --- a/api/render/render_client/cors/tax_options_parameters.go +++ b/api/render/render_client/cors/tax_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewTaxOptionsParams creates a new TaxOptionsParams object -// with the default values initialized. +// NewTaxOptionsParams creates a new TaxOptionsParams 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 NewTaxOptionsParams() *TaxOptionsParams { - return &TaxOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewTaxOptionsParamsWithTimeout creates a new TaxOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTaxOptionsParamsWithTimeout(timeout time.Duration) *TaxOptionsParams { - return &TaxOptionsParams{ - timeout: timeout, } } // NewTaxOptionsParamsWithContext creates a new TaxOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTaxOptionsParamsWithContext(ctx context.Context) *TaxOptionsParams { - return &TaxOptionsParams{ - Context: ctx, } } // NewTaxOptionsParamsWithHTTPClient creates a new TaxOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTaxOptionsParamsWithHTTPClient(client *http.Client) *TaxOptionsParams { - return &TaxOptionsParams{ HTTPClient: client, } } -/*TaxOptionsParams contains all the parameters to send to the API endpoint -for the tax options operation typically these are written to a http.Request +/* TaxOptionsParams contains all the parameters to send to the API endpoint + for the tax options operation. + + Typically these are written to a http.Request. */ type TaxOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type TaxOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tax options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxOptionsParams) WithDefaults() *TaxOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tax options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TaxOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tax options params func (o *TaxOptionsParams) WithTimeout(timeout time.Duration) *TaxOptionsParams { o.SetTimeout(timeout) diff --git a/api/render/render_client/cors/tax_options_responses.go b/api/render/render_client/cors/tax_options_responses.go index 1a8d2c9..300181e 100644 --- a/api/render/render_client/cors/tax_options_responses.go +++ b/api/render/render_client/cors/tax_options_responses.go @@ -30,9 +30,8 @@ func (o *TaxOptionsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewTaxOptionsOK() *TaxOptionsOK { return &TaxOptionsOK{} } -/*TaxOptionsOK handles this case with default header values. +/* TaxOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type TaxOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *TaxOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *TaxOptionsOK) Error() string { func (o *TaxOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/render/render_client/tax/get_render_taxes_parameters.go b/api/render/render_client/tax/get_render_taxes_parameters.go index 7cca05a..82c1430 100644 --- a/api/render/render_client/tax/get_render_taxes_parameters.go +++ b/api/render/render_client/tax/get_render_taxes_parameters.go @@ -21,68 +21,76 @@ import ( "github.com/go-openapi/swag" ) -// NewGetRenderTaxesParams creates a new GetRenderTaxesParams object -// with the default values initialized. +// NewGetRenderTaxesParams creates a new GetRenderTaxesParams 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 NewGetRenderTaxesParams() *GetRenderTaxesParams { - var () return &GetRenderTaxesParams{ - timeout: cr.DefaultTimeout, } } // NewGetRenderTaxesParamsWithTimeout creates a new GetRenderTaxesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetRenderTaxesParamsWithTimeout(timeout time.Duration) *GetRenderTaxesParams { - var () return &GetRenderTaxesParams{ - timeout: timeout, } } // NewGetRenderTaxesParamsWithContext creates a new GetRenderTaxesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetRenderTaxesParamsWithContext(ctx context.Context) *GetRenderTaxesParams { - var () return &GetRenderTaxesParams{ - Context: ctx, } } // NewGetRenderTaxesParamsWithHTTPClient creates a new GetRenderTaxesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetRenderTaxesParamsWithHTTPClient(client *http.Client) *GetRenderTaxesParams { - var () return &GetRenderTaxesParams{ HTTPClient: client, } } -/*GetRenderTaxesParams contains all the parameters to send to the API endpoint -for the get render taxes operation typically these are written to a http.Request +/* GetRenderTaxesParams contains all the parameters to send to the API endpoint + for the get render taxes operation. + + Typically these are written to a http.Request. */ type GetRenderTaxesParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID string - /*Month - The Month Number (1,2, ..., 12) of the report + /* Month. + + The Month Number (1,2, ..., 12) of the report + + Format: int64 */ Month *int64 - /*Quarter - The Quarter Number (1,2,3,4) of the report + /* Quarter. + + The Quarter Number (1,2,3,4) of the report + + Format: int64 */ Quarter *int64 - /*Year - The year of the report + /* Year. + + The year of the report + + Format: int64 */ Year *int64 @@ -91,6 +99,21 @@ type GetRenderTaxesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get render taxes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRenderTaxesParams) WithDefaults() *GetRenderTaxesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get render taxes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRenderTaxesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get render taxes params func (o *GetRenderTaxesParams) WithTimeout(timeout time.Duration) *GetRenderTaxesParams { o.SetTimeout(timeout) @@ -180,6 +203,7 @@ func (o *GetRenderTaxesParams) WriteToRequest(r runtime.ClientRequest, reg strfm qrAccountID := o.AccountID qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } @@ -189,48 +213,51 @@ func (o *GetRenderTaxesParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param month var qrMonth int64 + if o.Month != nil { qrMonth = *o.Month } qMonth := swag.FormatInt64(qrMonth) if qMonth != "" { + if err := r.SetQueryParam("month", qMonth); err != nil { return err } } - } if o.Quarter != nil { // query param quarter var qrQuarter int64 + if o.Quarter != nil { qrQuarter = *o.Quarter } qQuarter := swag.FormatInt64(qrQuarter) if qQuarter != "" { + if err := r.SetQueryParam("quarter", qQuarter); err != nil { return err } } - } if o.Year != nil { // query param year var qrYear int64 + if o.Year != nil { qrYear = *o.Year } qYear := swag.FormatInt64(qrYear) if qYear != "" { + if err := r.SetQueryParam("year", qYear); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/render/render_client/tax/get_render_taxes_responses.go b/api/render/render_client/tax/get_render_taxes_responses.go index 8cd67b3..5b0b59d 100644 --- a/api/render/render_client/tax/get_render_taxes_responses.go +++ b/api/render/render_client/tax/get_render_taxes_responses.go @@ -63,9 +63,8 @@ func (o *GetRenderTaxesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetRenderTaxesOK() *GetRenderTaxesOK { return &GetRenderTaxesOK{} } -/*GetRenderTaxesOK handles this case with default header values. +/* GetRenderTaxesOK describes a response with status code 200, with default header values. Rendered documents response */ @@ -87,15 +86,18 @@ type GetRenderTaxesOK struct { func (o *GetRenderTaxesOK) Error() string { return fmt.Sprintf("[GET /accounts/tax][%d] getRenderTaxesOK %+v", 200, o.Payload) } - func (o *GetRenderTaxesOK) GetPayload() *render_models.DocumentResponse { return o.Payload } func (o *GetRenderTaxesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.DocumentResponse) @@ -112,7 +114,7 @@ func NewGetRenderTaxesUnauthorized() *GetRenderTaxesUnauthorized { return &GetRenderTaxesUnauthorized{} } -/*GetRenderTaxesUnauthorized handles this case with default header values. +/* GetRenderTaxesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type GetRenderTaxesUnauthorized struct { func (o *GetRenderTaxesUnauthorized) Error() string { return fmt.Sprintf("[GET /accounts/tax][%d] getRenderTaxesUnauthorized %+v", 401, o.Payload) } - func (o *GetRenderTaxesUnauthorized) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderTaxesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -150,7 +155,7 @@ func NewGetRenderTaxesForbidden() *GetRenderTaxesForbidden { return &GetRenderTaxesForbidden{} } -/*GetRenderTaxesForbidden handles this case with default header values. +/* GetRenderTaxesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type GetRenderTaxesForbidden struct { func (o *GetRenderTaxesForbidden) Error() string { return fmt.Sprintf("[GET /accounts/tax][%d] getRenderTaxesForbidden %+v", 403, o.Payload) } - func (o *GetRenderTaxesForbidden) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderTaxesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -188,7 +196,7 @@ func NewGetRenderTaxesNotFound() *GetRenderTaxesNotFound { return &GetRenderTaxesNotFound{} } -/*GetRenderTaxesNotFound handles this case with default header values. +/* GetRenderTaxesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type GetRenderTaxesNotFound struct { func (o *GetRenderTaxesNotFound) Error() string { return fmt.Sprintf("[GET /accounts/tax][%d] getRenderTaxesNotFound %+v", 404, o.Payload) } - func (o *GetRenderTaxesNotFound) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderTaxesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -226,7 +237,7 @@ func NewGetRenderTaxesUnprocessableEntity() *GetRenderTaxesUnprocessableEntity { return &GetRenderTaxesUnprocessableEntity{} } -/*GetRenderTaxesUnprocessableEntity handles this case with default header values. +/* GetRenderTaxesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type GetRenderTaxesUnprocessableEntity struct { func (o *GetRenderTaxesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accounts/tax][%d] getRenderTaxesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetRenderTaxesUnprocessableEntity) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderTaxesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) @@ -264,7 +278,7 @@ func NewGetRenderTaxesInternalServerError() *GetRenderTaxesInternalServerError { return &GetRenderTaxesInternalServerError{} } -/*GetRenderTaxesInternalServerError handles this case with default header values. +/* GetRenderTaxesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type GetRenderTaxesInternalServerError struct { func (o *GetRenderTaxesInternalServerError) Error() string { return fmt.Sprintf("[GET /accounts/tax][%d] getRenderTaxesInternalServerError %+v", 500, o.Payload) } - func (o *GetRenderTaxesInternalServerError) GetPayload() *render_models.Error { return o.Payload } func (o *GetRenderTaxesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(render_models.Error) diff --git a/api/render/render_client/tax/tax_client.go b/api/render/render_client/tax/tax_client.go index 00295c2..d3dd597 100644 --- a/api/render/render_client/tax/tax_client.go +++ b/api/render/render_client/tax/tax_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetRenderTaxes(params *GetRenderTaxesParams, authInfo runtime.ClientAuthInfoWriter) (*GetRenderTaxesOK, error) + GetRenderTaxes(params *GetRenderTaxesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRenderTaxesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a summary tax report for an Account */ -func (a *Client) GetRenderTaxes(params *GetRenderTaxesParams, authInfo runtime.ClientAuthInfoWriter) (*GetRenderTaxesOK, error) { +func (a *Client) GetRenderTaxes(params *GetRenderTaxesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRenderTaxesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRenderTaxesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRenderTaxes", Method: "GET", PathPattern: "/accounts/tax", @@ -59,7 +61,12 @@ func (a *Client) GetRenderTaxes(params *GetRenderTaxesParams, authInfo runtime.C 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 } diff --git a/api/render/render_models/document.go b/api/render/render_models/document.go index d5fc8fd..07398f1 100644 --- a/api/render/render_models/document.go +++ b/api/render/render_models/document.go @@ -10,6 +10,8 @@ package render_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -43,6 +45,11 @@ func (m *Document) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this document based on context it is used +func (m *Document) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Document) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/render/render_models/document_response.go b/api/render/render_models/document_response.go index 1d7c282..cfbd85f 100644 --- a/api/render/render_models/document_response.go +++ b/api/render/render_models/document_response.go @@ -10,6 +10,7 @@ package render_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DocumentResponse) Validate(formats strfmt.Registry) error { } func (m *DocumentResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DocumentResponse) validateData(formats strfmt.Registry) error { } func (m *DocumentResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DocumentResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this document response based on the context it is used +func (m *DocumentResponse) 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 *DocumentResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DocumentResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DocumentResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/render/render_models/error.go b/api/render/render_models/error.go index 2322474..00d5daa 100644 --- a/api/render/render_models/error.go +++ b/api/render/render_models/error.go @@ -10,6 +10,8 @@ package render_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/render/render_models/invalid_error.go b/api/render/render_models/invalid_error.go index 72fc3f7..e4f594a 100644 --- a/api/render/render_models/invalid_error.go +++ b/api/render/render_models/invalid_error.go @@ -10,6 +10,8 @@ package render_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/render/render_models/pagination.go b/api/render/render_models/pagination.go index 6e5870a..1ce732a 100644 --- a/api/render/render_models/pagination.go +++ b/api/render/render_models/pagination.go @@ -10,6 +10,8 @@ package render_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/render/render_models/response_meta.go b/api/render/render_models/response_meta.go index 7d48c13..00c1006 100644 --- a/api/render/render_models/response_meta.go +++ b/api/render/render_models/response_meta.go @@ -10,6 +10,8 @@ package render_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_client/accounting_rules/accounting_rules_client.go b/api/sf-gate/sf_gate_client/accounting_rules/accounting_rules_client.go index b7b8031..8de4e04 100644 --- a/api/sf-gate/sf_gate_client/accounting_rules/accounting_rules_client.go +++ b/api/sf-gate/sf_gate_client/accounting_rules/accounting_rules_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesOK, error) + GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of Accounting Rules for an Account */ -func (a *Client) GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesOK, error) { +func (a *Client) GetAccountingRules(params *GetAccountingRulesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountingRulesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccountingRules", Method: "GET", PathPattern: "/accountingrules", @@ -59,7 +61,12 @@ func (a *Client) GetAccountingRules(params *GetAccountingRulesParams, authInfo r 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 } diff --git a/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_parameters.go b/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_parameters.go index 02c9fca..51d9396 100644 --- a/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_parameters.go +++ b/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAccountingRulesParams creates a new GetAccountingRulesParams object -// with the default values initialized. +// NewGetAccountingRulesParams creates a new GetAccountingRulesParams 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 NewGetAccountingRulesParams() *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountingRulesParamsWithTimeout creates a new GetAccountingRulesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountingRulesParamsWithTimeout(timeout time.Duration) *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ - timeout: timeout, } } // NewGetAccountingRulesParamsWithContext creates a new GetAccountingRulesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountingRulesParamsWithContext(ctx context.Context) *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ - Context: ctx, } } // NewGetAccountingRulesParamsWithHTTPClient creates a new GetAccountingRulesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountingRulesParamsWithHTTPClient(client *http.Client) *GetAccountingRulesParams { - var () return &GetAccountingRulesParams{ HTTPClient: client, } } -/*GetAccountingRulesParams contains all the parameters to send to the API endpoint -for the get accounting rules operation typically these are written to a http.Request +/* GetAccountingRulesParams contains all the parameters to send to the API endpoint + for the get accounting rules operation. + + Typically these are written to a http.Request. */ type GetAccountingRulesParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetAccountingRulesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounting rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesParams) WithDefaults() *GetAccountingRulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounting rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounting rules params func (o *GetAccountingRulesParams) WithTimeout(timeout time.Duration) *GetAccountingRulesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetAccountingRulesParams) WriteToRequest(r runtime.ClientRequest, reg s // 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.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 { diff --git a/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_responses.go b/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_responses.go index 2f2f00b..3b88291 100644 --- a/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_responses.go +++ b/api/sf-gate/sf_gate_client/accounting_rules/get_accounting_rules_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountingRulesReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetAccountingRulesOK() *GetAccountingRulesOK { return &GetAccountingRulesOK{} } -/*GetAccountingRulesOK handles this case with default header values. +/* GetAccountingRulesOK describes a response with status code 200, with default header values. Taxnexus Response with Accounting Rule objects */ @@ -85,7 +84,6 @@ type GetAccountingRulesOK struct { func (o *GetAccountingRulesOK) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesOK %+v", 200, o.Payload) } - func (o *GetAccountingRulesOK) GetPayload() *sf_gate_models.AccountingRuleResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetAccountingRulesUnauthorized() *GetAccountingRulesUnauthorized { return &GetAccountingRulesUnauthorized{} } -/*GetAccountingRulesUnauthorized handles this case with default header values. +/* GetAccountingRulesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetAccountingRulesUnauthorized struct { func (o *GetAccountingRulesUnauthorized) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountingRulesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetAccountingRulesForbidden() *GetAccountingRulesForbidden { return &GetAccountingRulesForbidden{} } -/*GetAccountingRulesForbidden handles this case with default header values. +/* GetAccountingRulesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetAccountingRulesForbidden struct { func (o *GetAccountingRulesForbidden) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesForbidden %+v", 403, o.Payload) } - func (o *GetAccountingRulesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetAccountingRulesNotFound() *GetAccountingRulesNotFound { return &GetAccountingRulesNotFound{} } -/*GetAccountingRulesNotFound handles this case with default header values. +/* GetAccountingRulesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetAccountingRulesNotFound struct { func (o *GetAccountingRulesNotFound) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesNotFound %+v", 404, o.Payload) } - func (o *GetAccountingRulesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetAccountingRulesUnprocessableEntity() *GetAccountingRulesUnprocessable return &GetAccountingRulesUnprocessableEntity{} } -/*GetAccountingRulesUnprocessableEntity handles this case with default header values. +/* GetAccountingRulesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetAccountingRulesUnprocessableEntity struct { func (o *GetAccountingRulesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountingRulesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetAccountingRulesInternalServerError() *GetAccountingRulesInternalServe return &GetAccountingRulesInternalServerError{} } -/*GetAccountingRulesInternalServerError handles this case with default header values. +/* GetAccountingRulesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetAccountingRulesInternalServerError struct { func (o *GetAccountingRulesInternalServerError) Error() string { return fmt.Sprintf("[GET /accountingrules][%d] getAccountingRulesInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountingRulesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/accounting_rulesets/accounting_rulesets_client.go b/api/sf-gate/sf_gate_client/accounting_rulesets/accounting_rulesets_client.go index 04e0af5..b18fe91 100644 --- a/api/sf-gate/sf_gate_client/accounting_rulesets/accounting_rulesets_client.go +++ b/api/sf-gate/sf_gate_client/accounting_rulesets/accounting_rulesets_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesetsOK, error) + GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesetsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of Accounting Rulesets for an Account */ -func (a *Client) GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountingRulesetsOK, error) { +func (a *Client) GetAccountingRulesets(params *GetAccountingRulesetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountingRulesetsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountingRulesetsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccountingRulesets", Method: "GET", PathPattern: "/accountingrulesets", @@ -59,7 +61,12 @@ func (a *Client) GetAccountingRulesets(params *GetAccountingRulesetsParams, auth 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 } diff --git a/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_parameters.go b/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_parameters.go index b2a21f0..efd9351 100644 --- a/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_parameters.go +++ b/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAccountingRulesetsParams creates a new GetAccountingRulesetsParams object -// with the default values initialized. +// NewGetAccountingRulesetsParams creates a new GetAccountingRulesetsParams 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 NewGetAccountingRulesetsParams() *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountingRulesetsParamsWithTimeout creates a new GetAccountingRulesetsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountingRulesetsParamsWithTimeout(timeout time.Duration) *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ - timeout: timeout, } } // NewGetAccountingRulesetsParamsWithContext creates a new GetAccountingRulesetsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountingRulesetsParamsWithContext(ctx context.Context) *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ - Context: ctx, } } // NewGetAccountingRulesetsParamsWithHTTPClient creates a new GetAccountingRulesetsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountingRulesetsParamsWithHTTPClient(client *http.Client) *GetAccountingRulesetsParams { - var () return &GetAccountingRulesetsParams{ HTTPClient: client, } } -/*GetAccountingRulesetsParams contains all the parameters to send to the API endpoint -for the get accounting rulesets operation typically these are written to a http.Request +/* GetAccountingRulesetsParams contains all the parameters to send to the API endpoint + for the get accounting rulesets operation. + + Typically these are written to a http.Request. */ type GetAccountingRulesetsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetAccountingRulesetsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounting rulesets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesetsParams) WithDefaults() *GetAccountingRulesetsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounting rulesets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountingRulesetsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounting rulesets params func (o *GetAccountingRulesetsParams) WithTimeout(timeout time.Duration) *GetAccountingRulesetsParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetAccountingRulesetsParams) WriteToRequest(r runtime.ClientRequest, re // 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.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 { diff --git a/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_responses.go b/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_responses.go index f0b7bf1..a3c4ce0 100644 --- a/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_responses.go +++ b/api/sf-gate/sf_gate_client/accounting_rulesets/get_accounting_rulesets_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountingRulesetsReader) ReadResponse(response runtime.ClientRespon return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetAccountingRulesetsOK() *GetAccountingRulesetsOK { return &GetAccountingRulesetsOK{} } -/*GetAccountingRulesetsOK handles this case with default header values. +/* GetAccountingRulesetsOK describes a response with status code 200, with default header values. Taxnexus Response with Accounting Ruleset objects */ @@ -85,7 +84,6 @@ type GetAccountingRulesetsOK struct { func (o *GetAccountingRulesetsOK) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsOK %+v", 200, o.Payload) } - func (o *GetAccountingRulesetsOK) GetPayload() *sf_gate_models.AccountingRulesetResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetAccountingRulesetsUnauthorized() *GetAccountingRulesetsUnauthorized { return &GetAccountingRulesetsUnauthorized{} } -/*GetAccountingRulesetsUnauthorized handles this case with default header values. +/* GetAccountingRulesetsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetAccountingRulesetsUnauthorized struct { func (o *GetAccountingRulesetsUnauthorized) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountingRulesetsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetAccountingRulesetsForbidden() *GetAccountingRulesetsForbidden { return &GetAccountingRulesetsForbidden{} } -/*GetAccountingRulesetsForbidden handles this case with default header values. +/* GetAccountingRulesetsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetAccountingRulesetsForbidden struct { func (o *GetAccountingRulesetsForbidden) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsForbidden %+v", 403, o.Payload) } - func (o *GetAccountingRulesetsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetAccountingRulesetsNotFound() *GetAccountingRulesetsNotFound { return &GetAccountingRulesetsNotFound{} } -/*GetAccountingRulesetsNotFound handles this case with default header values. +/* GetAccountingRulesetsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetAccountingRulesetsNotFound struct { func (o *GetAccountingRulesetsNotFound) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsNotFound %+v", 404, o.Payload) } - func (o *GetAccountingRulesetsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetAccountingRulesetsUnprocessableEntity() *GetAccountingRulesetsUnproce return &GetAccountingRulesetsUnprocessableEntity{} } -/*GetAccountingRulesetsUnprocessableEntity handles this case with default header values. +/* GetAccountingRulesetsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetAccountingRulesetsUnprocessableEntity struct { func (o *GetAccountingRulesetsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountingRulesetsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetAccountingRulesetsInternalServerError() *GetAccountingRulesetsInterna return &GetAccountingRulesetsInternalServerError{} } -/*GetAccountingRulesetsInternalServerError handles this case with default header values. +/* GetAccountingRulesetsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetAccountingRulesetsInternalServerError struct { func (o *GetAccountingRulesetsInternalServerError) Error() string { return fmt.Sprintf("[GET /accountingrulesets][%d] getAccountingRulesetsInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountingRulesetsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/accounts/accounts_client.go b/api/sf-gate/sf_gate_client/accounts/accounts_client.go index f7804cf..d2179aa 100644 --- a/api/sf-gate/sf_gate_client/accounts/accounts_client.go +++ b/api/sf-gate/sf_gate_client/accounts/accounts_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) + GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) - PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountsOK, error) + PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) - PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter) (*PutAccountOK, error) + PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Accounts */ -func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) { +func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccounts", Method: "GET", PathPattern: "/accounts", @@ -63,7 +65,12 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA Account record to be added */ -func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountsOK, error) { +func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postAccounts", Method: "POST", PathPattern: "/accounts", @@ -100,7 +106,12 @@ func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.Clien 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 } @@ -119,13 +130,12 @@ func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.Clien Update a single account specified by accountId */ -func (a *Client) PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter) (*PutAccountOK, error) { +func (a *Client) PutAccount(params *PutAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutAccountParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putAccount", Method: "PUT", PathPattern: "/accounts", @@ -137,7 +147,12 @@ func (a *Client) PutAccount(params *PutAccountParams, authInfo runtime.ClientAut 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 } diff --git a/api/sf-gate/sf_gate_client/accounts/get_accounts_parameters.go b/api/sf-gate/sf_gate_client/accounts/get_accounts_parameters.go index 0361113..d246a6f 100644 --- a/api/sf-gate/sf_gate_client/accounts/get_accounts_parameters.go +++ b/api/sf-gate/sf_gate_client/accounts/get_accounts_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAccountsParams creates a new GetAccountsParams object -// with the default values initialized. +// NewGetAccountsParams creates a new GetAccountsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetAccountsParams() *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountsParamsWithTimeout creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountsParamsWithTimeout(timeout time.Duration) *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: timeout, } } // NewGetAccountsParamsWithContext creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountsParamsWithContext(ctx context.Context) *GetAccountsParams { - var () return &GetAccountsParams{ - Context: ctx, } } // NewGetAccountsParamsWithHTTPClient creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountsParamsWithHTTPClient(client *http.Client) *GetAccountsParams { - var () return &GetAccountsParams{ HTTPClient: client, } } -/*GetAccountsParams contains all the parameters to send to the API endpoint -for the get accounts operation typically these are written to a http.Request +/* GetAccountsParams contains all the parameters to send to the API endpoint + for the get accounts operation. + + Typically these are written to a http.Request. */ type GetAccountsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) WithDefaults() *GetAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounts params func (o *GetAccountsParams) WithTimeout(timeout time.Duration) *GetAccountsParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.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 { diff --git a/api/sf-gate/sf_gate_client/accounts/get_accounts_responses.go b/api/sf-gate/sf_gate_client/accounts/get_accounts_responses.go index b36680d..9a1a7f9 100644 --- a/api/sf-gate/sf_gate_client/accounts/get_accounts_responses.go +++ b/api/sf-gate/sf_gate_client/accounts/get_accounts_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetAccountsOK() *GetAccountsOK { return &GetAccountsOK{} } -/*GetAccountsOK handles this case with default header values. +/* GetAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Account objects */ @@ -85,7 +84,6 @@ type GetAccountsOK struct { func (o *GetAccountsOK) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload) } - func (o *GetAccountsOK) GetPayload() *sf_gate_models.AccountResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetAccountsUnauthorized() *GetAccountsUnauthorized { return &GetAccountsUnauthorized{} } -/*GetAccountsUnauthorized handles this case with default header values. +/* GetAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetAccountsUnauthorized struct { func (o *GetAccountsUnauthorized) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetAccountsForbidden() *GetAccountsForbidden { return &GetAccountsForbidden{} } -/*GetAccountsForbidden handles this case with default header values. +/* GetAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetAccountsForbidden struct { func (o *GetAccountsForbidden) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload) } - func (o *GetAccountsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetAccountsNotFound() *GetAccountsNotFound { return &GetAccountsNotFound{} } -/*GetAccountsNotFound handles this case with default header values. +/* GetAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetAccountsNotFound struct { func (o *GetAccountsNotFound) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload) } - func (o *GetAccountsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetAccountsUnprocessableEntity() *GetAccountsUnprocessableEntity { return &GetAccountsUnprocessableEntity{} } -/*GetAccountsUnprocessableEntity handles this case with default header values. +/* GetAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetAccountsUnprocessableEntity struct { func (o *GetAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetAccountsInternalServerError() *GetAccountsInternalServerError { return &GetAccountsInternalServerError{} } -/*GetAccountsInternalServerError handles this case with default header values. +/* GetAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetAccountsInternalServerError struct { func (o *GetAccountsInternalServerError) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/accounts/post_accounts_parameters.go b/api/sf-gate/sf_gate_client/accounts/post_accounts_parameters.go index 954259d..b568fbe 100644 --- a/api/sf-gate/sf_gate_client/accounts/post_accounts_parameters.go +++ b/api/sf-gate/sf_gate_client/accounts/post_accounts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostAccountsParams creates a new PostAccountsParams object -// with the default values initialized. +// NewPostAccountsParams creates a new PostAccountsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPostAccountsParams() *PostAccountsParams { - var () return &PostAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPostAccountsParamsWithTimeout creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostAccountsParamsWithTimeout(timeout time.Duration) *PostAccountsParams { - var () return &PostAccountsParams{ - timeout: timeout, } } // NewPostAccountsParamsWithContext creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostAccountsParamsWithContext(ctx context.Context) *PostAccountsParams { - var () return &PostAccountsParams{ - Context: ctx, } } // NewPostAccountsParamsWithHTTPClient creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostAccountsParamsWithHTTPClient(client *http.Client) *PostAccountsParams { - var () return &PostAccountsParams{ HTTPClient: client, } } -/*PostAccountsParams contains all the parameters to send to the API endpoint -for the post accounts operation typically these are written to a http.Request +/* PostAccountsParams contains all the parameters to send to the API endpoint + for the post accounts operation. + + Typically these are written to a http.Request. */ type PostAccountsParams struct { - /*AccountRequest - A request with an array of Account Objects + /* AccountRequest. + A request with an array of Account Objects */ AccountRequest *sf_gate_models.AccountRequest @@ -77,6 +76,21 @@ type PostAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountsParams) WithDefaults() *PostAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post accounts params func (o *PostAccountsParams) WithTimeout(timeout time.Duration) *PostAccountsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.AccountRequest != nil { if err := r.SetBodyParam(o.AccountRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/accounts/post_accounts_responses.go b/api/sf-gate/sf_gate_client/accounts/post_accounts_responses.go index 97eec73..ffbefce 100644 --- a/api/sf-gate/sf_gate_client/accounts/post_accounts_responses.go +++ b/api/sf-gate/sf_gate_client/accounts/post_accounts_responses.go @@ -57,9 +57,8 @@ func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostAccountsOK() *PostAccountsOK { return &PostAccountsOK{} } -/*PostAccountsOK handles this case with default header values. +/* PostAccountsOK describes a response with status code 200, with default header values. Taxnexus Response with Account objects */ @@ -79,7 +78,6 @@ type PostAccountsOK struct { func (o *PostAccountsOK) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsOK %+v", 200, o.Payload) } - func (o *PostAccountsOK) GetPayload() *sf_gate_models.AccountResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostAccountsUnauthorized() *PostAccountsUnauthorized { return &PostAccountsUnauthorized{} } -/*PostAccountsUnauthorized handles this case with default header values. +/* PostAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostAccountsUnauthorized struct { func (o *PostAccountsUnauthorized) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsUnauthorized %+v", 401, o.Payload) } - func (o *PostAccountsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostAccountsForbidden() *PostAccountsForbidden { return &PostAccountsForbidden{} } -/*PostAccountsForbidden handles this case with default header values. +/* PostAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostAccountsForbidden struct { func (o *PostAccountsForbidden) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden %+v", 403, o.Payload) } - func (o *PostAccountsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostAccountsNotFound() *PostAccountsNotFound { return &PostAccountsNotFound{} } -/*PostAccountsNotFound handles this case with default header values. +/* PostAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostAccountsNotFound struct { func (o *PostAccountsNotFound) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsNotFound %+v", 404, o.Payload) } - func (o *PostAccountsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostAccountsInternalServerError() *PostAccountsInternalServerError { return &PostAccountsInternalServerError{} } -/*PostAccountsInternalServerError handles this case with default header values. +/* PostAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostAccountsInternalServerError struct { func (o *PostAccountsInternalServerError) Error() string { return fmt.Sprintf("[POST /accounts][%d] postAccountsInternalServerError %+v", 500, o.Payload) } - func (o *PostAccountsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/accounts/put_account_parameters.go b/api/sf-gate/sf_gate_client/accounts/put_account_parameters.go index 91a1047..8a7eb99 100644 --- a/api/sf-gate/sf_gate_client/accounts/put_account_parameters.go +++ b/api/sf-gate/sf_gate_client/accounts/put_account_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutAccountParams creates a new PutAccountParams object -// with the default values initialized. +// NewPutAccountParams creates a new PutAccountParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPutAccountParams() *PutAccountParams { - var () return &PutAccountParams{ - timeout: cr.DefaultTimeout, } } // NewPutAccountParamsWithTimeout creates a new PutAccountParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutAccountParamsWithTimeout(timeout time.Duration) *PutAccountParams { - var () return &PutAccountParams{ - timeout: timeout, } } // NewPutAccountParamsWithContext creates a new PutAccountParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutAccountParamsWithContext(ctx context.Context) *PutAccountParams { - var () return &PutAccountParams{ - Context: ctx, } } // NewPutAccountParamsWithHTTPClient creates a new PutAccountParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutAccountParamsWithHTTPClient(client *http.Client) *PutAccountParams { - var () return &PutAccountParams{ HTTPClient: client, } } -/*PutAccountParams contains all the parameters to send to the API endpoint -for the put account operation typically these are written to a http.Request +/* PutAccountParams contains all the parameters to send to the API endpoint + for the put account operation. + + Typically these are written to a http.Request. */ type PutAccountParams struct { - /*AccountRequest - A request with an array of Account Objects + /* AccountRequest. + A request with an array of Account Objects */ AccountRequest *sf_gate_models.AccountRequest @@ -77,6 +76,21 @@ type PutAccountParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAccountParams) WithDefaults() *PutAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAccountParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put account params func (o *PutAccountParams) WithTimeout(timeout time.Duration) *PutAccountParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.AccountRequest != nil { if err := r.SetBodyParam(o.AccountRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/accounts/put_account_responses.go b/api/sf-gate/sf_gate_client/accounts/put_account_responses.go index 5dddcdc..3cc6b03 100644 --- a/api/sf-gate/sf_gate_client/accounts/put_account_responses.go +++ b/api/sf-gate/sf_gate_client/accounts/put_account_responses.go @@ -57,9 +57,8 @@ func (o *PutAccountReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutAccountOK() *PutAccountOK { return &PutAccountOK{} } -/*PutAccountOK handles this case with default header values. +/* PutAccountOK describes a response with status code 200, with default header values. Taxnexus Response with Account objects */ @@ -79,7 +78,6 @@ type PutAccountOK struct { func (o *PutAccountOK) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountOK %+v", 200, o.Payload) } - func (o *PutAccountOK) GetPayload() *sf_gate_models.AccountResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutAccountUnauthorized() *PutAccountUnauthorized { return &PutAccountUnauthorized{} } -/*PutAccountUnauthorized handles this case with default header values. +/* PutAccountUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutAccountUnauthorized struct { func (o *PutAccountUnauthorized) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountUnauthorized %+v", 401, o.Payload) } - func (o *PutAccountUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutAccountForbidden() *PutAccountForbidden { return &PutAccountForbidden{} } -/*PutAccountForbidden handles this case with default header values. +/* PutAccountForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutAccountForbidden struct { func (o *PutAccountForbidden) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountForbidden %+v", 403, o.Payload) } - func (o *PutAccountForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutAccountNotFound() *PutAccountNotFound { return &PutAccountNotFound{} } -/*PutAccountNotFound handles this case with default header values. +/* PutAccountNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutAccountNotFound struct { func (o *PutAccountNotFound) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountNotFound %+v", 404, o.Payload) } - func (o *PutAccountNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutAccountInternalServerError() *PutAccountInternalServerError { return &PutAccountInternalServerError{} } -/*PutAccountInternalServerError handles this case with default header values. +/* PutAccountInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutAccountInternalServerError struct { func (o *PutAccountInternalServerError) Error() string { return fmt.Sprintf("[PUT /accounts][%d] putAccountInternalServerError %+v", 500, o.Payload) } - func (o *PutAccountInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/authorities/authorities_client.go b/api/sf-gate/sf_gate_client/authorities/authorities_client.go index 2992e7e..f30b8e7 100644 --- a/api/sf-gate/sf_gate_client/authorities/authorities_client.go +++ b/api/sf-gate/sf_gate_client/authorities/authorities_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAuthoritiesOK, error) + GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAuthoritiesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of available Authorities */ -func (a *Client) GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAuthoritiesOK, error) { +func (a *Client) GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAuthoritiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAuthoritiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAuthorities", Method: "GET", PathPattern: "/authorities", @@ -59,7 +61,12 @@ func (a *Client) GetAuthorities(params *GetAuthoritiesParams, authInfo runtime.C 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 } diff --git a/api/sf-gate/sf_gate_client/authorities/get_authorities_parameters.go b/api/sf-gate/sf_gate_client/authorities/get_authorities_parameters.go index e828c7f..04a1e32 100644 --- a/api/sf-gate/sf_gate_client/authorities/get_authorities_parameters.go +++ b/api/sf-gate/sf_gate_client/authorities/get_authorities_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetAuthoritiesParams creates a new GetAuthoritiesParams object -// with the default values initialized. +// NewGetAuthoritiesParams creates a new GetAuthoritiesParams 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 NewGetAuthoritiesParams() *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ - timeout: cr.DefaultTimeout, } } // NewGetAuthoritiesParamsWithTimeout creates a new GetAuthoritiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAuthoritiesParamsWithTimeout(timeout time.Duration) *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ - timeout: timeout, } } // NewGetAuthoritiesParamsWithContext creates a new GetAuthoritiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAuthoritiesParamsWithContext(ctx context.Context) *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ - Context: ctx, } } // NewGetAuthoritiesParamsWithHTTPClient creates a new GetAuthoritiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAuthoritiesParamsWithHTTPClient(client *http.Client) *GetAuthoritiesParams { - var () return &GetAuthoritiesParams{ HTTPClient: client, } } -/*GetAuthoritiesParams contains all the parameters to send to the API endpoint -for the get authorities operation typically these are written to a http.Request +/* GetAuthoritiesParams contains all the parameters to send to the API endpoint + for the get authorities operation. + + Typically these are written to a http.Request. */ type GetAuthoritiesParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*AuthorityID - Taxnexus Id of the Authority to be retrieved + /* AuthorityID. + + Taxnexus Id of the Authority to be retrieved */ AuthorityID *string - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetAuthoritiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthoritiesParams) WithDefaults() *GetAuthoritiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get authorities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthoritiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get authorities params func (o *GetAuthoritiesParams) WithTimeout(timeout time.Duration) *GetAuthoritiesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetAuthoritiesParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.AuthorityID != nil { // query param authorityId var qrAuthorityID string + if o.AuthorityID != nil { qrAuthorityID = *o.AuthorityID } qAuthorityID := qrAuthorityID if qAuthorityID != "" { + if err := r.SetQueryParam("authorityId", qAuthorityID); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 { diff --git a/api/sf-gate/sf_gate_client/authorities/get_authorities_responses.go b/api/sf-gate/sf_gate_client/authorities/get_authorities_responses.go index 4944011..2c32c7d 100644 --- a/api/sf-gate/sf_gate_client/authorities/get_authorities_responses.go +++ b/api/sf-gate/sf_gate_client/authorities/get_authorities_responses.go @@ -63,9 +63,8 @@ func (o *GetAuthoritiesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetAuthoritiesOK() *GetAuthoritiesOK { return &GetAuthoritiesOK{} } -/*GetAuthoritiesOK handles this case with default header values. +/* GetAuthoritiesOK describes a response with status code 200, with default header values. An array of Authority objects */ @@ -85,7 +84,6 @@ type GetAuthoritiesOK struct { func (o *GetAuthoritiesOK) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesOK %+v", 200, o.Payload) } - func (o *GetAuthoritiesOK) GetPayload() *sf_gate_models.AuthorityResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetAuthoritiesUnauthorized() *GetAuthoritiesUnauthorized { return &GetAuthoritiesUnauthorized{} } -/*GetAuthoritiesUnauthorized handles this case with default header values. +/* GetAuthoritiesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetAuthoritiesUnauthorized struct { func (o *GetAuthoritiesUnauthorized) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesUnauthorized %+v", 401, o.Payload) } - func (o *GetAuthoritiesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetAuthoritiesForbidden() *GetAuthoritiesForbidden { return &GetAuthoritiesForbidden{} } -/*GetAuthoritiesForbidden handles this case with default header values. +/* GetAuthoritiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetAuthoritiesForbidden struct { func (o *GetAuthoritiesForbidden) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesForbidden %+v", 403, o.Payload) } - func (o *GetAuthoritiesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetAuthoritiesNotFound() *GetAuthoritiesNotFound { return &GetAuthoritiesNotFound{} } -/*GetAuthoritiesNotFound handles this case with default header values. +/* GetAuthoritiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetAuthoritiesNotFound struct { func (o *GetAuthoritiesNotFound) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesNotFound %+v", 404, o.Payload) } - func (o *GetAuthoritiesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetAuthoritiesUnprocessableEntity() *GetAuthoritiesUnprocessableEntity { return &GetAuthoritiesUnprocessableEntity{} } -/*GetAuthoritiesUnprocessableEntity handles this case with default header values. +/* GetAuthoritiesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetAuthoritiesUnprocessableEntity struct { func (o *GetAuthoritiesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAuthoritiesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetAuthoritiesInternalServerError() *GetAuthoritiesInternalServerError { return &GetAuthoritiesInternalServerError{} } -/*GetAuthoritiesInternalServerError handles this case with default header values. +/* GetAuthoritiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetAuthoritiesInternalServerError struct { func (o *GetAuthoritiesInternalServerError) Error() string { return fmt.Sprintf("[GET /authorities][%d] getAuthoritiesInternalServerError %+v", 500, o.Payload) } - func (o *GetAuthoritiesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/backends/backends_client.go b/api/sf-gate/sf_gate_client/backends/backends_client.go index c88ad2e..7149f1e 100644 --- a/api/sf-gate/sf_gate_client/backends/backends_client.go +++ b/api/sf-gate/sf_gate_client/backends/backends_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*GetBackendsOK, error) + GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetBackendsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of Backends */ -func (a *Client) GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter) (*GetBackendsOK, error) { +func (a *Client) GetBackends(params *GetBackendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetBackendsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetBackendsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getBackends", Method: "GET", PathPattern: "/backends", @@ -59,7 +61,12 @@ func (a *Client) GetBackends(params *GetBackendsParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/backends/get_backends_parameters.go b/api/sf-gate/sf_gate_client/backends/get_backends_parameters.go index 80f6596..0a2c1b8 100644 --- a/api/sf-gate/sf_gate_client/backends/get_backends_parameters.go +++ b/api/sf-gate/sf_gate_client/backends/get_backends_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetBackendsParams creates a new GetBackendsParams object -// with the default values initialized. +// NewGetBackendsParams creates a new GetBackendsParams 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 NewGetBackendsParams() *GetBackendsParams { - var () return &GetBackendsParams{ - timeout: cr.DefaultTimeout, } } // NewGetBackendsParamsWithTimeout creates a new GetBackendsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetBackendsParamsWithTimeout(timeout time.Duration) *GetBackendsParams { - var () return &GetBackendsParams{ - timeout: timeout, } } // NewGetBackendsParamsWithContext creates a new GetBackendsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetBackendsParamsWithContext(ctx context.Context) *GetBackendsParams { - var () return &GetBackendsParams{ - Context: ctx, } } // NewGetBackendsParamsWithHTTPClient creates a new GetBackendsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetBackendsParamsWithHTTPClient(client *http.Client) *GetBackendsParams { - var () return &GetBackendsParams{ HTTPClient: client, } } -/*GetBackendsParams contains all the parameters to send to the API endpoint -for the get backends operation typically these are written to a http.Request +/* GetBackendsParams contains all the parameters to send to the API endpoint + for the get backends operation. + + Typically these are written to a http.Request. */ type GetBackendsParams struct { - /*BackendID - Taxnexus Id of the Backend to be retrieved + /* BackendID. + Taxnexus Id of the Backend to be retrieved */ BackendID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetBackendsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBackendsParams) WithDefaults() *GetBackendsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get backends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBackendsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get backends params func (o *GetBackendsParams) WithTimeout(timeout time.Duration) *GetBackendsParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetBackendsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param backendId var qrBackendID string + if o.BackendID != nil { qrBackendID = *o.BackendID } qBackendID := qrBackendID if qBackendID != "" { + if err := r.SetQueryParam("backendId", qBackendID); 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 { diff --git a/api/sf-gate/sf_gate_client/backends/get_backends_responses.go b/api/sf-gate/sf_gate_client/backends/get_backends_responses.go index ad6bead..a116ae4 100644 --- a/api/sf-gate/sf_gate_client/backends/get_backends_responses.go +++ b/api/sf-gate/sf_gate_client/backends/get_backends_responses.go @@ -63,9 +63,8 @@ func (o *GetBackendsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetBackendsOK() *GetBackendsOK { return &GetBackendsOK{} } -/*GetBackendsOK handles this case with default header values. +/* GetBackendsOK describes a response with status code 200, with default header values. Taxnexus Response with Backend objects */ @@ -85,7 +84,6 @@ type GetBackendsOK struct { func (o *GetBackendsOK) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsOK %+v", 200, o.Payload) } - func (o *GetBackendsOK) GetPayload() *sf_gate_models.BackendResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetBackendsUnauthorized() *GetBackendsUnauthorized { return &GetBackendsUnauthorized{} } -/*GetBackendsUnauthorized handles this case with default header values. +/* GetBackendsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetBackendsUnauthorized struct { func (o *GetBackendsUnauthorized) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsUnauthorized %+v", 401, o.Payload) } - func (o *GetBackendsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetBackendsForbidden() *GetBackendsForbidden { return &GetBackendsForbidden{} } -/*GetBackendsForbidden handles this case with default header values. +/* GetBackendsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetBackendsForbidden struct { func (o *GetBackendsForbidden) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsForbidden %+v", 403, o.Payload) } - func (o *GetBackendsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetBackendsNotFound() *GetBackendsNotFound { return &GetBackendsNotFound{} } -/*GetBackendsNotFound handles this case with default header values. +/* GetBackendsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetBackendsNotFound struct { func (o *GetBackendsNotFound) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsNotFound %+v", 404, o.Payload) } - func (o *GetBackendsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetBackendsUnprocessableEntity() *GetBackendsUnprocessableEntity { return &GetBackendsUnprocessableEntity{} } -/*GetBackendsUnprocessableEntity handles this case with default header values. +/* GetBackendsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetBackendsUnprocessableEntity struct { func (o *GetBackendsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetBackendsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetBackendsInternalServerError() *GetBackendsInternalServerError { return &GetBackendsInternalServerError{} } -/*GetBackendsInternalServerError handles this case with default header values. +/* GetBackendsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetBackendsInternalServerError struct { func (o *GetBackendsInternalServerError) Error() string { return fmt.Sprintf("[GET /backends][%d] getBackendsInternalServerError %+v", 500, o.Payload) } - func (o *GetBackendsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/cash_receipts/cash_receipts_client.go b/api/sf-gate/sf_gate_client/cash_receipts/cash_receipts_client.go index 08ef52a..86f0b00 100644 --- a/api/sf-gate/sf_gate_client/cash_receipts/cash_receipts_client.go +++ b/api/sf-gate/sf_gate_client/cash_receipts/cash_receipts_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCashReceiptsOK, error) + GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCashReceiptsOK, error) - PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCashReceiptsOK, error) + PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCashReceiptsOK, error) - PutCashRecipts(params *PutCashReciptsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCashReciptsOK, error) + PutCashRecipts(params *PutCashReciptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCashReciptsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Taxnexus Cash Receipts */ -func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCashReceiptsOK, error) { +func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCashReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCashReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCashReceipts", Method: "GET", PathPattern: "/cashreceipts", @@ -63,7 +65,12 @@ func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime 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 } @@ -82,13 +89,12 @@ func (a *Client) GetCashReceipts(params *GetCashReceiptsParams, authInfo runtime Create New Cash Receipts */ -func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCashReceiptsOK, error) { +func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostCashReceiptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostCashReceiptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postCashReceipts", Method: "POST", PathPattern: "/cashreceipts", @@ -100,7 +106,12 @@ func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runti 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 } @@ -119,13 +130,12 @@ func (a *Client) PostCashReceipts(params *PostCashReceiptsParams, authInfo runti Put a list of Cash Receipts */ -func (a *Client) PutCashRecipts(params *PutCashReciptsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCashReciptsOK, error) { +func (a *Client) PutCashRecipts(params *PutCashReciptsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutCashReciptsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutCashReciptsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putCashRecipts", Method: "PUT", PathPattern: "/cashreceipts", @@ -137,7 +147,12 @@ func (a *Client) PutCashRecipts(params *PutCashReciptsParams, authInfo runtime.C 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 } diff --git a/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_parameters.go b/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_parameters.go index 3a1272f..2924fbb 100644 --- a/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_parameters.go +++ b/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCashReceiptsParams creates a new GetCashReceiptsParams object -// with the default values initialized. +// NewGetCashReceiptsParams creates a new GetCashReceiptsParams 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 NewGetCashReceiptsParams() *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewGetCashReceiptsParamsWithTimeout creates a new GetCashReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCashReceiptsParamsWithTimeout(timeout time.Duration) *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ - timeout: timeout, } } // NewGetCashReceiptsParamsWithContext creates a new GetCashReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCashReceiptsParamsWithContext(ctx context.Context) *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ - Context: ctx, } } // NewGetCashReceiptsParamsWithHTTPClient creates a new GetCashReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCashReceiptsParamsWithHTTPClient(client *http.Client) *GetCashReceiptsParams { - var () return &GetCashReceiptsParams{ HTTPClient: client, } } -/*GetCashReceiptsParams contains all the parameters to send to the API endpoint -for the get cash receipts operation typically these are written to a http.Request +/* GetCashReceiptsParams contains all the parameters to send to the API endpoint + for the get cash receipts operation. + + Typically these are written to a http.Request. */ type GetCashReceiptsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CashReceiptID - Taxnexus Record Id of a Cash Receipt + /* CashReceiptID. + + Taxnexus Record Id of a Cash Receipt */ CashReceiptID *string - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetCashReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCashReceiptsParams) WithDefaults() *GetCashReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCashReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get cash receipts params func (o *GetCashReceiptsParams) WithTimeout(timeout time.Duration) *GetCashReceiptsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetCashReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CashReceiptID != nil { // query param cashReceiptId var qrCashReceiptID string + if o.CashReceiptID != nil { qrCashReceiptID = *o.CashReceiptID } qCashReceiptID := qrCashReceiptID if qCashReceiptID != "" { + if err := r.SetQueryParam("cashReceiptId", qCashReceiptID); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 { diff --git a/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_responses.go b/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_responses.go index 11bc70d..ba3ab14 100644 --- a/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_responses.go +++ b/api/sf-gate/sf_gate_client/cash_receipts/get_cash_receipts_responses.go @@ -63,9 +63,8 @@ func (o *GetCashReceiptsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetCashReceiptsOK() *GetCashReceiptsOK { return &GetCashReceiptsOK{} } -/*GetCashReceiptsOK handles this case with default header values. +/* GetCashReceiptsOK describes a response with status code 200, with default header values. Taxnexus Response with Cash Receipt objects */ @@ -85,7 +84,6 @@ type GetCashReceiptsOK struct { func (o *GetCashReceiptsOK) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsOK %+v", 200, o.Payload) } - func (o *GetCashReceiptsOK) GetPayload() *sf_gate_models.CashReceiptResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetCashReceiptsUnauthorized() *GetCashReceiptsUnauthorized { return &GetCashReceiptsUnauthorized{} } -/*GetCashReceiptsUnauthorized handles this case with default header values. +/* GetCashReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetCashReceiptsUnauthorized struct { func (o *GetCashReceiptsUnauthorized) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *GetCashReceiptsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetCashReceiptsForbidden() *GetCashReceiptsForbidden { return &GetCashReceiptsForbidden{} } -/*GetCashReceiptsForbidden handles this case with default header values. +/* GetCashReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetCashReceiptsForbidden struct { func (o *GetCashReceiptsForbidden) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsForbidden %+v", 403, o.Payload) } - func (o *GetCashReceiptsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetCashReceiptsNotFound() *GetCashReceiptsNotFound { return &GetCashReceiptsNotFound{} } -/*GetCashReceiptsNotFound handles this case with default header values. +/* GetCashReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetCashReceiptsNotFound struct { func (o *GetCashReceiptsNotFound) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsNotFound %+v", 404, o.Payload) } - func (o *GetCashReceiptsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetCashReceiptsUnprocessableEntity() *GetCashReceiptsUnprocessableEntity return &GetCashReceiptsUnprocessableEntity{} } -/*GetCashReceiptsUnprocessableEntity handles this case with default header values. +/* GetCashReceiptsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetCashReceiptsUnprocessableEntity struct { func (o *GetCashReceiptsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCashReceiptsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetCashReceiptsInternalServerError() *GetCashReceiptsInternalServerError return &GetCashReceiptsInternalServerError{} } -/*GetCashReceiptsInternalServerError handles this case with default header values. +/* GetCashReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetCashReceiptsInternalServerError struct { func (o *GetCashReceiptsInternalServerError) Error() string { return fmt.Sprintf("[GET /cashreceipts][%d] getCashReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *GetCashReceiptsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_parameters.go b/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_parameters.go index aa80e72..1f2bca0 100644 --- a/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_parameters.go +++ b/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostCashReceiptsParams creates a new PostCashReceiptsParams object -// with the default values initialized. +// NewPostCashReceiptsParams creates a new PostCashReceiptsParams 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 NewPostCashReceiptsParams() *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ - timeout: cr.DefaultTimeout, } } // NewPostCashReceiptsParamsWithTimeout creates a new PostCashReceiptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostCashReceiptsParamsWithTimeout(timeout time.Duration) *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ - timeout: timeout, } } // NewPostCashReceiptsParamsWithContext creates a new PostCashReceiptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostCashReceiptsParamsWithContext(ctx context.Context) *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ - Context: ctx, } } // NewPostCashReceiptsParamsWithHTTPClient creates a new PostCashReceiptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostCashReceiptsParamsWithHTTPClient(client *http.Client) *PostCashReceiptsParams { - var () return &PostCashReceiptsParams{ HTTPClient: client, } } -/*PostCashReceiptsParams contains all the parameters to send to the API endpoint -for the post cash receipts operation typically these are written to a http.Request +/* PostCashReceiptsParams contains all the parameters to send to the API endpoint + for the post cash receipts operation. + + Typically these are written to a http.Request. */ type PostCashReceiptsParams struct { - /*CashReceiptRequest*/ + // CashReceiptRequest. CashReceiptRequest *sf_gate_models.CashReceiptRequest timeout time.Duration @@ -74,6 +73,21 @@ type PostCashReceiptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCashReceiptsParams) WithDefaults() *PostCashReceiptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post cash receipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostCashReceiptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post cash receipts params func (o *PostCashReceiptsParams) WithTimeout(timeout time.Duration) *PostCashReceiptsParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostCashReceiptsParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.CashReceiptRequest != nil { if err := r.SetBodyParam(o.CashReceiptRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_responses.go b/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_responses.go index 98a99c4..91ff376 100644 --- a/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_responses.go +++ b/api/sf-gate/sf_gate_client/cash_receipts/post_cash_receipts_responses.go @@ -57,9 +57,8 @@ func (o *PostCashReceiptsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostCashReceiptsOK() *PostCashReceiptsOK { return &PostCashReceiptsOK{} } -/*PostCashReceiptsOK handles this case with default header values. +/* PostCashReceiptsOK describes a response with status code 200, with default header values. Taxnexus Response with Cash Receipt objects */ @@ -79,7 +78,6 @@ type PostCashReceiptsOK struct { func (o *PostCashReceiptsOK) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsOK %+v", 200, o.Payload) } - func (o *PostCashReceiptsOK) GetPayload() *sf_gate_models.CashReceiptResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostCashReceiptsUnauthorized() *PostCashReceiptsUnauthorized { return &PostCashReceiptsUnauthorized{} } -/*PostCashReceiptsUnauthorized handles this case with default header values. +/* PostCashReceiptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostCashReceiptsUnauthorized struct { func (o *PostCashReceiptsUnauthorized) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsUnauthorized %+v", 401, o.Payload) } - func (o *PostCashReceiptsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostCashReceiptsForbidden() *PostCashReceiptsForbidden { return &PostCashReceiptsForbidden{} } -/*PostCashReceiptsForbidden handles this case with default header values. +/* PostCashReceiptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostCashReceiptsForbidden struct { func (o *PostCashReceiptsForbidden) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsForbidden %+v", 403, o.Payload) } - func (o *PostCashReceiptsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostCashReceiptsNotFound() *PostCashReceiptsNotFound { return &PostCashReceiptsNotFound{} } -/*PostCashReceiptsNotFound handles this case with default header values. +/* PostCashReceiptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostCashReceiptsNotFound struct { func (o *PostCashReceiptsNotFound) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsNotFound %+v", 404, o.Payload) } - func (o *PostCashReceiptsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostCashReceiptsInternalServerError() *PostCashReceiptsInternalServerErr return &PostCashReceiptsInternalServerError{} } -/*PostCashReceiptsInternalServerError handles this case with default header values. +/* PostCashReceiptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostCashReceiptsInternalServerError struct { func (o *PostCashReceiptsInternalServerError) Error() string { return fmt.Sprintf("[POST /cashreceipts][%d] postCashReceiptsInternalServerError %+v", 500, o.Payload) } - func (o *PostCashReceiptsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_parameters.go b/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_parameters.go index 73c9ec1..f2cd52b 100644 --- a/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_parameters.go +++ b/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutCashReciptsParams creates a new PutCashReciptsParams object -// with the default values initialized. +// NewPutCashReciptsParams creates a new PutCashReciptsParams 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 NewPutCashReciptsParams() *PutCashReciptsParams { - var () return &PutCashReciptsParams{ - timeout: cr.DefaultTimeout, } } // NewPutCashReciptsParamsWithTimeout creates a new PutCashReciptsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutCashReciptsParamsWithTimeout(timeout time.Duration) *PutCashReciptsParams { - var () return &PutCashReciptsParams{ - timeout: timeout, } } // NewPutCashReciptsParamsWithContext creates a new PutCashReciptsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutCashReciptsParamsWithContext(ctx context.Context) *PutCashReciptsParams { - var () return &PutCashReciptsParams{ - Context: ctx, } } // NewPutCashReciptsParamsWithHTTPClient creates a new PutCashReciptsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutCashReciptsParamsWithHTTPClient(client *http.Client) *PutCashReciptsParams { - var () return &PutCashReciptsParams{ HTTPClient: client, } } -/*PutCashReciptsParams contains all the parameters to send to the API endpoint -for the put cash recipts operation typically these are written to a http.Request +/* PutCashReciptsParams contains all the parameters to send to the API endpoint + for the put cash recipts operation. + + Typically these are written to a http.Request. */ type PutCashReciptsParams struct { - /*CashReceiptRequest*/ + // CashReceiptRequest. CashReceiptRequest *sf_gate_models.CashReceiptRequest timeout time.Duration @@ -74,6 +73,21 @@ type PutCashReciptsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put cash recipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutCashReciptsParams) WithDefaults() *PutCashReciptsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put cash recipts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutCashReciptsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put cash recipts params func (o *PutCashReciptsParams) WithTimeout(timeout time.Duration) *PutCashReciptsParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PutCashReciptsParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.CashReceiptRequest != nil { if err := r.SetBodyParam(o.CashReceiptRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_responses.go b/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_responses.go index 2de17a2..c1fee4f 100644 --- a/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_responses.go +++ b/api/sf-gate/sf_gate_client/cash_receipts/put_cash_recipts_responses.go @@ -57,9 +57,8 @@ func (o *PutCashReciptsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutCashReciptsOK() *PutCashReciptsOK { return &PutCashReciptsOK{} } -/*PutCashReciptsOK handles this case with default header values. +/* PutCashReciptsOK describes a response with status code 200, with default header values. Taxnexus Response with Cash Receipt objects */ @@ -79,7 +78,6 @@ type PutCashReciptsOK struct { func (o *PutCashReciptsOK) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReciptsOK %+v", 200, o.Payload) } - func (o *PutCashReciptsOK) GetPayload() *sf_gate_models.CashReceiptResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutCashReciptsUnauthorized() *PutCashReciptsUnauthorized { return &PutCashReciptsUnauthorized{} } -/*PutCashReciptsUnauthorized handles this case with default header values. +/* PutCashReciptsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutCashReciptsUnauthorized struct { func (o *PutCashReciptsUnauthorized) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReciptsUnauthorized %+v", 401, o.Payload) } - func (o *PutCashReciptsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutCashReciptsForbidden() *PutCashReciptsForbidden { return &PutCashReciptsForbidden{} } -/*PutCashReciptsForbidden handles this case with default header values. +/* PutCashReciptsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutCashReciptsForbidden struct { func (o *PutCashReciptsForbidden) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReciptsForbidden %+v", 403, o.Payload) } - func (o *PutCashReciptsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutCashReciptsNotFound() *PutCashReciptsNotFound { return &PutCashReciptsNotFound{} } -/*PutCashReciptsNotFound handles this case with default header values. +/* PutCashReciptsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutCashReciptsNotFound struct { func (o *PutCashReciptsNotFound) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReciptsNotFound %+v", 404, o.Payload) } - func (o *PutCashReciptsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutCashReciptsInternalServerError() *PutCashReciptsInternalServerError { return &PutCashReciptsInternalServerError{} } -/*PutCashReciptsInternalServerError handles this case with default header values. +/* PutCashReciptsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutCashReciptsInternalServerError struct { func (o *PutCashReciptsInternalServerError) Error() string { return fmt.Sprintf("[PUT /cashreceipts][%d] putCashReciptsInternalServerError %+v", 500, o.Payload) } - func (o *PutCashReciptsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/clusters/clusters_client.go b/api/sf-gate/sf_gate_client/clusters/clusters_client.go index 242aae3..4753650 100644 --- a/api/sf-gate/sf_gate_client/clusters/clusters_client.go +++ b/api/sf-gate/sf_gate_client/clusters/clusters_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter) (*GetClustersOK, error) + GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error) - PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PostClustersOK, error) + PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error) - PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PutClustersOK, error) + PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Cluster records from the datastore */ -func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter) (*GetClustersOK, error) { +func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClustersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetClustersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getClusters", Method: "GET", PathPattern: "/clusters", @@ -63,7 +65,12 @@ func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetClusters(params *GetClustersParams, authInfo runtime.ClientA Create Clusters in Taxnexus */ -func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PostClustersOK, error) { +func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostClustersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostClustersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postClusters", Method: "POST", PathPattern: "/clusters", @@ -100,7 +106,12 @@ func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.Clien 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 } @@ -119,13 +130,12 @@ func (a *Client) PostClusters(params *PostClustersParams, authInfo runtime.Clien Update Cluster in Taxnexus */ -func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter) (*PutClustersOK, error) { +func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutClustersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutClustersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putClusters", Method: "PUT", PathPattern: "/clusters", @@ -137,7 +147,12 @@ func (a *Client) PutClusters(params *PutClustersParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/clusters/get_clusters_parameters.go b/api/sf-gate/sf_gate_client/clusters/get_clusters_parameters.go index 1e78086..159c17e 100644 --- a/api/sf-gate/sf_gate_client/clusters/get_clusters_parameters.go +++ b/api/sf-gate/sf_gate_client/clusters/get_clusters_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetClustersParams creates a new GetClustersParams object -// with the default values initialized. +// NewGetClustersParams creates a new GetClustersParams 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 NewGetClustersParams() *GetClustersParams { - var () return &GetClustersParams{ - timeout: cr.DefaultTimeout, } } // NewGetClustersParamsWithTimeout creates a new GetClustersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetClustersParamsWithTimeout(timeout time.Duration) *GetClustersParams { - var () return &GetClustersParams{ - timeout: timeout, } } // NewGetClustersParamsWithContext creates a new GetClustersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetClustersParamsWithContext(ctx context.Context) *GetClustersParams { - var () return &GetClustersParams{ - Context: ctx, } } // NewGetClustersParamsWithHTTPClient creates a new GetClustersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetClustersParamsWithHTTPClient(client *http.Client) *GetClustersParams { - var () return &GetClustersParams{ HTTPClient: client, } } -/*GetClustersParams contains all the parameters to send to the API endpoint -for the get clusters operation typically these are written to a http.Request +/* GetClustersParams contains all the parameters to send to the API endpoint + for the get clusters operation. + + Typically these are written to a http.Request. */ type GetClustersParams struct { - /*ClusterID - Taxnexus Record Id of a Cluster + /* ClusterID. + Taxnexus Record Id of a Cluster */ ClusterID *string - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetClustersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClustersParams) WithDefaults() *GetClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClustersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get clusters params func (o *GetClustersParams) WithTimeout(timeout time.Duration) *GetClustersParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param clusterId var qrClusterID string + if o.ClusterID != nil { qrClusterID = *o.ClusterID } qClusterID := qrClusterID if qClusterID != "" { + if err := r.SetQueryParam("clusterId", qClusterID); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 { diff --git a/api/sf-gate/sf_gate_client/clusters/get_clusters_responses.go b/api/sf-gate/sf_gate_client/clusters/get_clusters_responses.go index 9966c3a..c6b72e5 100644 --- a/api/sf-gate/sf_gate_client/clusters/get_clusters_responses.go +++ b/api/sf-gate/sf_gate_client/clusters/get_clusters_responses.go @@ -63,9 +63,8 @@ func (o *GetClustersReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetClustersOK() *GetClustersOK { return &GetClustersOK{} } -/*GetClustersOK handles this case with default header values. +/* GetClustersOK describes a response with status code 200, with default header values. Taxnexus Response with Cluster objects */ @@ -85,7 +84,6 @@ type GetClustersOK struct { func (o *GetClustersOK) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersOK %+v", 200, o.Payload) } - func (o *GetClustersOK) GetPayload() *sf_gate_models.ClusterResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetClustersUnauthorized() *GetClustersUnauthorized { return &GetClustersUnauthorized{} } -/*GetClustersUnauthorized handles this case with default header values. +/* GetClustersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetClustersUnauthorized struct { func (o *GetClustersUnauthorized) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersUnauthorized %+v", 401, o.Payload) } - func (o *GetClustersUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetClustersForbidden() *GetClustersForbidden { return &GetClustersForbidden{} } -/*GetClustersForbidden handles this case with default header values. +/* GetClustersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetClustersForbidden struct { func (o *GetClustersForbidden) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersForbidden %+v", 403, o.Payload) } - func (o *GetClustersForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetClustersNotFound() *GetClustersNotFound { return &GetClustersNotFound{} } -/*GetClustersNotFound handles this case with default header values. +/* GetClustersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetClustersNotFound struct { func (o *GetClustersNotFound) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersNotFound %+v", 404, o.Payload) } - func (o *GetClustersNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetClustersUnprocessableEntity() *GetClustersUnprocessableEntity { return &GetClustersUnprocessableEntity{} } -/*GetClustersUnprocessableEntity handles this case with default header values. +/* GetClustersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetClustersUnprocessableEntity struct { func (o *GetClustersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetClustersUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetClustersInternalServerError() *GetClustersInternalServerError { return &GetClustersInternalServerError{} } -/*GetClustersInternalServerError handles this case with default header values. +/* GetClustersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetClustersInternalServerError struct { func (o *GetClustersInternalServerError) Error() string { return fmt.Sprintf("[GET /clusters][%d] getClustersInternalServerError %+v", 500, o.Payload) } - func (o *GetClustersInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/clusters/post_clusters_parameters.go b/api/sf-gate/sf_gate_client/clusters/post_clusters_parameters.go index 38051ed..5bfc2f3 100644 --- a/api/sf-gate/sf_gate_client/clusters/post_clusters_parameters.go +++ b/api/sf-gate/sf_gate_client/clusters/post_clusters_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostClustersParams creates a new PostClustersParams object -// with the default values initialized. +// NewPostClustersParams creates a new PostClustersParams 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 NewPostClustersParams() *PostClustersParams { - var () return &PostClustersParams{ - timeout: cr.DefaultTimeout, } } // NewPostClustersParamsWithTimeout creates a new PostClustersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostClustersParamsWithTimeout(timeout time.Duration) *PostClustersParams { - var () return &PostClustersParams{ - timeout: timeout, } } // NewPostClustersParamsWithContext creates a new PostClustersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostClustersParamsWithContext(ctx context.Context) *PostClustersParams { - var () return &PostClustersParams{ - Context: ctx, } } // NewPostClustersParamsWithHTTPClient creates a new PostClustersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostClustersParamsWithHTTPClient(client *http.Client) *PostClustersParams { - var () return &PostClustersParams{ HTTPClient: client, } } -/*PostClustersParams contains all the parameters to send to the API endpoint -for the post clusters operation typically these are written to a http.Request +/* PostClustersParams contains all the parameters to send to the API endpoint + for the post clusters operation. + + Typically these are written to a http.Request. */ type PostClustersParams struct { - /*ClusterRequest - An array of Cluster records + /* ClusterRequest. + An array of Cluster records */ ClusterRequest *sf_gate_models.ClusterRequest @@ -77,6 +76,21 @@ type PostClustersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostClustersParams) WithDefaults() *PostClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostClustersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post clusters params func (o *PostClustersParams) WithTimeout(timeout time.Duration) *PostClustersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.ClusterRequest != nil { if err := r.SetBodyParam(o.ClusterRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/clusters/post_clusters_responses.go b/api/sf-gate/sf_gate_client/clusters/post_clusters_responses.go index 9389c91..c29e8da 100644 --- a/api/sf-gate/sf_gate_client/clusters/post_clusters_responses.go +++ b/api/sf-gate/sf_gate_client/clusters/post_clusters_responses.go @@ -63,9 +63,8 @@ func (o *PostClustersReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostClustersOK() *PostClustersOK { return &PostClustersOK{} } -/*PostClustersOK handles this case with default header values. +/* PostClustersOK describes a response with status code 200, with default header values. Taxnexus Response with Cluster objects */ @@ -85,7 +84,6 @@ type PostClustersOK struct { func (o *PostClustersOK) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersOK %+v", 200, o.Payload) } - func (o *PostClustersOK) GetPayload() *sf_gate_models.ClusterResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostClustersUnauthorized() *PostClustersUnauthorized { return &PostClustersUnauthorized{} } -/*PostClustersUnauthorized handles this case with default header values. +/* PostClustersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostClustersUnauthorized struct { func (o *PostClustersUnauthorized) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersUnauthorized %+v", 401, o.Payload) } - func (o *PostClustersUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostClustersForbidden() *PostClustersForbidden { return &PostClustersForbidden{} } -/*PostClustersForbidden handles this case with default header values. +/* PostClustersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostClustersForbidden struct { func (o *PostClustersForbidden) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersForbidden %+v", 403, o.Payload) } - func (o *PostClustersForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostClustersNotFound() *PostClustersNotFound { return &PostClustersNotFound{} } -/*PostClustersNotFound handles this case with default header values. +/* PostClustersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostClustersNotFound struct { func (o *PostClustersNotFound) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersNotFound %+v", 404, o.Payload) } - func (o *PostClustersNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostClustersUnprocessableEntity() *PostClustersUnprocessableEntity { return &PostClustersUnprocessableEntity{} } -/*PostClustersUnprocessableEntity handles this case with default header values. +/* PostClustersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostClustersUnprocessableEntity struct { func (o *PostClustersUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostClustersUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostClustersInternalServerError() *PostClustersInternalServerError { return &PostClustersInternalServerError{} } -/*PostClustersInternalServerError handles this case with default header values. +/* PostClustersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostClustersInternalServerError struct { func (o *PostClustersInternalServerError) Error() string { return fmt.Sprintf("[POST /clusters][%d] postClustersInternalServerError %+v", 500, o.Payload) } - func (o *PostClustersInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/clusters/put_clusters_parameters.go b/api/sf-gate/sf_gate_client/clusters/put_clusters_parameters.go index e59f67d..a928d91 100644 --- a/api/sf-gate/sf_gate_client/clusters/put_clusters_parameters.go +++ b/api/sf-gate/sf_gate_client/clusters/put_clusters_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutClustersParams creates a new PutClustersParams object -// with the default values initialized. +// NewPutClustersParams creates a new PutClustersParams 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 NewPutClustersParams() *PutClustersParams { - var () return &PutClustersParams{ - timeout: cr.DefaultTimeout, } } // NewPutClustersParamsWithTimeout creates a new PutClustersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutClustersParamsWithTimeout(timeout time.Duration) *PutClustersParams { - var () return &PutClustersParams{ - timeout: timeout, } } // NewPutClustersParamsWithContext creates a new PutClustersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutClustersParamsWithContext(ctx context.Context) *PutClustersParams { - var () return &PutClustersParams{ - Context: ctx, } } // NewPutClustersParamsWithHTTPClient creates a new PutClustersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutClustersParamsWithHTTPClient(client *http.Client) *PutClustersParams { - var () return &PutClustersParams{ HTTPClient: client, } } -/*PutClustersParams contains all the parameters to send to the API endpoint -for the put clusters operation typically these are written to a http.Request +/* PutClustersParams contains all the parameters to send to the API endpoint + for the put clusters operation. + + Typically these are written to a http.Request. */ type PutClustersParams struct { - /*ClusterRequest - An array of Cluster records + /* ClusterRequest. + An array of Cluster records */ ClusterRequest *sf_gate_models.ClusterRequest @@ -77,6 +76,21 @@ type PutClustersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutClustersParams) WithDefaults() *PutClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutClustersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put clusters params func (o *PutClustersParams) WithTimeout(timeout time.Duration) *PutClustersParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ClusterRequest != nil { if err := r.SetBodyParam(o.ClusterRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/clusters/put_clusters_responses.go b/api/sf-gate/sf_gate_client/clusters/put_clusters_responses.go index 810ae57..feda506 100644 --- a/api/sf-gate/sf_gate_client/clusters/put_clusters_responses.go +++ b/api/sf-gate/sf_gate_client/clusters/put_clusters_responses.go @@ -63,9 +63,8 @@ func (o *PutClustersReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutClustersOK() *PutClustersOK { return &PutClustersOK{} } -/*PutClustersOK handles this case with default header values. +/* PutClustersOK describes a response with status code 200, with default header values. Taxnexus Response with Cluster objects */ @@ -85,7 +84,6 @@ type PutClustersOK struct { func (o *PutClustersOK) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersOK %+v", 200, o.Payload) } - func (o *PutClustersOK) GetPayload() *sf_gate_models.ClusterResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPutClustersUnauthorized() *PutClustersUnauthorized { return &PutClustersUnauthorized{} } -/*PutClustersUnauthorized handles this case with default header values. +/* PutClustersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PutClustersUnauthorized struct { func (o *PutClustersUnauthorized) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersUnauthorized %+v", 401, o.Payload) } - func (o *PutClustersUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPutClustersForbidden() *PutClustersForbidden { return &PutClustersForbidden{} } -/*PutClustersForbidden handles this case with default header values. +/* PutClustersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PutClustersForbidden struct { func (o *PutClustersForbidden) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersForbidden %+v", 403, o.Payload) } - func (o *PutClustersForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPutClustersNotFound() *PutClustersNotFound { return &PutClustersNotFound{} } -/*PutClustersNotFound handles this case with default header values. +/* PutClustersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PutClustersNotFound struct { func (o *PutClustersNotFound) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersNotFound %+v", 404, o.Payload) } - func (o *PutClustersNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPutClustersUnprocessableEntity() *PutClustersUnprocessableEntity { return &PutClustersUnprocessableEntity{} } -/*PutClustersUnprocessableEntity handles this case with default header values. +/* PutClustersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PutClustersUnprocessableEntity struct { func (o *PutClustersUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutClustersUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPutClustersInternalServerError() *PutClustersInternalServerError { return &PutClustersInternalServerError{} } -/*PutClustersInternalServerError handles this case with default header values. +/* PutClustersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PutClustersInternalServerError struct { func (o *PutClustersInternalServerError) Error() string { return fmt.Sprintf("[PUT /clusters][%d] putClustersInternalServerError %+v", 500, o.Payload) } - func (o *PutClustersInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/companies/companies_client.go b/api/sf-gate/sf_gate_client/companies/companies_client.go index 46e09fb..c5f8826 100644 --- a/api/sf-gate/sf_gate_client/companies/companies_client.go +++ b/api/sf-gate/sf_gate_client/companies/companies_client.go @@ -29,9 +29,12 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCompaniesOK, error) + GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Retrieve a Company record from the datastore */ -func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCompaniesOK, error) { +func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCompaniesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCompaniesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCompanies", Method: "GET", PathPattern: "/companies", @@ -59,7 +61,12 @@ func (a *Client) GetCompanies(params *GetCompaniesParams, authInfo runtime.Clien 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 } diff --git a/api/sf-gate/sf_gate_client/companies/get_companies_parameters.go b/api/sf-gate/sf_gate_client/companies/get_companies_parameters.go index 695a0ab..a699c8c 100644 --- a/api/sf-gate/sf_gate_client/companies/get_companies_parameters.go +++ b/api/sf-gate/sf_gate_client/companies/get_companies_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCompaniesParams creates a new GetCompaniesParams object -// with the default values initialized. +// NewGetCompaniesParams creates a new GetCompaniesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetCompaniesParams() *GetCompaniesParams { - var () return &GetCompaniesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCompaniesParamsWithTimeout creates a new GetCompaniesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCompaniesParamsWithTimeout(timeout time.Duration) *GetCompaniesParams { - var () return &GetCompaniesParams{ - timeout: timeout, } } // NewGetCompaniesParamsWithContext creates a new GetCompaniesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCompaniesParamsWithContext(ctx context.Context) *GetCompaniesParams { - var () return &GetCompaniesParams{ - Context: ctx, } } // NewGetCompaniesParamsWithHTTPClient creates a new GetCompaniesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCompaniesParamsWithHTTPClient(client *http.Client) *GetCompaniesParams { - var () return &GetCompaniesParams{ HTTPClient: client, } } -/*GetCompaniesParams contains all the parameters to send to the API endpoint -for the get companies operation typically these are written to a http.Request +/* GetCompaniesParams contains all the parameters to send to the API endpoint + for the get companies operation. + + Typically these are written to a http.Request. */ type GetCompaniesParams struct { - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetCompaniesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get companies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompaniesParams) WithDefaults() *GetCompaniesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get companies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompaniesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get companies params func (o *GetCompaniesParams) WithTimeout(timeout time.Duration) *GetCompaniesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetCompaniesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 { diff --git a/api/sf-gate/sf_gate_client/companies/get_companies_responses.go b/api/sf-gate/sf_gate_client/companies/get_companies_responses.go index 701b762..7dc9a7f 100644 --- a/api/sf-gate/sf_gate_client/companies/get_companies_responses.go +++ b/api/sf-gate/sf_gate_client/companies/get_companies_responses.go @@ -63,9 +63,8 @@ func (o *GetCompaniesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetCompaniesOK() *GetCompaniesOK { return &GetCompaniesOK{} } -/*GetCompaniesOK handles this case with default header values. +/* GetCompaniesOK describes a response with status code 200, with default header values. Taxnexus Response with Company objects */ @@ -85,7 +84,6 @@ type GetCompaniesOK struct { func (o *GetCompaniesOK) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesOK %+v", 200, o.Payload) } - func (o *GetCompaniesOK) GetPayload() *sf_gate_models.CompanyResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetCompaniesUnauthorized() *GetCompaniesUnauthorized { return &GetCompaniesUnauthorized{} } -/*GetCompaniesUnauthorized handles this case with default header values. +/* GetCompaniesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetCompaniesUnauthorized struct { func (o *GetCompaniesUnauthorized) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesUnauthorized %+v", 401, o.Payload) } - func (o *GetCompaniesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetCompaniesForbidden() *GetCompaniesForbidden { return &GetCompaniesForbidden{} } -/*GetCompaniesForbidden handles this case with default header values. +/* GetCompaniesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetCompaniesForbidden struct { func (o *GetCompaniesForbidden) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesForbidden %+v", 403, o.Payload) } - func (o *GetCompaniesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetCompaniesNotFound() *GetCompaniesNotFound { return &GetCompaniesNotFound{} } -/*GetCompaniesNotFound handles this case with default header values. +/* GetCompaniesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetCompaniesNotFound struct { func (o *GetCompaniesNotFound) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesNotFound %+v", 404, o.Payload) } - func (o *GetCompaniesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetCompaniesUnprocessableEntity() *GetCompaniesUnprocessableEntity { return &GetCompaniesUnprocessableEntity{} } -/*GetCompaniesUnprocessableEntity handles this case with default header values. +/* GetCompaniesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetCompaniesUnprocessableEntity struct { func (o *GetCompaniesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCompaniesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetCompaniesInternalServerError() *GetCompaniesInternalServerError { return &GetCompaniesInternalServerError{} } -/*GetCompaniesInternalServerError handles this case with default header values. +/* GetCompaniesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetCompaniesInternalServerError struct { func (o *GetCompaniesInternalServerError) Error() string { return fmt.Sprintf("[GET /companies][%d] getCompaniesInternalServerError %+v", 500, o.Payload) } - func (o *GetCompaniesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/contacts/contacts_client.go b/api/sf-gate/sf_gate_client/contacts/contacts_client.go index 0babc52..1a4d3be 100644 --- a/api/sf-gate/sf_gate_client/contacts/contacts_client.go +++ b/api/sf-gate/sf_gate_client/contacts/contacts_client.go @@ -29,15 +29,18 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteContactOK, error) + DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) - GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter) (*GetContactsOK, error) + GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) - PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PostContactsOK, error) + PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) - PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PutContactsOK, error) + PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -47,13 +50,12 @@ type ClientService interface { Delete Taxnexus Contact record */ -func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteContactOK, error) { +func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteContactOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteContactParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "deleteContact", Method: "DELETE", PathPattern: "/contacts", @@ -65,7 +67,12 @@ func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.Cli 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 } @@ -84,13 +91,12 @@ func (a *Client) DeleteContact(params *DeleteContactParams, authInfo runtime.Cli Return a list of all available Contacts */ -func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter) (*GetContactsOK, error) { +func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetContactsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetContactsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getContacts", Method: "GET", PathPattern: "/contacts", @@ -102,7 +108,12 @@ func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientA 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 } @@ -121,13 +132,12 @@ func (a *Client) GetContacts(params *GetContactsParams, authInfo runtime.ClientA Contact record to be added */ -func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PostContactsOK, error) { +func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostContactsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostContactsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postContacts", Method: "POST", PathPattern: "/contacts", @@ -139,7 +149,12 @@ func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.Clien 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 } @@ -158,13 +173,12 @@ func (a *Client) PostContacts(params *PostContactsParams, authInfo runtime.Clien Update Contact records */ -func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter) (*PutContactsOK, error) { +func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutContactsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutContactsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putContacts", Method: "PUT", PathPattern: "/contacts", @@ -176,7 +190,12 @@ func (a *Client) PutContacts(params *PutContactsParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/contacts/delete_contact_parameters.go b/api/sf-gate/sf_gate_client/contacts/delete_contact_parameters.go index be886e3..2f63e27 100644 --- a/api/sf-gate/sf_gate_client/contacts/delete_contact_parameters.go +++ b/api/sf-gate/sf_gate_client/contacts/delete_contact_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDeleteContactParams creates a new DeleteContactParams object -// with the default values initialized. +// NewDeleteContactParams creates a new DeleteContactParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDeleteContactParams() *DeleteContactParams { - var () return &DeleteContactParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteContactParamsWithTimeout creates a new DeleteContactParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteContactParamsWithTimeout(timeout time.Duration) *DeleteContactParams { - var () return &DeleteContactParams{ - timeout: timeout, } } // NewDeleteContactParamsWithContext creates a new DeleteContactParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteContactParamsWithContext(ctx context.Context) *DeleteContactParams { - var () return &DeleteContactParams{ - Context: ctx, } } // NewDeleteContactParamsWithHTTPClient creates a new DeleteContactParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteContactParamsWithHTTPClient(client *http.Client) *DeleteContactParams { - var () return &DeleteContactParams{ HTTPClient: client, } } -/*DeleteContactParams contains all the parameters to send to the API endpoint -for the delete contact operation typically these are written to a http.Request +/* DeleteContactParams contains all the parameters to send to the API endpoint + for the delete contact operation. + + Typically these are written to a http.Request. */ type DeleteContactParams struct { - /*ContactID - Taxnexus Id of the Contact to be retrieved + /* ContactID. + Taxnexus Id of the Contact to be retrieved */ ContactID *string @@ -75,6 +74,21 @@ type DeleteContactParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete contact params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteContactParams) WithDefaults() *DeleteContactParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete contact params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteContactParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete contact params func (o *DeleteContactParams) WithTimeout(timeout time.Duration) *DeleteContactParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *DeleteContactParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // query param contactId var qrContactID string + if o.ContactID != nil { qrContactID = *o.ContactID } qContactID := qrContactID if qContactID != "" { + if err := r.SetQueryParam("contactId", qContactID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/contacts/delete_contact_responses.go b/api/sf-gate/sf_gate_client/contacts/delete_contact_responses.go index ac250cd..ea3623e 100644 --- a/api/sf-gate/sf_gate_client/contacts/delete_contact_responses.go +++ b/api/sf-gate/sf_gate_client/contacts/delete_contact_responses.go @@ -10,6 +10,7 @@ package contacts // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" "strconv" @@ -60,9 +61,8 @@ func (o *DeleteContactReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -71,7 +71,7 @@ func NewDeleteContactOK() *DeleteContactOK { return &DeleteContactOK{} } -/*DeleteContactOK handles this case with default header values. +/* DeleteContactOK describes a response with status code 200, with default header values. An array of Message Objects with Delete Status */ @@ -82,7 +82,6 @@ type DeleteContactOK struct { func (o *DeleteContactOK) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactOK %+v", 200, o.Payload) } - func (o *DeleteContactOK) GetPayload() *DeleteContactOKBody { return o.Payload } @@ -104,7 +103,7 @@ func NewDeleteContactUnauthorized() *DeleteContactUnauthorized { return &DeleteContactUnauthorized{} } -/*DeleteContactUnauthorized handles this case with default header values. +/* DeleteContactUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -115,7 +114,6 @@ type DeleteContactUnauthorized struct { func (o *DeleteContactUnauthorized) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactUnauthorized %+v", 401, o.Payload) } - func (o *DeleteContactUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -137,7 +135,7 @@ func NewDeleteContactForbidden() *DeleteContactForbidden { return &DeleteContactForbidden{} } -/*DeleteContactForbidden handles this case with default header values. +/* DeleteContactForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -148,7 +146,6 @@ type DeleteContactForbidden struct { func (o *DeleteContactForbidden) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactForbidden %+v", 403, o.Payload) } - func (o *DeleteContactForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -170,7 +167,7 @@ func NewDeleteContactNotFound() *DeleteContactNotFound { return &DeleteContactNotFound{} } -/*DeleteContactNotFound handles this case with default header values. +/* DeleteContactNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -181,7 +178,6 @@ type DeleteContactNotFound struct { func (o *DeleteContactNotFound) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactNotFound %+v", 404, o.Payload) } - func (o *DeleteContactNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -203,7 +199,7 @@ func NewDeleteContactInternalServerError() *DeleteContactInternalServerError { return &DeleteContactInternalServerError{} } -/*DeleteContactInternalServerError handles this case with default header values. +/* DeleteContactInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -214,7 +210,6 @@ type DeleteContactInternalServerError struct { func (o *DeleteContactInternalServerError) Error() string { return fmt.Sprintf("[DELETE /contacts][%d] deleteContactInternalServerError %+v", 500, o.Payload) } - func (o *DeleteContactInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -262,7 +257,6 @@ func (o *DeleteContactOKBody) Validate(formats strfmt.Registry) error { } func (o *DeleteContactOKBody) validateData(formats strfmt.Registry) error { - if swag.IsZero(o.Data) { // not required return nil } @@ -287,7 +281,6 @@ func (o *DeleteContactOKBody) validateData(formats strfmt.Registry) error { } func (o *DeleteContactOKBody) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(o.Meta) { // not required return nil } @@ -304,6 +297,56 @@ func (o *DeleteContactOKBody) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this delete contact o k body based on the context it is used +func (o *DeleteContactOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeleteContactOKBody) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(o.Data); i++ { + + if o.Data[i] != nil { + if err := o.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deleteContactOK" + "." + "data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (o *DeleteContactOKBody) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if o.Meta != nil { + if err := o.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deleteContactOK" + "." + "meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (o *DeleteContactOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/api/sf-gate/sf_gate_client/contacts/get_contacts_parameters.go b/api/sf-gate/sf_gate_client/contacts/get_contacts_parameters.go index b6cc08b..59f180d 100644 --- a/api/sf-gate/sf_gate_client/contacts/get_contacts_parameters.go +++ b/api/sf-gate/sf_gate_client/contacts/get_contacts_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetContactsParams creates a new GetContactsParams object -// with the default values initialized. +// NewGetContactsParams creates a new GetContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetContactsParams() *GetContactsParams { - var () return &GetContactsParams{ - timeout: cr.DefaultTimeout, } } // NewGetContactsParamsWithTimeout creates a new GetContactsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetContactsParamsWithTimeout(timeout time.Duration) *GetContactsParams { - var () return &GetContactsParams{ - timeout: timeout, } } // NewGetContactsParamsWithContext creates a new GetContactsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetContactsParamsWithContext(ctx context.Context) *GetContactsParams { - var () return &GetContactsParams{ - Context: ctx, } } // NewGetContactsParamsWithHTTPClient creates a new GetContactsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetContactsParamsWithHTTPClient(client *http.Client) *GetContactsParams { - var () return &GetContactsParams{ HTTPClient: client, } } -/*GetContactsParams contains all the parameters to send to the API endpoint -for the get contacts operation typically these are written to a http.Request +/* GetContactsParams contains all the parameters to send to the API endpoint + for the get contacts operation. + + Typically these are written to a http.Request. */ type GetContactsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*ContactID - Taxnexus Id of the Contact to be retrieved + /* ContactID. + + Taxnexus Id of the Contact to be retrieved */ ContactID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetContactsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContactsParams) WithDefaults() *GetContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContactsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get contacts params func (o *GetContactsParams) WithTimeout(timeout time.Duration) *GetContactsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.ContactID != nil { // query param contactId var qrContactID string + if o.ContactID != nil { qrContactID = *o.ContactID } qContactID := qrContactID if qContactID != "" { + if err := r.SetQueryParam("contactId", qContactID); err != nil { return err } } - } if o.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 { diff --git a/api/sf-gate/sf_gate_client/contacts/get_contacts_responses.go b/api/sf-gate/sf_gate_client/contacts/get_contacts_responses.go index bb99207..9bf0570 100644 --- a/api/sf-gate/sf_gate_client/contacts/get_contacts_responses.go +++ b/api/sf-gate/sf_gate_client/contacts/get_contacts_responses.go @@ -63,9 +63,8 @@ func (o *GetContactsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetContactsOK() *GetContactsOK { return &GetContactsOK{} } -/*GetContactsOK handles this case with default header values. +/* GetContactsOK describes a response with status code 200, with default header values. An array of Contact objects */ @@ -85,7 +84,6 @@ type GetContactsOK struct { func (o *GetContactsOK) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsOK %+v", 200, o.Payload) } - func (o *GetContactsOK) GetPayload() *sf_gate_models.ContactResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetContactsUnauthorized() *GetContactsUnauthorized { return &GetContactsUnauthorized{} } -/*GetContactsUnauthorized handles this case with default header values. +/* GetContactsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetContactsUnauthorized struct { func (o *GetContactsUnauthorized) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsUnauthorized %+v", 401, o.Payload) } - func (o *GetContactsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetContactsForbidden() *GetContactsForbidden { return &GetContactsForbidden{} } -/*GetContactsForbidden handles this case with default header values. +/* GetContactsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetContactsForbidden struct { func (o *GetContactsForbidden) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsForbidden %+v", 403, o.Payload) } - func (o *GetContactsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetContactsNotFound() *GetContactsNotFound { return &GetContactsNotFound{} } -/*GetContactsNotFound handles this case with default header values. +/* GetContactsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetContactsNotFound struct { func (o *GetContactsNotFound) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsNotFound %+v", 404, o.Payload) } - func (o *GetContactsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetContactsUnprocessableEntity() *GetContactsUnprocessableEntity { return &GetContactsUnprocessableEntity{} } -/*GetContactsUnprocessableEntity handles this case with default header values. +/* GetContactsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetContactsUnprocessableEntity struct { func (o *GetContactsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetContactsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetContactsInternalServerError() *GetContactsInternalServerError { return &GetContactsInternalServerError{} } -/*GetContactsInternalServerError handles this case with default header values. +/* GetContactsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetContactsInternalServerError struct { func (o *GetContactsInternalServerError) Error() string { return fmt.Sprintf("[GET /contacts][%d] getContactsInternalServerError %+v", 500, o.Payload) } - func (o *GetContactsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/contacts/post_contacts_parameters.go b/api/sf-gate/sf_gate_client/contacts/post_contacts_parameters.go index 3083040..0a9abc4 100644 --- a/api/sf-gate/sf_gate_client/contacts/post_contacts_parameters.go +++ b/api/sf-gate/sf_gate_client/contacts/post_contacts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostContactsParams creates a new PostContactsParams object -// with the default values initialized. +// NewPostContactsParams creates a new PostContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPostContactsParams() *PostContactsParams { - var () return &PostContactsParams{ - timeout: cr.DefaultTimeout, } } // NewPostContactsParamsWithTimeout creates a new PostContactsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostContactsParamsWithTimeout(timeout time.Duration) *PostContactsParams { - var () return &PostContactsParams{ - timeout: timeout, } } // NewPostContactsParamsWithContext creates a new PostContactsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostContactsParamsWithContext(ctx context.Context) *PostContactsParams { - var () return &PostContactsParams{ - Context: ctx, } } // NewPostContactsParamsWithHTTPClient creates a new PostContactsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostContactsParamsWithHTTPClient(client *http.Client) *PostContactsParams { - var () return &PostContactsParams{ HTTPClient: client, } } -/*PostContactsParams contains all the parameters to send to the API endpoint -for the post contacts operation typically these are written to a http.Request +/* PostContactsParams contains all the parameters to send to the API endpoint + for the post contacts operation. + + Typically these are written to a http.Request. */ type PostContactsParams struct { - /*ContactsRequest - An array of new Contact records + /* ContactsRequest. + An array of new Contact records */ ContactsRequest *sf_gate_models.ContactRequest @@ -77,6 +76,21 @@ type PostContactsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostContactsParams) WithDefaults() *PostContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostContactsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post contacts params func (o *PostContactsParams) WithTimeout(timeout time.Duration) *PostContactsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.ContactsRequest != nil { if err := r.SetBodyParam(o.ContactsRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/contacts/post_contacts_responses.go b/api/sf-gate/sf_gate_client/contacts/post_contacts_responses.go index 3fd7019..b510013 100644 --- a/api/sf-gate/sf_gate_client/contacts/post_contacts_responses.go +++ b/api/sf-gate/sf_gate_client/contacts/post_contacts_responses.go @@ -57,9 +57,8 @@ func (o *PostContactsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostContactsOK() *PostContactsOK { return &PostContactsOK{} } -/*PostContactsOK handles this case with default header values. +/* PostContactsOK describes a response with status code 200, with default header values. An array of Contact objects */ @@ -79,7 +78,6 @@ type PostContactsOK struct { func (o *PostContactsOK) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsOK %+v", 200, o.Payload) } - func (o *PostContactsOK) GetPayload() *sf_gate_models.ContactResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostContactsUnauthorized() *PostContactsUnauthorized { return &PostContactsUnauthorized{} } -/*PostContactsUnauthorized handles this case with default header values. +/* PostContactsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostContactsUnauthorized struct { func (o *PostContactsUnauthorized) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsUnauthorized %+v", 401, o.Payload) } - func (o *PostContactsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostContactsForbidden() *PostContactsForbidden { return &PostContactsForbidden{} } -/*PostContactsForbidden handles this case with default header values. +/* PostContactsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostContactsForbidden struct { func (o *PostContactsForbidden) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsForbidden %+v", 403, o.Payload) } - func (o *PostContactsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostContactsNotFound() *PostContactsNotFound { return &PostContactsNotFound{} } -/*PostContactsNotFound handles this case with default header values. +/* PostContactsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostContactsNotFound struct { func (o *PostContactsNotFound) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsNotFound %+v", 404, o.Payload) } - func (o *PostContactsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostContactsInternalServerError() *PostContactsInternalServerError { return &PostContactsInternalServerError{} } -/*PostContactsInternalServerError handles this case with default header values. +/* PostContactsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostContactsInternalServerError struct { func (o *PostContactsInternalServerError) Error() string { return fmt.Sprintf("[POST /contacts][%d] postContactsInternalServerError %+v", 500, o.Payload) } - func (o *PostContactsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/contacts/put_contacts_parameters.go b/api/sf-gate/sf_gate_client/contacts/put_contacts_parameters.go index 622ce02..9e775c1 100644 --- a/api/sf-gate/sf_gate_client/contacts/put_contacts_parameters.go +++ b/api/sf-gate/sf_gate_client/contacts/put_contacts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutContactsParams creates a new PutContactsParams object -// with the default values initialized. +// NewPutContactsParams creates a new PutContactsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPutContactsParams() *PutContactsParams { - var () return &PutContactsParams{ - timeout: cr.DefaultTimeout, } } // NewPutContactsParamsWithTimeout creates a new PutContactsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutContactsParamsWithTimeout(timeout time.Duration) *PutContactsParams { - var () return &PutContactsParams{ - timeout: timeout, } } // NewPutContactsParamsWithContext creates a new PutContactsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutContactsParamsWithContext(ctx context.Context) *PutContactsParams { - var () return &PutContactsParams{ - Context: ctx, } } // NewPutContactsParamsWithHTTPClient creates a new PutContactsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutContactsParamsWithHTTPClient(client *http.Client) *PutContactsParams { - var () return &PutContactsParams{ HTTPClient: client, } } -/*PutContactsParams contains all the parameters to send to the API endpoint -for the put contacts operation typically these are written to a http.Request +/* PutContactsParams contains all the parameters to send to the API endpoint + for the put contacts operation. + + Typically these are written to a http.Request. */ type PutContactsParams struct { - /*ContactsRequest - An array of new Contact records + /* ContactsRequest. + An array of new Contact records */ ContactsRequest *sf_gate_models.ContactRequest @@ -77,6 +76,21 @@ type PutContactsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutContactsParams) WithDefaults() *PutContactsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put contacts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutContactsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put contacts params func (o *PutContactsParams) WithTimeout(timeout time.Duration) *PutContactsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutContactsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ContactsRequest != nil { if err := r.SetBodyParam(o.ContactsRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/contacts/put_contacts_responses.go b/api/sf-gate/sf_gate_client/contacts/put_contacts_responses.go index b1b038f..f7aff23 100644 --- a/api/sf-gate/sf_gate_client/contacts/put_contacts_responses.go +++ b/api/sf-gate/sf_gate_client/contacts/put_contacts_responses.go @@ -57,9 +57,8 @@ func (o *PutContactsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutContactsOK() *PutContactsOK { return &PutContactsOK{} } -/*PutContactsOK handles this case with default header values. +/* PutContactsOK describes a response with status code 200, with default header values. An array of Contact objects */ @@ -79,7 +78,6 @@ type PutContactsOK struct { func (o *PutContactsOK) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsOK %+v", 200, o.Payload) } - func (o *PutContactsOK) GetPayload() *sf_gate_models.ContactResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutContactsUnauthorized() *PutContactsUnauthorized { return &PutContactsUnauthorized{} } -/*PutContactsUnauthorized handles this case with default header values. +/* PutContactsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutContactsUnauthorized struct { func (o *PutContactsUnauthorized) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsUnauthorized %+v", 401, o.Payload) } - func (o *PutContactsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutContactsForbidden() *PutContactsForbidden { return &PutContactsForbidden{} } -/*PutContactsForbidden handles this case with default header values. +/* PutContactsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutContactsForbidden struct { func (o *PutContactsForbidden) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsForbidden %+v", 403, o.Payload) } - func (o *PutContactsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutContactsNotFound() *PutContactsNotFound { return &PutContactsNotFound{} } -/*PutContactsNotFound handles this case with default header values. +/* PutContactsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutContactsNotFound struct { func (o *PutContactsNotFound) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsNotFound %+v", 404, o.Payload) } - func (o *PutContactsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutContactsInternalServerError() *PutContactsInternalServerError { return &PutContactsInternalServerError{} } -/*PutContactsInternalServerError handles this case with default header values. +/* PutContactsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutContactsInternalServerError struct { func (o *PutContactsInternalServerError) Error() string { return fmt.Sprintf("[PUT /contacts][%d] putContactsInternalServerError %+v", 500, o.Payload) } - func (o *PutContactsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/counties/counties_client.go b/api/sf-gate/sf_gate_client/counties/counties_client.go index b254937..e58bcc4 100644 --- a/api/sf-gate/sf_gate_client/counties/counties_client.go +++ b/api/sf-gate/sf_gate_client/counties/counties_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountiesOK, error) + GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountiesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Retrieve Counties, filter with parameters */ -func (a *Client) GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountiesOK, error) { +func (a *Client) GetCounties(params *GetCountiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountiesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountiesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCounties", Method: "GET", PathPattern: "/counties", @@ -59,7 +61,12 @@ func (a *Client) GetCounties(params *GetCountiesParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/counties/get_counties_parameters.go b/api/sf-gate/sf_gate_client/counties/get_counties_parameters.go index c01339f..3c383c6 100644 --- a/api/sf-gate/sf_gate_client/counties/get_counties_parameters.go +++ b/api/sf-gate/sf_gate_client/counties/get_counties_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCountiesParams creates a new GetCountiesParams object -// with the default values initialized. +// NewGetCountiesParams creates a new GetCountiesParams 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 NewGetCountiesParams() *GetCountiesParams { - var () return &GetCountiesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountiesParamsWithTimeout creates a new GetCountiesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountiesParamsWithTimeout(timeout time.Duration) *GetCountiesParams { - var () return &GetCountiesParams{ - timeout: timeout, } } // NewGetCountiesParamsWithContext creates a new GetCountiesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountiesParamsWithContext(ctx context.Context) *GetCountiesParams { - var () return &GetCountiesParams{ - Context: ctx, } } // NewGetCountiesParamsWithHTTPClient creates a new GetCountiesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountiesParamsWithHTTPClient(client *http.Client) *GetCountiesParams { - var () return &GetCountiesParams{ HTTPClient: client, } } -/*GetCountiesParams contains all the parameters to send to the API endpoint -for the get counties operation typically these are written to a http.Request +/* GetCountiesParams contains all the parameters to send to the API endpoint + for the get counties operation. + + Typically these are written to a http.Request. */ type GetCountiesParams struct { - /*CountyID - The County Taxnexus ID + /* CountyID. + The County Taxnexus ID */ CountyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string @@ -91,6 +97,21 @@ type GetCountiesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get counties params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesParams) WithDefaults() *GetCountiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get counties params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountiesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get counties params func (o *GetCountiesParams) WithTimeout(timeout time.Duration) *GetCountiesParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetCountiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param countyId var qrCountyID string + if o.CountyID != nil { qrCountyID = *o.CountyID } qCountyID := qrCountyID if qCountyID != "" { + if err := r.SetQueryParam("countyId", qCountyID); 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 o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/counties/get_counties_responses.go b/api/sf-gate/sf_gate_client/counties/get_counties_responses.go index b2e00b1..f303c33 100644 --- a/api/sf-gate/sf_gate_client/counties/get_counties_responses.go +++ b/api/sf-gate/sf_gate_client/counties/get_counties_responses.go @@ -63,9 +63,8 @@ func (o *GetCountiesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetCountiesOK() *GetCountiesOK { return &GetCountiesOK{} } -/*GetCountiesOK handles this case with default header values. +/* GetCountiesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of County objects */ @@ -85,7 +84,6 @@ type GetCountiesOK struct { func (o *GetCountiesOK) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesOK %+v", 200, o.Payload) } - func (o *GetCountiesOK) GetPayload() *sf_gate_models.CountyResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetCountiesUnauthorized() *GetCountiesUnauthorized { return &GetCountiesUnauthorized{} } -/*GetCountiesUnauthorized handles this case with default header values. +/* GetCountiesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetCountiesUnauthorized struct { func (o *GetCountiesUnauthorized) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesUnauthorized %+v", 401, o.Payload) } - func (o *GetCountiesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetCountiesForbidden() *GetCountiesForbidden { return &GetCountiesForbidden{} } -/*GetCountiesForbidden handles this case with default header values. +/* GetCountiesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetCountiesForbidden struct { func (o *GetCountiesForbidden) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesForbidden %+v", 403, o.Payload) } - func (o *GetCountiesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetCountiesNotFound() *GetCountiesNotFound { return &GetCountiesNotFound{} } -/*GetCountiesNotFound handles this case with default header values. +/* GetCountiesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetCountiesNotFound struct { func (o *GetCountiesNotFound) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesNotFound %+v", 404, o.Payload) } - func (o *GetCountiesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetCountiesUnprocessableEntity() *GetCountiesUnprocessableEntity { return &GetCountiesUnprocessableEntity{} } -/*GetCountiesUnprocessableEntity handles this case with default header values. +/* GetCountiesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetCountiesUnprocessableEntity struct { func (o *GetCountiesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCountiesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetCountiesInternalServerError() *GetCountiesInternalServerError { return &GetCountiesInternalServerError{} } -/*GetCountiesInternalServerError handles this case with default header values. +/* GetCountiesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetCountiesInternalServerError struct { func (o *GetCountiesInternalServerError) Error() string { return fmt.Sprintf("[GET /counties][%d] getCountiesInternalServerError %+v", 500, o.Payload) } - func (o *GetCountiesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/countries/countries_client.go b/api/sf-gate/sf_gate_client/countries/countries_client.go index 7066a8a..21112ba 100644 --- a/api/sf-gate/sf_gate_client/countries/countries_client.go +++ b/api/sf-gate/sf_gate_client/countries/countries_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountriesOK, error) + GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountriesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Retrieve Countries, filter with parameters */ -func (a *Client) GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCountriesOK, error) { +func (a *Client) GetCountries(params *GetCountriesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCountriesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCountriesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getCountries", Method: "GET", PathPattern: "/countries", @@ -59,7 +61,12 @@ func (a *Client) GetCountries(params *GetCountriesParams, authInfo runtime.Clien 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 } diff --git a/api/sf-gate/sf_gate_client/countries/get_countries_parameters.go b/api/sf-gate/sf_gate_client/countries/get_countries_parameters.go index 139b089..92cdca2 100644 --- a/api/sf-gate/sf_gate_client/countries/get_countries_parameters.go +++ b/api/sf-gate/sf_gate_client/countries/get_countries_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetCountriesParams creates a new GetCountriesParams object -// with the default values initialized. +// NewGetCountriesParams creates a new GetCountriesParams 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 NewGetCountriesParams() *GetCountriesParams { - var () return &GetCountriesParams{ - timeout: cr.DefaultTimeout, } } // NewGetCountriesParamsWithTimeout creates a new GetCountriesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCountriesParamsWithTimeout(timeout time.Duration) *GetCountriesParams { - var () return &GetCountriesParams{ - timeout: timeout, } } // NewGetCountriesParamsWithContext creates a new GetCountriesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCountriesParamsWithContext(ctx context.Context) *GetCountriesParams { - var () return &GetCountriesParams{ - Context: ctx, } } // NewGetCountriesParamsWithHTTPClient creates a new GetCountriesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCountriesParamsWithHTTPClient(client *http.Client) *GetCountriesParams { - var () return &GetCountriesParams{ HTTPClient: client, } } -/*GetCountriesParams contains all the parameters to send to the API endpoint -for the get countries operation typically these are written to a http.Request +/* GetCountriesParams contains all the parameters to send to the API endpoint + for the get countries operation. + + Typically these are written to a http.Request. */ type GetCountriesParams struct { - /*CountryID - The Country Taxnexus ID + /* CountryID. + The Country Taxnexus ID */ CountryID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetCountriesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get countries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesParams) WithDefaults() *GetCountriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get countries params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCountriesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get countries params func (o *GetCountriesParams) WithTimeout(timeout time.Duration) *GetCountriesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetCountriesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param countryId var qrCountryID string + if o.CountryID != nil { qrCountryID = *o.CountryID } qCountryID := qrCountryID if qCountryID != "" { + if err := r.SetQueryParam("countryId", qCountryID); 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 { diff --git a/api/sf-gate/sf_gate_client/countries/get_countries_responses.go b/api/sf-gate/sf_gate_client/countries/get_countries_responses.go index cd5cb87..9c3134f 100644 --- a/api/sf-gate/sf_gate_client/countries/get_countries_responses.go +++ b/api/sf-gate/sf_gate_client/countries/get_countries_responses.go @@ -63,9 +63,8 @@ func (o *GetCountriesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetCountriesOK() *GetCountriesOK { return &GetCountriesOK{} } -/*GetCountriesOK handles this case with default header values. +/* GetCountriesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Country objects */ @@ -85,7 +84,6 @@ type GetCountriesOK struct { func (o *GetCountriesOK) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesOK %+v", 200, o.Payload) } - func (o *GetCountriesOK) GetPayload() *sf_gate_models.CountryResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetCountriesUnauthorized() *GetCountriesUnauthorized { return &GetCountriesUnauthorized{} } -/*GetCountriesUnauthorized handles this case with default header values. +/* GetCountriesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetCountriesUnauthorized struct { func (o *GetCountriesUnauthorized) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesUnauthorized %+v", 401, o.Payload) } - func (o *GetCountriesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetCountriesForbidden() *GetCountriesForbidden { return &GetCountriesForbidden{} } -/*GetCountriesForbidden handles this case with default header values. +/* GetCountriesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetCountriesForbidden struct { func (o *GetCountriesForbidden) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesForbidden %+v", 403, o.Payload) } - func (o *GetCountriesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetCountriesNotFound() *GetCountriesNotFound { return &GetCountriesNotFound{} } -/*GetCountriesNotFound handles this case with default header values. +/* GetCountriesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetCountriesNotFound struct { func (o *GetCountriesNotFound) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesNotFound %+v", 404, o.Payload) } - func (o *GetCountriesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetCountriesUnprocessableEntity() *GetCountriesUnprocessableEntity { return &GetCountriesUnprocessableEntity{} } -/*GetCountriesUnprocessableEntity handles this case with default header values. +/* GetCountriesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetCountriesUnprocessableEntity struct { func (o *GetCountriesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetCountriesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetCountriesInternalServerError() *GetCountriesInternalServerError { return &GetCountriesInternalServerError{} } -/*GetCountriesInternalServerError handles this case with default header values. +/* GetCountriesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetCountriesInternalServerError struct { func (o *GetCountriesInternalServerError) Error() string { return fmt.Sprintf("[GET /countries][%d] getCountriesInternalServerError %+v", 500, o.Payload) } - func (o *GetCountriesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/databases/databases_client.go b/api/sf-gate/sf_gate_client/databases/databases_client.go index 8ea639f..73f73e4 100644 --- a/api/sf-gate/sf_gate_client/databases/databases_client.go +++ b/api/sf-gate/sf_gate_client/databases/databases_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabasesOK, error) + GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabasesOK, error) - PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PostDatabasesOK, error) + PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDatabasesOK, error) - PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PutDatabasesOK, error) + PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDatabasesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Database records from the datastore */ -func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetDatabasesOK, error) { +func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDatabasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDatabasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDatabases", Method: "GET", PathPattern: "/databases", @@ -63,7 +65,12 @@ func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.Clien 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 } @@ -82,13 +89,12 @@ func (a *Client) GetDatabases(params *GetDatabasesParams, authInfo runtime.Clien Create Databases in Taxnexus */ -func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PostDatabasesOK, error) { +func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostDatabasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostDatabasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postDatabases", Method: "POST", PathPattern: "/databases", @@ -100,7 +106,12 @@ func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.Cli 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 } @@ -119,13 +130,12 @@ func (a *Client) PostDatabases(params *PostDatabasesParams, authInfo runtime.Cli Update Database in Taxnexus */ -func (a *Client) PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter) (*PutDatabasesOK, error) { +func (a *Client) PutDatabases(params *PutDatabasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutDatabasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutDatabasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putDatabases", Method: "PUT", PathPattern: "/databases", @@ -137,7 +147,12 @@ func (a *Client) PutDatabases(params *PutDatabasesParams, authInfo runtime.Clien 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 } diff --git a/api/sf-gate/sf_gate_client/databases/get_databases_parameters.go b/api/sf-gate/sf_gate_client/databases/get_databases_parameters.go index ff27537..fa6c381 100644 --- a/api/sf-gate/sf_gate_client/databases/get_databases_parameters.go +++ b/api/sf-gate/sf_gate_client/databases/get_databases_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetDatabasesParams creates a new GetDatabasesParams object -// with the default values initialized. +// NewGetDatabasesParams creates a new GetDatabasesParams 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 NewGetDatabasesParams() *GetDatabasesParams { - var () return &GetDatabasesParams{ - timeout: cr.DefaultTimeout, } } // NewGetDatabasesParamsWithTimeout creates a new GetDatabasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDatabasesParamsWithTimeout(timeout time.Duration) *GetDatabasesParams { - var () return &GetDatabasesParams{ - timeout: timeout, } } // NewGetDatabasesParamsWithContext creates a new GetDatabasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDatabasesParamsWithContext(ctx context.Context) *GetDatabasesParams { - var () return &GetDatabasesParams{ - Context: ctx, } } // NewGetDatabasesParamsWithHTTPClient creates a new GetDatabasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDatabasesParamsWithHTTPClient(client *http.Client) *GetDatabasesParams { - var () return &GetDatabasesParams{ HTTPClient: client, } } -/*GetDatabasesParams contains all the parameters to send to the API endpoint -for the get databases operation typically these are written to a http.Request +/* GetDatabasesParams contains all the parameters to send to the API endpoint + for the get databases operation. + + Typically these are written to a http.Request. */ type GetDatabasesParams struct { - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*DatabaseID - Taxnexus Record Id of a Database + /* DatabaseID. + + Taxnexus Record Id of a Database */ DatabaseID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -91,6 +97,21 @@ type GetDatabasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabasesParams) WithDefaults() *GetDatabasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDatabasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get databases params func (o *GetDatabasesParams) WithTimeout(timeout time.Duration) *GetDatabasesParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetDatabasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.DatabaseID != nil { // query param databaseId var qrDatabaseID string + if o.DatabaseID != nil { qrDatabaseID = *o.DatabaseID } qDatabaseID := qrDatabaseID if qDatabaseID != "" { + if err := r.SetQueryParam("databaseId", qDatabaseID); 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 { diff --git a/api/sf-gate/sf_gate_client/databases/get_databases_responses.go b/api/sf-gate/sf_gate_client/databases/get_databases_responses.go index 621d459..81cedc4 100644 --- a/api/sf-gate/sf_gate_client/databases/get_databases_responses.go +++ b/api/sf-gate/sf_gate_client/databases/get_databases_responses.go @@ -63,9 +63,8 @@ func (o *GetDatabasesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetDatabasesOK() *GetDatabasesOK { return &GetDatabasesOK{} } -/*GetDatabasesOK handles this case with default header values. +/* GetDatabasesOK describes a response with status code 200, with default header values. Taxnexus Response with Database objects */ @@ -85,7 +84,6 @@ type GetDatabasesOK struct { func (o *GetDatabasesOK) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesOK %+v", 200, o.Payload) } - func (o *GetDatabasesOK) GetPayload() *sf_gate_models.DatabaseResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetDatabasesUnauthorized() *GetDatabasesUnauthorized { return &GetDatabasesUnauthorized{} } -/*GetDatabasesUnauthorized handles this case with default header values. +/* GetDatabasesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetDatabasesUnauthorized struct { func (o *GetDatabasesUnauthorized) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesUnauthorized %+v", 401, o.Payload) } - func (o *GetDatabasesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetDatabasesForbidden() *GetDatabasesForbidden { return &GetDatabasesForbidden{} } -/*GetDatabasesForbidden handles this case with default header values. +/* GetDatabasesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetDatabasesForbidden struct { func (o *GetDatabasesForbidden) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesForbidden %+v", 403, o.Payload) } - func (o *GetDatabasesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetDatabasesNotFound() *GetDatabasesNotFound { return &GetDatabasesNotFound{} } -/*GetDatabasesNotFound handles this case with default header values. +/* GetDatabasesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetDatabasesNotFound struct { func (o *GetDatabasesNotFound) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesNotFound %+v", 404, o.Payload) } - func (o *GetDatabasesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetDatabasesUnprocessableEntity() *GetDatabasesUnprocessableEntity { return &GetDatabasesUnprocessableEntity{} } -/*GetDatabasesUnprocessableEntity handles this case with default header values. +/* GetDatabasesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetDatabasesUnprocessableEntity struct { func (o *GetDatabasesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetDatabasesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetDatabasesInternalServerError() *GetDatabasesInternalServerError { return &GetDatabasesInternalServerError{} } -/*GetDatabasesInternalServerError handles this case with default header values. +/* GetDatabasesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetDatabasesInternalServerError struct { func (o *GetDatabasesInternalServerError) Error() string { return fmt.Sprintf("[GET /databases][%d] getDatabasesInternalServerError %+v", 500, o.Payload) } - func (o *GetDatabasesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/databases/post_databases_parameters.go b/api/sf-gate/sf_gate_client/databases/post_databases_parameters.go index 5fa8e85..a93d31f 100644 --- a/api/sf-gate/sf_gate_client/databases/post_databases_parameters.go +++ b/api/sf-gate/sf_gate_client/databases/post_databases_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostDatabasesParams creates a new PostDatabasesParams object -// with the default values initialized. +// NewPostDatabasesParams creates a new PostDatabasesParams 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 NewPostDatabasesParams() *PostDatabasesParams { - var () return &PostDatabasesParams{ - timeout: cr.DefaultTimeout, } } // NewPostDatabasesParamsWithTimeout creates a new PostDatabasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostDatabasesParamsWithTimeout(timeout time.Duration) *PostDatabasesParams { - var () return &PostDatabasesParams{ - timeout: timeout, } } // NewPostDatabasesParamsWithContext creates a new PostDatabasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostDatabasesParamsWithContext(ctx context.Context) *PostDatabasesParams { - var () return &PostDatabasesParams{ - Context: ctx, } } // NewPostDatabasesParamsWithHTTPClient creates a new PostDatabasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostDatabasesParamsWithHTTPClient(client *http.Client) *PostDatabasesParams { - var () return &PostDatabasesParams{ HTTPClient: client, } } -/*PostDatabasesParams contains all the parameters to send to the API endpoint -for the post databases operation typically these are written to a http.Request +/* PostDatabasesParams contains all the parameters to send to the API endpoint + for the post databases operation. + + Typically these are written to a http.Request. */ type PostDatabasesParams struct { - /*DatabaseRequest - An array of Database records + /* DatabaseRequest. + An array of Database records */ DatabaseRequest *sf_gate_models.DatabaseRequest @@ -77,6 +76,21 @@ type PostDatabasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostDatabasesParams) WithDefaults() *PostDatabasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostDatabasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post databases params func (o *PostDatabasesParams) WithTimeout(timeout time.Duration) *PostDatabasesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostDatabasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.DatabaseRequest != nil { if err := r.SetBodyParam(o.DatabaseRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/databases/post_databases_responses.go b/api/sf-gate/sf_gate_client/databases/post_databases_responses.go index 347af93..f738a0e 100644 --- a/api/sf-gate/sf_gate_client/databases/post_databases_responses.go +++ b/api/sf-gate/sf_gate_client/databases/post_databases_responses.go @@ -63,9 +63,8 @@ func (o *PostDatabasesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostDatabasesOK() *PostDatabasesOK { return &PostDatabasesOK{} } -/*PostDatabasesOK handles this case with default header values. +/* PostDatabasesOK describes a response with status code 200, with default header values. Taxnexus Response with Database objects */ @@ -85,7 +84,6 @@ type PostDatabasesOK struct { func (o *PostDatabasesOK) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesOK %+v", 200, o.Payload) } - func (o *PostDatabasesOK) GetPayload() *sf_gate_models.DatabaseResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostDatabasesUnauthorized() *PostDatabasesUnauthorized { return &PostDatabasesUnauthorized{} } -/*PostDatabasesUnauthorized handles this case with default header values. +/* PostDatabasesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostDatabasesUnauthorized struct { func (o *PostDatabasesUnauthorized) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesUnauthorized %+v", 401, o.Payload) } - func (o *PostDatabasesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostDatabasesForbidden() *PostDatabasesForbidden { return &PostDatabasesForbidden{} } -/*PostDatabasesForbidden handles this case with default header values. +/* PostDatabasesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostDatabasesForbidden struct { func (o *PostDatabasesForbidden) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesForbidden %+v", 403, o.Payload) } - func (o *PostDatabasesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostDatabasesNotFound() *PostDatabasesNotFound { return &PostDatabasesNotFound{} } -/*PostDatabasesNotFound handles this case with default header values. +/* PostDatabasesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostDatabasesNotFound struct { func (o *PostDatabasesNotFound) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesNotFound %+v", 404, o.Payload) } - func (o *PostDatabasesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostDatabasesUnprocessableEntity() *PostDatabasesUnprocessableEntity { return &PostDatabasesUnprocessableEntity{} } -/*PostDatabasesUnprocessableEntity handles this case with default header values. +/* PostDatabasesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostDatabasesUnprocessableEntity struct { func (o *PostDatabasesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostDatabasesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostDatabasesInternalServerError() *PostDatabasesInternalServerError { return &PostDatabasesInternalServerError{} } -/*PostDatabasesInternalServerError handles this case with default header values. +/* PostDatabasesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostDatabasesInternalServerError struct { func (o *PostDatabasesInternalServerError) Error() string { return fmt.Sprintf("[POST /databases][%d] postDatabasesInternalServerError %+v", 500, o.Payload) } - func (o *PostDatabasesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/databases/put_databases_parameters.go b/api/sf-gate/sf_gate_client/databases/put_databases_parameters.go index 11d87ab..9ab8ed5 100644 --- a/api/sf-gate/sf_gate_client/databases/put_databases_parameters.go +++ b/api/sf-gate/sf_gate_client/databases/put_databases_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutDatabasesParams creates a new PutDatabasesParams object -// with the default values initialized. +// NewPutDatabasesParams creates a new PutDatabasesParams 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 NewPutDatabasesParams() *PutDatabasesParams { - var () return &PutDatabasesParams{ - timeout: cr.DefaultTimeout, } } // NewPutDatabasesParamsWithTimeout creates a new PutDatabasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutDatabasesParamsWithTimeout(timeout time.Duration) *PutDatabasesParams { - var () return &PutDatabasesParams{ - timeout: timeout, } } // NewPutDatabasesParamsWithContext creates a new PutDatabasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutDatabasesParamsWithContext(ctx context.Context) *PutDatabasesParams { - var () return &PutDatabasesParams{ - Context: ctx, } } // NewPutDatabasesParamsWithHTTPClient creates a new PutDatabasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutDatabasesParamsWithHTTPClient(client *http.Client) *PutDatabasesParams { - var () return &PutDatabasesParams{ HTTPClient: client, } } -/*PutDatabasesParams contains all the parameters to send to the API endpoint -for the put databases operation typically these are written to a http.Request +/* PutDatabasesParams contains all the parameters to send to the API endpoint + for the put databases operation. + + Typically these are written to a http.Request. */ type PutDatabasesParams struct { - /*DatabaseRequest - An array of Database records + /* DatabaseRequest. + An array of Database records */ DatabaseRequest *sf_gate_models.DatabaseRequest @@ -77,6 +76,21 @@ type PutDatabasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutDatabasesParams) WithDefaults() *PutDatabasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put databases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutDatabasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put databases params func (o *PutDatabasesParams) WithTimeout(timeout time.Duration) *PutDatabasesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutDatabasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.DatabaseRequest != nil { if err := r.SetBodyParam(o.DatabaseRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/databases/put_databases_responses.go b/api/sf-gate/sf_gate_client/databases/put_databases_responses.go index 1f7b43d..a744966 100644 --- a/api/sf-gate/sf_gate_client/databases/put_databases_responses.go +++ b/api/sf-gate/sf_gate_client/databases/put_databases_responses.go @@ -63,9 +63,8 @@ func (o *PutDatabasesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutDatabasesOK() *PutDatabasesOK { return &PutDatabasesOK{} } -/*PutDatabasesOK handles this case with default header values. +/* PutDatabasesOK describes a response with status code 200, with default header values. Taxnexus Response with Database objects */ @@ -85,7 +84,6 @@ type PutDatabasesOK struct { func (o *PutDatabasesOK) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesOK %+v", 200, o.Payload) } - func (o *PutDatabasesOK) GetPayload() *sf_gate_models.DatabaseResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPutDatabasesUnauthorized() *PutDatabasesUnauthorized { return &PutDatabasesUnauthorized{} } -/*PutDatabasesUnauthorized handles this case with default header values. +/* PutDatabasesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PutDatabasesUnauthorized struct { func (o *PutDatabasesUnauthorized) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesUnauthorized %+v", 401, o.Payload) } - func (o *PutDatabasesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPutDatabasesForbidden() *PutDatabasesForbidden { return &PutDatabasesForbidden{} } -/*PutDatabasesForbidden handles this case with default header values. +/* PutDatabasesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PutDatabasesForbidden struct { func (o *PutDatabasesForbidden) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesForbidden %+v", 403, o.Payload) } - func (o *PutDatabasesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPutDatabasesNotFound() *PutDatabasesNotFound { return &PutDatabasesNotFound{} } -/*PutDatabasesNotFound handles this case with default header values. +/* PutDatabasesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PutDatabasesNotFound struct { func (o *PutDatabasesNotFound) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesNotFound %+v", 404, o.Payload) } - func (o *PutDatabasesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPutDatabasesUnprocessableEntity() *PutDatabasesUnprocessableEntity { return &PutDatabasesUnprocessableEntity{} } -/*PutDatabasesUnprocessableEntity handles this case with default header values. +/* PutDatabasesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PutDatabasesUnprocessableEntity struct { func (o *PutDatabasesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutDatabasesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPutDatabasesInternalServerError() *PutDatabasesInternalServerError { return &PutDatabasesInternalServerError{} } -/*PutDatabasesInternalServerError handles this case with default header values. +/* PutDatabasesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PutDatabasesInternalServerError struct { func (o *PutDatabasesInternalServerError) Error() string { return fmt.Sprintf("[PUT /databases][%d] putDatabasesInternalServerError %+v", 500, o.Payload) } - func (o *PutDatabasesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/domains/domains_client.go b/api/sf-gate/sf_gate_client/domains/domains_client.go index 6481438..2e03ac4 100644 --- a/api/sf-gate/sf_gate_client/domains/domains_client.go +++ b/api/sf-gate/sf_gate_client/domains/domains_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter) (*GetDomainsOK, error) + GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return all of the Commerce Domains in the Taxnexus system. Domains categorize general categories of commerce, such as Merchandise, Wholesale Goods, Wholesale Trade, Services, etc. */ -func (a *Client) GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter) (*GetDomainsOK, error) { +func (a *Client) GetDomains(params *GetDomainsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetDomainsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetDomainsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getDomains", Method: "GET", PathPattern: "/domains", @@ -59,7 +61,12 @@ func (a *Client) GetDomains(params *GetDomainsParams, authInfo runtime.ClientAut 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 } diff --git a/api/sf-gate/sf_gate_client/domains/get_domains_parameters.go b/api/sf-gate/sf_gate_client/domains/get_domains_parameters.go index 7c90164..dd53cef 100644 --- a/api/sf-gate/sf_gate_client/domains/get_domains_parameters.go +++ b/api/sf-gate/sf_gate_client/domains/get_domains_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetDomainsParams creates a new GetDomainsParams object -// with the default values initialized. +// NewGetDomainsParams creates a new GetDomainsParams 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 NewGetDomainsParams() *GetDomainsParams { - var () return &GetDomainsParams{ - timeout: cr.DefaultTimeout, } } // NewGetDomainsParamsWithTimeout creates a new GetDomainsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetDomainsParamsWithTimeout(timeout time.Duration) *GetDomainsParams { - var () return &GetDomainsParams{ - timeout: timeout, } } // NewGetDomainsParamsWithContext creates a new GetDomainsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetDomainsParamsWithContext(ctx context.Context) *GetDomainsParams { - var () return &GetDomainsParams{ - Context: ctx, } } // NewGetDomainsParamsWithHTTPClient creates a new GetDomainsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetDomainsParamsWithHTTPClient(client *http.Client) *GetDomainsParams { - var () return &GetDomainsParams{ HTTPClient: client, } } -/*GetDomainsParams contains all the parameters to send to the API endpoint -for the get domains operation typically these are written to a http.Request +/* GetDomainsParams contains all the parameters to send to the API endpoint + for the get domains operation. + + Typically these are written to a http.Request. */ type GetDomainsParams struct { - /*Active - Retrieve only active records? + /* Active. + Retrieve only active records? */ Active *bool - /*DomainID - Taxnexus Id of the Domain to be retrieved + /* DomainID. + + Taxnexus Id of the Domain to be retrieved */ DomainID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Name - The Tax Domain to rate (cannabis, sales or telecom) + /* Name. + + The Tax Domain to rate (cannabis, sales or telecom) */ Name *string - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -96,6 +103,21 @@ type GetDomainsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get domains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsParams) WithDefaults() *GetDomainsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get domains params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDomainsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get domains params func (o *GetDomainsParams) WithTimeout(timeout time.Duration) *GetDomainsParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetDomainsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.DomainID != nil { // query param domainId var qrDomainID string + if o.DomainID != nil { qrDomainID = *o.DomainID } qDomainID := qrDomainID if qDomainID != "" { + if err := r.SetQueryParam("domainId", qDomainID); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/domains/get_domains_responses.go b/api/sf-gate/sf_gate_client/domains/get_domains_responses.go index c7f8ee3..7bab3d1 100644 --- a/api/sf-gate/sf_gate_client/domains/get_domains_responses.go +++ b/api/sf-gate/sf_gate_client/domains/get_domains_responses.go @@ -63,9 +63,8 @@ func (o *GetDomainsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetDomainsOK() *GetDomainsOK { return &GetDomainsOK{} } -/*GetDomainsOK handles this case with default header values. +/* GetDomainsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Domain objects */ @@ -85,7 +84,6 @@ type GetDomainsOK struct { func (o *GetDomainsOK) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsOK %+v", 200, o.Payload) } - func (o *GetDomainsOK) GetPayload() *sf_gate_models.DomainResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetDomainsUnauthorized() *GetDomainsUnauthorized { return &GetDomainsUnauthorized{} } -/*GetDomainsUnauthorized handles this case with default header values. +/* GetDomainsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetDomainsUnauthorized struct { func (o *GetDomainsUnauthorized) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsUnauthorized %+v", 401, o.Payload) } - func (o *GetDomainsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetDomainsForbidden() *GetDomainsForbidden { return &GetDomainsForbidden{} } -/*GetDomainsForbidden handles this case with default header values. +/* GetDomainsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetDomainsForbidden struct { func (o *GetDomainsForbidden) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsForbidden %+v", 403, o.Payload) } - func (o *GetDomainsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetDomainsNotFound() *GetDomainsNotFound { return &GetDomainsNotFound{} } -/*GetDomainsNotFound handles this case with default header values. +/* GetDomainsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetDomainsNotFound struct { func (o *GetDomainsNotFound) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsNotFound %+v", 404, o.Payload) } - func (o *GetDomainsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetDomainsUnprocessableEntity() *GetDomainsUnprocessableEntity { return &GetDomainsUnprocessableEntity{} } -/*GetDomainsUnprocessableEntity handles this case with default header values. +/* GetDomainsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetDomainsUnprocessableEntity struct { func (o *GetDomainsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetDomainsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetDomainsInternalServerError() *GetDomainsInternalServerError { return &GetDomainsInternalServerError{} } -/*GetDomainsInternalServerError handles this case with default header values. +/* GetDomainsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetDomainsInternalServerError struct { func (o *GetDomainsInternalServerError) Error() string { return fmt.Sprintf("[GET /domains][%d] getDomainsInternalServerError %+v", 500, o.Payload) } - func (o *GetDomainsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/filing_types/filing_types_client.go b/api/sf-gate/sf_gate_client/filing_types/filing_types_client.go index 0d5932c..b68ef8c 100644 --- a/api/sf-gate/sf_gate_client/filing_types/filing_types_client.go +++ b/api/sf-gate/sf_gate_client/filing_types/filing_types_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingTypesOK, error) + GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingTypesOK, error) - PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingTypesOK, error) + PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingTypesOK, error) - PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingTypesOK, error) + PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingTypesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Regulatory FilingTypes */ -func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingTypesOK, error) { +func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetFilingTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getFilingTypes", Method: "GET", PathPattern: "/filingtypes", @@ -63,7 +65,12 @@ func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.C 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 } @@ -82,13 +89,12 @@ func (a *Client) GetFilingTypes(params *GetFilingTypesParams, authInfo runtime.C Create new FilingTypes */ -func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingTypesOK, error) { +func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostFilingTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postFilingTypes", Method: "POST", PathPattern: "/filingtypes", @@ -100,7 +106,12 @@ func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime 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 } @@ -119,13 +130,12 @@ func (a *Client) PostFilingTypes(params *PostFilingTypesParams, authInfo runtime Update all the fields in a FilingType record identified by Taxnexus ID */ -func (a *Client) PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingTypesOK, error) { +func (a *Client) PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutFilingTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putFilingTypes", Method: "PUT", PathPattern: "/filingtypes", @@ -137,7 +147,12 @@ func (a *Client) PutFilingTypes(params *PutFilingTypesParams, authInfo runtime.C 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 } diff --git a/api/sf-gate/sf_gate_client/filing_types/get_filing_types_parameters.go b/api/sf-gate/sf_gate_client/filing_types/get_filing_types_parameters.go index b4fa19a..e6727b5 100644 --- a/api/sf-gate/sf_gate_client/filing_types/get_filing_types_parameters.go +++ b/api/sf-gate/sf_gate_client/filing_types/get_filing_types_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetFilingTypesParams creates a new GetFilingTypesParams object -// with the default values initialized. +// NewGetFilingTypesParams creates a new GetFilingTypesParams 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 NewGetFilingTypesParams() *GetFilingTypesParams { - var () return &GetFilingTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetFilingTypesParamsWithTimeout creates a new GetFilingTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetFilingTypesParamsWithTimeout(timeout time.Duration) *GetFilingTypesParams { - var () return &GetFilingTypesParams{ - timeout: timeout, } } // NewGetFilingTypesParamsWithContext creates a new GetFilingTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetFilingTypesParamsWithContext(ctx context.Context) *GetFilingTypesParams { - var () return &GetFilingTypesParams{ - Context: ctx, } } // NewGetFilingTypesParamsWithHTTPClient creates a new GetFilingTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetFilingTypesParamsWithHTTPClient(client *http.Client) *GetFilingTypesParams { - var () return &GetFilingTypesParams{ HTTPClient: client, } } -/*GetFilingTypesParams contains all the parameters to send to the API endpoint -for the get filing types operation typically these are written to a http.Request +/* GetFilingTypesParams contains all the parameters to send to the API endpoint + for the get filing types operation. + + Typically these are written to a http.Request. */ type GetFilingTypesParams struct { - /*FilingTypeID - Taxnexus Record Id of a Filing + /* FilingTypeID. + Taxnexus Record Id of a Filing */ FilingTypeID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetFilingTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingTypesParams) WithDefaults() *GetFilingTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get filing types params func (o *GetFilingTypesParams) WithTimeout(timeout time.Duration) *GetFilingTypesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetFilingTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param filingTypeId var qrFilingTypeID string + if o.FilingTypeID != nil { qrFilingTypeID = *o.FilingTypeID } qFilingTypeID := qrFilingTypeID if qFilingTypeID != "" { + if err := r.SetQueryParam("filingTypeId", qFilingTypeID); 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 { diff --git a/api/sf-gate/sf_gate_client/filing_types/get_filing_types_responses.go b/api/sf-gate/sf_gate_client/filing_types/get_filing_types_responses.go index 03323aa..bac9685 100644 --- a/api/sf-gate/sf_gate_client/filing_types/get_filing_types_responses.go +++ b/api/sf-gate/sf_gate_client/filing_types/get_filing_types_responses.go @@ -63,9 +63,8 @@ func (o *GetFilingTypesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetFilingTypesOK() *GetFilingTypesOK { return &GetFilingTypesOK{} } -/*GetFilingTypesOK handles this case with default header values. +/* GetFilingTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of FilingType objects */ @@ -85,7 +84,6 @@ type GetFilingTypesOK struct { func (o *GetFilingTypesOK) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesOK %+v", 200, o.Payload) } - func (o *GetFilingTypesOK) GetPayload() *sf_gate_models.FilingTypeResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetFilingTypesUnauthorized() *GetFilingTypesUnauthorized { return &GetFilingTypesUnauthorized{} } -/*GetFilingTypesUnauthorized handles this case with default header values. +/* GetFilingTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetFilingTypesUnauthorized struct { func (o *GetFilingTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetFilingTypesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetFilingTypesForbidden() *GetFilingTypesForbidden { return &GetFilingTypesForbidden{} } -/*GetFilingTypesForbidden handles this case with default header values. +/* GetFilingTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetFilingTypesForbidden struct { func (o *GetFilingTypesForbidden) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesForbidden %+v", 403, o.Payload) } - func (o *GetFilingTypesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetFilingTypesNotFound() *GetFilingTypesNotFound { return &GetFilingTypesNotFound{} } -/*GetFilingTypesNotFound handles this case with default header values. +/* GetFilingTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetFilingTypesNotFound struct { func (o *GetFilingTypesNotFound) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesNotFound %+v", 404, o.Payload) } - func (o *GetFilingTypesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetFilingTypesUnprocessableEntity() *GetFilingTypesUnprocessableEntity { return &GetFilingTypesUnprocessableEntity{} } -/*GetFilingTypesUnprocessableEntity handles this case with default header values. +/* GetFilingTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetFilingTypesUnprocessableEntity struct { func (o *GetFilingTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetFilingTypesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetFilingTypesInternalServerError() *GetFilingTypesInternalServerError { return &GetFilingTypesInternalServerError{} } -/*GetFilingTypesInternalServerError handles this case with default header values. +/* GetFilingTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetFilingTypesInternalServerError struct { func (o *GetFilingTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /filingtypes][%d] getFilingTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetFilingTypesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/filing_types/post_filing_types_parameters.go b/api/sf-gate/sf_gate_client/filing_types/post_filing_types_parameters.go index ddb42b1..ca27882 100644 --- a/api/sf-gate/sf_gate_client/filing_types/post_filing_types_parameters.go +++ b/api/sf-gate/sf_gate_client/filing_types/post_filing_types_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostFilingTypesParams creates a new PostFilingTypesParams object -// with the default values initialized. +// NewPostFilingTypesParams creates a new PostFilingTypesParams 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 NewPostFilingTypesParams() *PostFilingTypesParams { - var () return &PostFilingTypesParams{ - timeout: cr.DefaultTimeout, } } // NewPostFilingTypesParamsWithTimeout creates a new PostFilingTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostFilingTypesParamsWithTimeout(timeout time.Duration) *PostFilingTypesParams { - var () return &PostFilingTypesParams{ - timeout: timeout, } } // NewPostFilingTypesParamsWithContext creates a new PostFilingTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostFilingTypesParamsWithContext(ctx context.Context) *PostFilingTypesParams { - var () return &PostFilingTypesParams{ - Context: ctx, } } // NewPostFilingTypesParamsWithHTTPClient creates a new PostFilingTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostFilingTypesParamsWithHTTPClient(client *http.Client) *PostFilingTypesParams { - var () return &PostFilingTypesParams{ HTTPClient: client, } } -/*PostFilingTypesParams contains all the parameters to send to the API endpoint -for the post filing types operation typically these are written to a http.Request +/* PostFilingTypesParams contains all the parameters to send to the API endpoint + for the post filing types operation. + + Typically these are written to a http.Request. */ type PostFilingTypesParams struct { - /*FilingTypeRequest - A request with an array of FilingType Objects + /* FilingTypeRequest. + A request with an array of FilingType Objects */ FilingTypeRequest *sf_gate_models.FilingTypeRequest @@ -77,6 +76,21 @@ type PostFilingTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingTypesParams) WithDefaults() *PostFilingTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post filing types params func (o *PostFilingTypesParams) WithTimeout(timeout time.Duration) *PostFilingTypesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostFilingTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.FilingTypeRequest != nil { if err := r.SetBodyParam(o.FilingTypeRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/filing_types/post_filing_types_responses.go b/api/sf-gate/sf_gate_client/filing_types/post_filing_types_responses.go index 5d2ecee..36f357c 100644 --- a/api/sf-gate/sf_gate_client/filing_types/post_filing_types_responses.go +++ b/api/sf-gate/sf_gate_client/filing_types/post_filing_types_responses.go @@ -63,9 +63,8 @@ func (o *PostFilingTypesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostFilingTypesOK() *PostFilingTypesOK { return &PostFilingTypesOK{} } -/*PostFilingTypesOK handles this case with default header values. +/* PostFilingTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of FilingType objects */ @@ -85,7 +84,6 @@ type PostFilingTypesOK struct { func (o *PostFilingTypesOK) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesOK %+v", 200, o.Payload) } - func (o *PostFilingTypesOK) GetPayload() *sf_gate_models.FilingTypeResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostFilingTypesUnauthorized() *PostFilingTypesUnauthorized { return &PostFilingTypesUnauthorized{} } -/*PostFilingTypesUnauthorized handles this case with default header values. +/* PostFilingTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostFilingTypesUnauthorized struct { func (o *PostFilingTypesUnauthorized) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesUnauthorized %+v", 401, o.Payload) } - func (o *PostFilingTypesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostFilingTypesForbidden() *PostFilingTypesForbidden { return &PostFilingTypesForbidden{} } -/*PostFilingTypesForbidden handles this case with default header values. +/* PostFilingTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostFilingTypesForbidden struct { func (o *PostFilingTypesForbidden) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesForbidden %+v", 403, o.Payload) } - func (o *PostFilingTypesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostFilingTypesNotFound() *PostFilingTypesNotFound { return &PostFilingTypesNotFound{} } -/*PostFilingTypesNotFound handles this case with default header values. +/* PostFilingTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostFilingTypesNotFound struct { func (o *PostFilingTypesNotFound) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesNotFound %+v", 404, o.Payload) } - func (o *PostFilingTypesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostFilingTypesUnprocessableEntity() *PostFilingTypesUnprocessableEntity return &PostFilingTypesUnprocessableEntity{} } -/*PostFilingTypesUnprocessableEntity handles this case with default header values. +/* PostFilingTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostFilingTypesUnprocessableEntity struct { func (o *PostFilingTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostFilingTypesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostFilingTypesInternalServerError() *PostFilingTypesInternalServerError return &PostFilingTypesInternalServerError{} } -/*PostFilingTypesInternalServerError handles this case with default header values. +/* PostFilingTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostFilingTypesInternalServerError struct { func (o *PostFilingTypesInternalServerError) Error() string { return fmt.Sprintf("[POST /filingtypes][%d] postFilingTypesInternalServerError %+v", 500, o.Payload) } - func (o *PostFilingTypesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/filing_types/put_filing_types_parameters.go b/api/sf-gate/sf_gate_client/filing_types/put_filing_types_parameters.go index b097c5e..aac9b2f 100644 --- a/api/sf-gate/sf_gate_client/filing_types/put_filing_types_parameters.go +++ b/api/sf-gate/sf_gate_client/filing_types/put_filing_types_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutFilingTypesParams creates a new PutFilingTypesParams object -// with the default values initialized. +// NewPutFilingTypesParams creates a new PutFilingTypesParams 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 NewPutFilingTypesParams() *PutFilingTypesParams { - var () return &PutFilingTypesParams{ - timeout: cr.DefaultTimeout, } } // NewPutFilingTypesParamsWithTimeout creates a new PutFilingTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutFilingTypesParamsWithTimeout(timeout time.Duration) *PutFilingTypesParams { - var () return &PutFilingTypesParams{ - timeout: timeout, } } // NewPutFilingTypesParamsWithContext creates a new PutFilingTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutFilingTypesParamsWithContext(ctx context.Context) *PutFilingTypesParams { - var () return &PutFilingTypesParams{ - Context: ctx, } } // NewPutFilingTypesParamsWithHTTPClient creates a new PutFilingTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutFilingTypesParamsWithHTTPClient(client *http.Client) *PutFilingTypesParams { - var () return &PutFilingTypesParams{ HTTPClient: client, } } -/*PutFilingTypesParams contains all the parameters to send to the API endpoint -for the put filing types operation typically these are written to a http.Request +/* PutFilingTypesParams contains all the parameters to send to the API endpoint + for the put filing types operation. + + Typically these are written to a http.Request. */ type PutFilingTypesParams struct { - /*FilingTypeRequest - A request with an array of FilingType Objects + /* FilingTypeRequest. + A request with an array of FilingType Objects */ FilingTypeRequest *sf_gate_models.FilingTypeRequest @@ -77,6 +76,21 @@ type PutFilingTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingTypesParams) WithDefaults() *PutFilingTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put filing types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put filing types params func (o *PutFilingTypesParams) WithTimeout(timeout time.Duration) *PutFilingTypesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutFilingTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.FilingTypeRequest != nil { if err := r.SetBodyParam(o.FilingTypeRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/filing_types/put_filing_types_responses.go b/api/sf-gate/sf_gate_client/filing_types/put_filing_types_responses.go index 96275ab..079f096 100644 --- a/api/sf-gate/sf_gate_client/filing_types/put_filing_types_responses.go +++ b/api/sf-gate/sf_gate_client/filing_types/put_filing_types_responses.go @@ -57,9 +57,8 @@ func (o *PutFilingTypesReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutFilingTypesOK() *PutFilingTypesOK { return &PutFilingTypesOK{} } -/*PutFilingTypesOK handles this case with default header values. +/* PutFilingTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of FilingType objects */ @@ -79,7 +78,6 @@ type PutFilingTypesOK struct { func (o *PutFilingTypesOK) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesOK %+v", 200, o.Payload) } - func (o *PutFilingTypesOK) GetPayload() *sf_gate_models.FilingTypeResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutFilingTypesUnauthorized() *PutFilingTypesUnauthorized { return &PutFilingTypesUnauthorized{} } -/*PutFilingTypesUnauthorized handles this case with default header values. +/* PutFilingTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutFilingTypesUnauthorized struct { func (o *PutFilingTypesUnauthorized) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesUnauthorized %+v", 401, o.Payload) } - func (o *PutFilingTypesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutFilingTypesForbidden() *PutFilingTypesForbidden { return &PutFilingTypesForbidden{} } -/*PutFilingTypesForbidden handles this case with default header values. +/* PutFilingTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutFilingTypesForbidden struct { func (o *PutFilingTypesForbidden) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesForbidden %+v", 403, o.Payload) } - func (o *PutFilingTypesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutFilingTypesNotFound() *PutFilingTypesNotFound { return &PutFilingTypesNotFound{} } -/*PutFilingTypesNotFound handles this case with default header values. +/* PutFilingTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutFilingTypesNotFound struct { func (o *PutFilingTypesNotFound) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesNotFound %+v", 404, o.Payload) } - func (o *PutFilingTypesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutFilingTypesInternalServerError() *PutFilingTypesInternalServerError { return &PutFilingTypesInternalServerError{} } -/*PutFilingTypesInternalServerError handles this case with default header values. +/* PutFilingTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutFilingTypesInternalServerError struct { func (o *PutFilingTypesInternalServerError) Error() string { return fmt.Sprintf("[PUT /filingtypes][%d] putFilingTypesInternalServerError %+v", 500, o.Payload) } - func (o *PutFilingTypesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/filings/filings_client.go b/api/sf-gate/sf_gate_client/filings/filings_client.go index ab8aab5..774719c 100644 --- a/api/sf-gate/sf_gate_client/filings/filings_client.go +++ b/api/sf-gate/sf_gate_client/filings/filings_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingsOK, error) + GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingsOK, error) - PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingsOK, error) + PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingsOK, error) - PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingsOK, error) + PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Regulatory Filings */ -func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*GetFilingsOK, error) { +func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFilingsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetFilingsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getFilings", Method: "GET", PathPattern: "/filings", @@ -63,7 +65,12 @@ func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAut 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 } @@ -82,13 +89,12 @@ func (a *Client) GetFilings(params *GetFilingsParams, authInfo runtime.ClientAut Create new Filings */ -func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PostFilingsOK, error) { +func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostFilingsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostFilingsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postFilings", Method: "POST", PathPattern: "/filings", @@ -100,7 +106,12 @@ func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientA 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 } @@ -119,13 +130,12 @@ func (a *Client) PostFilings(params *PostFilingsParams, authInfo runtime.ClientA Update all the fields in a Filing record identified by Taxnexus ID */ -func (a *Client) PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter) (*PutFilingsOK, error) { +func (a *Client) PutFilings(params *PutFilingsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutFilingsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutFilingsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putFilings", Method: "PUT", PathPattern: "/filings", @@ -137,7 +147,12 @@ func (a *Client) PutFilings(params *PutFilingsParams, authInfo runtime.ClientAut 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 } diff --git a/api/sf-gate/sf_gate_client/filings/get_filings_parameters.go b/api/sf-gate/sf_gate_client/filings/get_filings_parameters.go index 76615c8..3e8e079 100644 --- a/api/sf-gate/sf_gate_client/filings/get_filings_parameters.go +++ b/api/sf-gate/sf_gate_client/filings/get_filings_parameters.go @@ -21,83 +21,92 @@ import ( "github.com/go-openapi/swag" ) -// NewGetFilingsParams creates a new GetFilingsParams object -// with the default values initialized. +// NewGetFilingsParams creates a new GetFilingsParams 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 NewGetFilingsParams() *GetFilingsParams { - var () return &GetFilingsParams{ - timeout: cr.DefaultTimeout, } } // NewGetFilingsParamsWithTimeout creates a new GetFilingsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetFilingsParamsWithTimeout(timeout time.Duration) *GetFilingsParams { - var () return &GetFilingsParams{ - timeout: timeout, } } // NewGetFilingsParamsWithContext creates a new GetFilingsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetFilingsParamsWithContext(ctx context.Context) *GetFilingsParams { - var () return &GetFilingsParams{ - Context: ctx, } } // NewGetFilingsParamsWithHTTPClient creates a new GetFilingsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetFilingsParamsWithHTTPClient(client *http.Client) *GetFilingsParams { - var () return &GetFilingsParams{ HTTPClient: client, } } -/*GetFilingsParams contains all the parameters to send to the API endpoint -for the get filings operation typically these are written to a http.Request +/* GetFilingsParams contains all the parameters to send to the API endpoint + for the get filings operation. + + Typically these are written to a http.Request. */ type GetFilingsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*FilingID - Taxnexus Id of the Filing to be retrieved + /* FilingID. + + Taxnexus Id of the Filing to be retrieved */ FilingID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Name - The Tax Domain to rate (cannabis, sales or telecom) + /* Name. + + The Tax Domain to rate (cannabis, sales or telecom) */ Name *string - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -106,6 +115,21 @@ type GetFilingsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingsParams) WithDefaults() *GetFilingsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFilingsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get filings params func (o *GetFilingsParams) WithTimeout(timeout time.Duration) *GetFilingsParams { o.SetTimeout(timeout) @@ -228,112 +252,119 @@ func (o *GetFilingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.FilingID != nil { // query param filingId var qrFilingID string + if o.FilingID != nil { qrFilingID = *o.FilingID } qFilingID := qrFilingID if qFilingID != "" { + if err := r.SetQueryParam("filingId", qFilingID); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.Name != nil { // query param name var qrName string + if o.Name != nil { qrName = *o.Name } qName := qrName if qName != "" { + if err := r.SetQueryParam("name", qName); err != nil { return err } } - } if o.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/filings/get_filings_responses.go b/api/sf-gate/sf_gate_client/filings/get_filings_responses.go index 1b20076..c259a63 100644 --- a/api/sf-gate/sf_gate_client/filings/get_filings_responses.go +++ b/api/sf-gate/sf_gate_client/filings/get_filings_responses.go @@ -63,9 +63,8 @@ func (o *GetFilingsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetFilingsOK() *GetFilingsOK { return &GetFilingsOK{} } -/*GetFilingsOK handles this case with default header values. +/* GetFilingsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Filing objects */ @@ -85,7 +84,6 @@ type GetFilingsOK struct { func (o *GetFilingsOK) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsOK %+v", 200, o.Payload) } - func (o *GetFilingsOK) GetPayload() *sf_gate_models.FilingResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetFilingsUnauthorized() *GetFilingsUnauthorized { return &GetFilingsUnauthorized{} } -/*GetFilingsUnauthorized handles this case with default header values. +/* GetFilingsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetFilingsUnauthorized struct { func (o *GetFilingsUnauthorized) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsUnauthorized %+v", 401, o.Payload) } - func (o *GetFilingsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetFilingsForbidden() *GetFilingsForbidden { return &GetFilingsForbidden{} } -/*GetFilingsForbidden handles this case with default header values. +/* GetFilingsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetFilingsForbidden struct { func (o *GetFilingsForbidden) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsForbidden %+v", 403, o.Payload) } - func (o *GetFilingsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetFilingsNotFound() *GetFilingsNotFound { return &GetFilingsNotFound{} } -/*GetFilingsNotFound handles this case with default header values. +/* GetFilingsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetFilingsNotFound struct { func (o *GetFilingsNotFound) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsNotFound %+v", 404, o.Payload) } - func (o *GetFilingsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetFilingsUnprocessableEntity() *GetFilingsUnprocessableEntity { return &GetFilingsUnprocessableEntity{} } -/*GetFilingsUnprocessableEntity handles this case with default header values. +/* GetFilingsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetFilingsUnprocessableEntity struct { func (o *GetFilingsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetFilingsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetFilingsInternalServerError() *GetFilingsInternalServerError { return &GetFilingsInternalServerError{} } -/*GetFilingsInternalServerError handles this case with default header values. +/* GetFilingsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetFilingsInternalServerError struct { func (o *GetFilingsInternalServerError) Error() string { return fmt.Sprintf("[GET /filings][%d] getFilingsInternalServerError %+v", 500, o.Payload) } - func (o *GetFilingsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/filings/post_filings_parameters.go b/api/sf-gate/sf_gate_client/filings/post_filings_parameters.go index c5a59ab..896356d 100644 --- a/api/sf-gate/sf_gate_client/filings/post_filings_parameters.go +++ b/api/sf-gate/sf_gate_client/filings/post_filings_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostFilingsParams creates a new PostFilingsParams object -// with the default values initialized. +// NewPostFilingsParams creates a new PostFilingsParams 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 NewPostFilingsParams() *PostFilingsParams { - var () return &PostFilingsParams{ - timeout: cr.DefaultTimeout, } } // NewPostFilingsParamsWithTimeout creates a new PostFilingsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostFilingsParamsWithTimeout(timeout time.Duration) *PostFilingsParams { - var () return &PostFilingsParams{ - timeout: timeout, } } // NewPostFilingsParamsWithContext creates a new PostFilingsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostFilingsParamsWithContext(ctx context.Context) *PostFilingsParams { - var () return &PostFilingsParams{ - Context: ctx, } } // NewPostFilingsParamsWithHTTPClient creates a new PostFilingsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostFilingsParamsWithHTTPClient(client *http.Client) *PostFilingsParams { - var () return &PostFilingsParams{ HTTPClient: client, } } -/*PostFilingsParams contains all the parameters to send to the API endpoint -for the post filings operation typically these are written to a http.Request +/* PostFilingsParams contains all the parameters to send to the API endpoint + for the post filings operation. + + Typically these are written to a http.Request. */ type PostFilingsParams struct { - /*FilingRequest - A request with an array of Filing Objects + /* FilingRequest. + A request with an array of Filing Objects */ FilingRequest *sf_gate_models.FilingRequest @@ -77,6 +76,21 @@ type PostFilingsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingsParams) WithDefaults() *PostFilingsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostFilingsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post filings params func (o *PostFilingsParams) WithTimeout(timeout time.Duration) *PostFilingsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostFilingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.FilingRequest != nil { if err := r.SetBodyParam(o.FilingRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/filings/post_filings_responses.go b/api/sf-gate/sf_gate_client/filings/post_filings_responses.go index 2d1db97..9b2a450 100644 --- a/api/sf-gate/sf_gate_client/filings/post_filings_responses.go +++ b/api/sf-gate/sf_gate_client/filings/post_filings_responses.go @@ -57,9 +57,8 @@ func (o *PostFilingsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostFilingsOK() *PostFilingsOK { return &PostFilingsOK{} } -/*PostFilingsOK handles this case with default header values. +/* PostFilingsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Filing objects */ @@ -79,7 +78,6 @@ type PostFilingsOK struct { func (o *PostFilingsOK) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsOK %+v", 200, o.Payload) } - func (o *PostFilingsOK) GetPayload() *sf_gate_models.FilingResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostFilingsUnauthorized() *PostFilingsUnauthorized { return &PostFilingsUnauthorized{} } -/*PostFilingsUnauthorized handles this case with default header values. +/* PostFilingsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostFilingsUnauthorized struct { func (o *PostFilingsUnauthorized) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsUnauthorized %+v", 401, o.Payload) } - func (o *PostFilingsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostFilingsForbidden() *PostFilingsForbidden { return &PostFilingsForbidden{} } -/*PostFilingsForbidden handles this case with default header values. +/* PostFilingsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostFilingsForbidden struct { func (o *PostFilingsForbidden) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsForbidden %+v", 403, o.Payload) } - func (o *PostFilingsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostFilingsNotFound() *PostFilingsNotFound { return &PostFilingsNotFound{} } -/*PostFilingsNotFound handles this case with default header values. +/* PostFilingsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostFilingsNotFound struct { func (o *PostFilingsNotFound) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsNotFound %+v", 404, o.Payload) } - func (o *PostFilingsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostFilingsInternalServerError() *PostFilingsInternalServerError { return &PostFilingsInternalServerError{} } -/*PostFilingsInternalServerError handles this case with default header values. +/* PostFilingsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostFilingsInternalServerError struct { func (o *PostFilingsInternalServerError) Error() string { return fmt.Sprintf("[POST /filings][%d] postFilingsInternalServerError %+v", 500, o.Payload) } - func (o *PostFilingsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/filings/put_filings_parameters.go b/api/sf-gate/sf_gate_client/filings/put_filings_parameters.go index b9aad3a..d5ccba7 100644 --- a/api/sf-gate/sf_gate_client/filings/put_filings_parameters.go +++ b/api/sf-gate/sf_gate_client/filings/put_filings_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutFilingsParams creates a new PutFilingsParams object -// with the default values initialized. +// NewPutFilingsParams creates a new PutFilingsParams 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 NewPutFilingsParams() *PutFilingsParams { - var () return &PutFilingsParams{ - timeout: cr.DefaultTimeout, } } // NewPutFilingsParamsWithTimeout creates a new PutFilingsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutFilingsParamsWithTimeout(timeout time.Duration) *PutFilingsParams { - var () return &PutFilingsParams{ - timeout: timeout, } } // NewPutFilingsParamsWithContext creates a new PutFilingsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutFilingsParamsWithContext(ctx context.Context) *PutFilingsParams { - var () return &PutFilingsParams{ - Context: ctx, } } // NewPutFilingsParamsWithHTTPClient creates a new PutFilingsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutFilingsParamsWithHTTPClient(client *http.Client) *PutFilingsParams { - var () return &PutFilingsParams{ HTTPClient: client, } } -/*PutFilingsParams contains all the parameters to send to the API endpoint -for the put filings operation typically these are written to a http.Request +/* PutFilingsParams contains all the parameters to send to the API endpoint + for the put filings operation. + + Typically these are written to a http.Request. */ type PutFilingsParams struct { - /*FilingRequest - A request with an array of Filing Objects + /* FilingRequest. + A request with an array of Filing Objects */ FilingRequest *sf_gate_models.FilingRequest @@ -77,6 +76,21 @@ type PutFilingsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingsParams) WithDefaults() *PutFilingsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put filings params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutFilingsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put filings params func (o *PutFilingsParams) WithTimeout(timeout time.Duration) *PutFilingsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutFilingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.FilingRequest != nil { if err := r.SetBodyParam(o.FilingRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/filings/put_filings_responses.go b/api/sf-gate/sf_gate_client/filings/put_filings_responses.go index fdb8d17..43fa726 100644 --- a/api/sf-gate/sf_gate_client/filings/put_filings_responses.go +++ b/api/sf-gate/sf_gate_client/filings/put_filings_responses.go @@ -57,9 +57,8 @@ func (o *PutFilingsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutFilingsOK() *PutFilingsOK { return &PutFilingsOK{} } -/*PutFilingsOK handles this case with default header values. +/* PutFilingsOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Filing objects */ @@ -79,7 +78,6 @@ type PutFilingsOK struct { func (o *PutFilingsOK) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsOK %+v", 200, o.Payload) } - func (o *PutFilingsOK) GetPayload() *sf_gate_models.FilingResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutFilingsUnauthorized() *PutFilingsUnauthorized { return &PutFilingsUnauthorized{} } -/*PutFilingsUnauthorized handles this case with default header values. +/* PutFilingsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutFilingsUnauthorized struct { func (o *PutFilingsUnauthorized) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsUnauthorized %+v", 401, o.Payload) } - func (o *PutFilingsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutFilingsForbidden() *PutFilingsForbidden { return &PutFilingsForbidden{} } -/*PutFilingsForbidden handles this case with default header values. +/* PutFilingsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutFilingsForbidden struct { func (o *PutFilingsForbidden) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsForbidden %+v", 403, o.Payload) } - func (o *PutFilingsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutFilingsNotFound() *PutFilingsNotFound { return &PutFilingsNotFound{} } -/*PutFilingsNotFound handles this case with default header values. +/* PutFilingsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutFilingsNotFound struct { func (o *PutFilingsNotFound) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsNotFound %+v", 404, o.Payload) } - func (o *PutFilingsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutFilingsInternalServerError() *PutFilingsInternalServerError { return &PutFilingsInternalServerError{} } -/*PutFilingsInternalServerError handles this case with default header values. +/* PutFilingsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutFilingsInternalServerError struct { func (o *PutFilingsInternalServerError) Error() string { return fmt.Sprintf("[PUT /filings][%d] putFilingsInternalServerError %+v", 500, o.Payload) } - func (o *PutFilingsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_parameters.go b/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_parameters.go index e650f3a..b73de91 100644 --- a/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_parameters.go +++ b/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetGlAccountsParams creates a new GetGlAccountsParams object -// with the default values initialized. +// NewGetGlAccountsParams creates a new GetGlAccountsParams 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 NewGetGlAccountsParams() *GetGlAccountsParams { - var () return &GetGlAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetGlAccountsParamsWithTimeout creates a new GetGlAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetGlAccountsParamsWithTimeout(timeout time.Duration) *GetGlAccountsParams { - var () return &GetGlAccountsParams{ - timeout: timeout, } } // NewGetGlAccountsParamsWithContext creates a new GetGlAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetGlAccountsParamsWithContext(ctx context.Context) *GetGlAccountsParams { - var () return &GetGlAccountsParams{ - Context: ctx, } } // NewGetGlAccountsParamsWithHTTPClient creates a new GetGlAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetGlAccountsParamsWithHTTPClient(client *http.Client) *GetGlAccountsParams { - var () return &GetGlAccountsParams{ HTTPClient: client, } } -/*GetGlAccountsParams contains all the parameters to send to the API endpoint -for the get gl accounts operation typically these are written to a http.Request +/* GetGlAccountsParams contains all the parameters to send to the API endpoint + for the get gl accounts operation. + + Typically these are written to a http.Request. */ type GetGlAccountsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetGlAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get gl accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlAccountsParams) WithDefaults() *GetGlAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get gl accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get gl accounts params func (o *GetGlAccountsParams) WithTimeout(timeout time.Duration) *GetGlAccountsParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetGlAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // 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.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 { diff --git a/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_responses.go b/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_responses.go index 605936d..d9fa2c5 100644 --- a/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_responses.go +++ b/api/sf-gate/sf_gate_client/gl_accounts/get_gl_accounts_responses.go @@ -63,9 +63,8 @@ func (o *GetGlAccountsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetGlAccountsOK() *GetGlAccountsOK { return &GetGlAccountsOK{} } -/*GetGlAccountsOK handles this case with default header values. +/* GetGlAccountsOK describes a response with status code 200, with default header values. An array of GL Account Objects */ @@ -85,7 +84,6 @@ type GetGlAccountsOK struct { func (o *GetGlAccountsOK) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsOK %+v", 200, o.Payload) } - func (o *GetGlAccountsOK) GetPayload() *sf_gate_models.GlAccountResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetGlAccountsUnauthorized() *GetGlAccountsUnauthorized { return &GetGlAccountsUnauthorized{} } -/*GetGlAccountsUnauthorized handles this case with default header values. +/* GetGlAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetGlAccountsUnauthorized struct { func (o *GetGlAccountsUnauthorized) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsUnauthorized %+v", 401, o.Payload) } - func (o *GetGlAccountsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetGlAccountsForbidden() *GetGlAccountsForbidden { return &GetGlAccountsForbidden{} } -/*GetGlAccountsForbidden handles this case with default header values. +/* GetGlAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetGlAccountsForbidden struct { func (o *GetGlAccountsForbidden) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsForbidden %+v", 403, o.Payload) } - func (o *GetGlAccountsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetGlAccountsNotFound() *GetGlAccountsNotFound { return &GetGlAccountsNotFound{} } -/*GetGlAccountsNotFound handles this case with default header values. +/* GetGlAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetGlAccountsNotFound struct { func (o *GetGlAccountsNotFound) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsNotFound %+v", 404, o.Payload) } - func (o *GetGlAccountsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetGlAccountsUnprocessableEntity() *GetGlAccountsUnprocessableEntity { return &GetGlAccountsUnprocessableEntity{} } -/*GetGlAccountsUnprocessableEntity handles this case with default header values. +/* GetGlAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetGlAccountsUnprocessableEntity struct { func (o *GetGlAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetGlAccountsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetGlAccountsInternalServerError() *GetGlAccountsInternalServerError { return &GetGlAccountsInternalServerError{} } -/*GetGlAccountsInternalServerError handles this case with default header values. +/* GetGlAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetGlAccountsInternalServerError struct { func (o *GetGlAccountsInternalServerError) Error() string { return fmt.Sprintf("[GET /glaccounts][%d] getGlAccountsInternalServerError %+v", 500, o.Payload) } - func (o *GetGlAccountsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/gl_accounts/gl_accounts_client.go b/api/sf-gate/sf_gate_client/gl_accounts/gl_accounts_client.go index cb597cc..ffe0a93 100644 --- a/api/sf-gate/sf_gate_client/gl_accounts/gl_accounts_client.go +++ b/api/sf-gate/sf_gate_client/gl_accounts/gl_accounts_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlAccountsOK, error) + GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlAccountsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of available General Ledger Accounts */ -func (a *Client) GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlAccountsOK, error) { +func (a *Client) GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetGlAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getGlAccounts", Method: "GET", PathPattern: "/glaccounts", @@ -59,7 +61,12 @@ func (a *Client) GetGlAccounts(params *GetGlAccountsParams, authInfo runtime.Cli 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 } diff --git a/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_parameters.go b/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_parameters.go index 8a39127..dc0a978 100644 --- a/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_parameters.go +++ b/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetGlBalancesParams creates a new GetGlBalancesParams object -// with the default values initialized. +// NewGetGlBalancesParams creates a new GetGlBalancesParams 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 NewGetGlBalancesParams() *GetGlBalancesParams { - var () return &GetGlBalancesParams{ - timeout: cr.DefaultTimeout, } } // NewGetGlBalancesParamsWithTimeout creates a new GetGlBalancesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetGlBalancesParamsWithTimeout(timeout time.Duration) *GetGlBalancesParams { - var () return &GetGlBalancesParams{ - timeout: timeout, } } // NewGetGlBalancesParamsWithContext creates a new GetGlBalancesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetGlBalancesParamsWithContext(ctx context.Context) *GetGlBalancesParams { - var () return &GetGlBalancesParams{ - Context: ctx, } } // NewGetGlBalancesParamsWithHTTPClient creates a new GetGlBalancesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetGlBalancesParamsWithHTTPClient(client *http.Client) *GetGlBalancesParams { - var () return &GetGlBalancesParams{ HTTPClient: client, } } -/*GetGlBalancesParams contains all the parameters to send to the API endpoint -for the get gl balances operation typically these are written to a http.Request +/* GetGlBalancesParams contains all the parameters to send to the API endpoint + for the get gl balances operation. + + Typically these are written to a http.Request. */ type GetGlBalancesParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetGlBalancesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get gl balances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlBalancesParams) WithDefaults() *GetGlBalancesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get gl balances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGlBalancesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get gl balances params func (o *GetGlBalancesParams) WithTimeout(timeout time.Duration) *GetGlBalancesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetGlBalancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // 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.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 { diff --git a/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_responses.go b/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_responses.go index 20b0fb3..b94143f 100644 --- a/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_responses.go +++ b/api/sf-gate/sf_gate_client/gl_balances/get_gl_balances_responses.go @@ -63,9 +63,8 @@ func (o *GetGlBalancesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetGlBalancesOK() *GetGlBalancesOK { return &GetGlBalancesOK{} } -/*GetGlBalancesOK handles this case with default header values. +/* GetGlBalancesOK describes a response with status code 200, with default header values. An array of GL Balance Objects */ @@ -85,7 +84,6 @@ type GetGlBalancesOK struct { func (o *GetGlBalancesOK) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesOK %+v", 200, o.Payload) } - func (o *GetGlBalancesOK) GetPayload() *sf_gate_models.GlBalanceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetGlBalancesUnauthorized() *GetGlBalancesUnauthorized { return &GetGlBalancesUnauthorized{} } -/*GetGlBalancesUnauthorized handles this case with default header values. +/* GetGlBalancesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetGlBalancesUnauthorized struct { func (o *GetGlBalancesUnauthorized) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesUnauthorized %+v", 401, o.Payload) } - func (o *GetGlBalancesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetGlBalancesForbidden() *GetGlBalancesForbidden { return &GetGlBalancesForbidden{} } -/*GetGlBalancesForbidden handles this case with default header values. +/* GetGlBalancesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetGlBalancesForbidden struct { func (o *GetGlBalancesForbidden) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesForbidden %+v", 403, o.Payload) } - func (o *GetGlBalancesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetGlBalancesNotFound() *GetGlBalancesNotFound { return &GetGlBalancesNotFound{} } -/*GetGlBalancesNotFound handles this case with default header values. +/* GetGlBalancesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetGlBalancesNotFound struct { func (o *GetGlBalancesNotFound) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesNotFound %+v", 404, o.Payload) } - func (o *GetGlBalancesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetGlBalancesUnprocessableEntity() *GetGlBalancesUnprocessableEntity { return &GetGlBalancesUnprocessableEntity{} } -/*GetGlBalancesUnprocessableEntity handles this case with default header values. +/* GetGlBalancesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetGlBalancesUnprocessableEntity struct { func (o *GetGlBalancesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetGlBalancesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetGlBalancesInternalServerError() *GetGlBalancesInternalServerError { return &GetGlBalancesInternalServerError{} } -/*GetGlBalancesInternalServerError handles this case with default header values. +/* GetGlBalancesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetGlBalancesInternalServerError struct { func (o *GetGlBalancesInternalServerError) Error() string { return fmt.Sprintf("[GET /glbalances][%d] getGlBalancesInternalServerError %+v", 500, o.Payload) } - func (o *GetGlBalancesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/gl_balances/gl_balances_client.go b/api/sf-gate/sf_gate_client/gl_balances/gl_balances_client.go index 7d2571a..c0b35ba 100644 --- a/api/sf-gate/sf_gate_client/gl_balances/gl_balances_client.go +++ b/api/sf-gate/sf_gate_client/gl_balances/gl_balances_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlBalancesOK, error) + GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlBalancesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of General Ledger Account Balances for a Taxnexus Account */ -func (a *Client) GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter) (*GetGlBalancesOK, error) { +func (a *Client) GetGlBalances(params *GetGlBalancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGlBalancesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetGlBalancesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getGlBalances", Method: "GET", PathPattern: "/glbalances", @@ -59,7 +61,12 @@ func (a *Client) GetGlBalances(params *GetGlBalancesParams, authInfo runtime.Cli 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 } diff --git a/api/sf-gate/sf_gate_client/ingests/get_ingests_parameters.go b/api/sf-gate/sf_gate_client/ingests/get_ingests_parameters.go index 12183cb..ca4d534 100644 --- a/api/sf-gate/sf_gate_client/ingests/get_ingests_parameters.go +++ b/api/sf-gate/sf_gate_client/ingests/get_ingests_parameters.go @@ -21,83 +21,92 @@ import ( "github.com/go-openapi/swag" ) -// NewGetIngestsParams creates a new GetIngestsParams object -// with the default values initialized. +// NewGetIngestsParams creates a new GetIngestsParams 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 NewGetIngestsParams() *GetIngestsParams { - var () return &GetIngestsParams{ - timeout: cr.DefaultTimeout, } } // NewGetIngestsParamsWithTimeout creates a new GetIngestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetIngestsParamsWithTimeout(timeout time.Duration) *GetIngestsParams { - var () return &GetIngestsParams{ - timeout: timeout, } } // NewGetIngestsParamsWithContext creates a new GetIngestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetIngestsParamsWithContext(ctx context.Context) *GetIngestsParams { - var () return &GetIngestsParams{ - Context: ctx, } } // NewGetIngestsParamsWithHTTPClient creates a new GetIngestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetIngestsParamsWithHTTPClient(client *http.Client) *GetIngestsParams { - var () return &GetIngestsParams{ HTTPClient: client, } } -/*GetIngestsParams contains all the parameters to send to the API endpoint -for the get ingests operation typically these are written to a http.Request +/* GetIngestsParams contains all the parameters to send to the API endpoint + for the get ingests operation. + + Typically these are written to a http.Request. */ type GetIngestsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*AccountNumber - The Taxnexus Account Number of the Account to be used a record retrieval + /* AccountNumber. + + The Taxnexus Account Number of the Account to be used a record retrieval */ AccountNumber *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*IngestID - Taxnexus Record Id of an Ingest + /* IngestID. + + Taxnexus Record Id of an Ingest */ IngestID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -106,6 +115,21 @@ type GetIngestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestsParams) WithDefaults() *GetIngestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetIngestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get ingests params func (o *GetIngestsParams) WithTimeout(timeout time.Duration) *GetIngestsParams { o.SetTimeout(timeout) @@ -228,112 +252,119 @@ func (o *GetIngestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // 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.AccountNumber != nil { // query param accountNumber var qrAccountNumber string + if o.AccountNumber != nil { qrAccountNumber = *o.AccountNumber } qAccountNumber := qrAccountNumber if qAccountNumber != "" { + if err := r.SetQueryParam("accountNumber", qAccountNumber); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.IngestID != nil { // query param ingestId var qrIngestID string + if o.IngestID != nil { qrIngestID = *o.IngestID } qIngestID := qrIngestID if qIngestID != "" { + if err := r.SetQueryParam("ingestId", qIngestID); 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 { diff --git a/api/sf-gate/sf_gate_client/ingests/get_ingests_responses.go b/api/sf-gate/sf_gate_client/ingests/get_ingests_responses.go index 750b128..1a1106f 100644 --- a/api/sf-gate/sf_gate_client/ingests/get_ingests_responses.go +++ b/api/sf-gate/sf_gate_client/ingests/get_ingests_responses.go @@ -63,9 +63,8 @@ func (o *GetIngestsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetIngestsOK() *GetIngestsOK { return &GetIngestsOK{} } -/*GetIngestsOK handles this case with default header values. +/* GetIngestsOK describes a response with status code 200, with default header values. Taxnexus Response with Ingest objects */ @@ -85,7 +84,6 @@ type GetIngestsOK struct { func (o *GetIngestsOK) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsOK %+v", 200, o.Payload) } - func (o *GetIngestsOK) GetPayload() *sf_gate_models.IngestResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetIngestsUnauthorized() *GetIngestsUnauthorized { return &GetIngestsUnauthorized{} } -/*GetIngestsUnauthorized handles this case with default header values. +/* GetIngestsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetIngestsUnauthorized struct { func (o *GetIngestsUnauthorized) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsUnauthorized %+v", 401, o.Payload) } - func (o *GetIngestsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetIngestsForbidden() *GetIngestsForbidden { return &GetIngestsForbidden{} } -/*GetIngestsForbidden handles this case with default header values. +/* GetIngestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetIngestsForbidden struct { func (o *GetIngestsForbidden) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsForbidden %+v", 403, o.Payload) } - func (o *GetIngestsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetIngestsNotFound() *GetIngestsNotFound { return &GetIngestsNotFound{} } -/*GetIngestsNotFound handles this case with default header values. +/* GetIngestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetIngestsNotFound struct { func (o *GetIngestsNotFound) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsNotFound %+v", 404, o.Payload) } - func (o *GetIngestsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetIngestsUnprocessableEntity() *GetIngestsUnprocessableEntity { return &GetIngestsUnprocessableEntity{} } -/*GetIngestsUnprocessableEntity handles this case with default header values. +/* GetIngestsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetIngestsUnprocessableEntity struct { func (o *GetIngestsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetIngestsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetIngestsInternalServerError() *GetIngestsInternalServerError { return &GetIngestsInternalServerError{} } -/*GetIngestsInternalServerError handles this case with default header values. +/* GetIngestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetIngestsInternalServerError struct { func (o *GetIngestsInternalServerError) Error() string { return fmt.Sprintf("[GET /ingests][%d] getIngestsInternalServerError %+v", 500, o.Payload) } - func (o *GetIngestsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/ingests/ingests_client.go b/api/sf-gate/sf_gate_client/ingests/ingests_client.go index 6e2445e..40daff0 100644 --- a/api/sf-gate/sf_gate_client/ingests/ingests_client.go +++ b/api/sf-gate/sf_gate_client/ingests/ingests_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestsOK, error) + GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestsOK, error) - PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PostIngestsOK, error) + PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIngestsOK, error) - PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PutIngestsOK, error) + PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIngestsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Print-Ready Ingest records */ -func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*GetIngestsOK, error) { +func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetIngestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetIngestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getIngests", Method: "GET", PathPattern: "/ingests", @@ -63,7 +65,12 @@ func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAut 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 } @@ -82,13 +89,12 @@ func (a *Client) GetIngests(params *GetIngestsParams, authInfo runtime.ClientAut Update Ingests */ -func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PostIngestsOK, error) { +func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostIngestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostIngestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postIngests", Method: "POST", PathPattern: "/ingests", @@ -100,7 +106,12 @@ func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientA 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 } @@ -119,13 +130,12 @@ func (a *Client) PostIngests(params *PostIngestsParams, authInfo runtime.ClientA Update Ingests */ -func (a *Client) PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter) (*PutIngestsOK, error) { +func (a *Client) PutIngests(params *PutIngestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutIngestsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutIngestsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putIngests", Method: "PUT", PathPattern: "/ingests", @@ -137,7 +147,12 @@ func (a *Client) PutIngests(params *PutIngestsParams, authInfo runtime.ClientAut 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 } diff --git a/api/sf-gate/sf_gate_client/ingests/post_ingests_parameters.go b/api/sf-gate/sf_gate_client/ingests/post_ingests_parameters.go index ffb2795..2b5c848 100644 --- a/api/sf-gate/sf_gate_client/ingests/post_ingests_parameters.go +++ b/api/sf-gate/sf_gate_client/ingests/post_ingests_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostIngestsParams creates a new PostIngestsParams object -// with the default values initialized. +// NewPostIngestsParams creates a new PostIngestsParams 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 NewPostIngestsParams() *PostIngestsParams { - var () return &PostIngestsParams{ - timeout: cr.DefaultTimeout, } } // NewPostIngestsParamsWithTimeout creates a new PostIngestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostIngestsParamsWithTimeout(timeout time.Duration) *PostIngestsParams { - var () return &PostIngestsParams{ - timeout: timeout, } } // NewPostIngestsParamsWithContext creates a new PostIngestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostIngestsParamsWithContext(ctx context.Context) *PostIngestsParams { - var () return &PostIngestsParams{ - Context: ctx, } } // NewPostIngestsParamsWithHTTPClient creates a new PostIngestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostIngestsParamsWithHTTPClient(client *http.Client) *PostIngestsParams { - var () return &PostIngestsParams{ HTTPClient: client, } } -/*PostIngestsParams contains all the parameters to send to the API endpoint -for the post ingests operation typically these are written to a http.Request +/* PostIngestsParams contains all the parameters to send to the API endpoint + for the post ingests operation. + + Typically these are written to a http.Request. */ type PostIngestsParams struct { - /*IngestRequest - An array of new Ingest records + /* IngestRequest. + An array of new Ingest records */ IngestRequest *sf_gate_models.IngestRequest @@ -77,6 +76,21 @@ type PostIngestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostIngestsParams) WithDefaults() *PostIngestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostIngestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post ingests params func (o *PostIngestsParams) WithTimeout(timeout time.Duration) *PostIngestsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostIngestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.IngestRequest != nil { if err := r.SetBodyParam(o.IngestRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/ingests/post_ingests_responses.go b/api/sf-gate/sf_gate_client/ingests/post_ingests_responses.go index 82d8684..84896fe 100644 --- a/api/sf-gate/sf_gate_client/ingests/post_ingests_responses.go +++ b/api/sf-gate/sf_gate_client/ingests/post_ingests_responses.go @@ -63,9 +63,8 @@ func (o *PostIngestsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostIngestsOK() *PostIngestsOK { return &PostIngestsOK{} } -/*PostIngestsOK handles this case with default header values. +/* PostIngestsOK describes a response with status code 200, with default header values. Taxnexus Response with Ingest objects */ @@ -85,7 +84,6 @@ type PostIngestsOK struct { func (o *PostIngestsOK) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsOK %+v", 200, o.Payload) } - func (o *PostIngestsOK) GetPayload() *sf_gate_models.IngestResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostIngestsUnauthorized() *PostIngestsUnauthorized { return &PostIngestsUnauthorized{} } -/*PostIngestsUnauthorized handles this case with default header values. +/* PostIngestsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostIngestsUnauthorized struct { func (o *PostIngestsUnauthorized) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsUnauthorized %+v", 401, o.Payload) } - func (o *PostIngestsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostIngestsForbidden() *PostIngestsForbidden { return &PostIngestsForbidden{} } -/*PostIngestsForbidden handles this case with default header values. +/* PostIngestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostIngestsForbidden struct { func (o *PostIngestsForbidden) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsForbidden %+v", 403, o.Payload) } - func (o *PostIngestsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostIngestsNotFound() *PostIngestsNotFound { return &PostIngestsNotFound{} } -/*PostIngestsNotFound handles this case with default header values. +/* PostIngestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostIngestsNotFound struct { func (o *PostIngestsNotFound) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsNotFound %+v", 404, o.Payload) } - func (o *PostIngestsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostIngestsUnprocessableEntity() *PostIngestsUnprocessableEntity { return &PostIngestsUnprocessableEntity{} } -/*PostIngestsUnprocessableEntity handles this case with default header values. +/* PostIngestsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostIngestsUnprocessableEntity struct { func (o *PostIngestsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostIngestsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostIngestsInternalServerError() *PostIngestsInternalServerError { return &PostIngestsInternalServerError{} } -/*PostIngestsInternalServerError handles this case with default header values. +/* PostIngestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostIngestsInternalServerError struct { func (o *PostIngestsInternalServerError) Error() string { return fmt.Sprintf("[POST /ingests][%d] postIngestsInternalServerError %+v", 500, o.Payload) } - func (o *PostIngestsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/ingests/put_ingests_parameters.go b/api/sf-gate/sf_gate_client/ingests/put_ingests_parameters.go index a8de585..3ba9e82 100644 --- a/api/sf-gate/sf_gate_client/ingests/put_ingests_parameters.go +++ b/api/sf-gate/sf_gate_client/ingests/put_ingests_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutIngestsParams creates a new PutIngestsParams object -// with the default values initialized. +// NewPutIngestsParams creates a new PutIngestsParams 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 NewPutIngestsParams() *PutIngestsParams { - var () return &PutIngestsParams{ - timeout: cr.DefaultTimeout, } } // NewPutIngestsParamsWithTimeout creates a new PutIngestsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutIngestsParamsWithTimeout(timeout time.Duration) *PutIngestsParams { - var () return &PutIngestsParams{ - timeout: timeout, } } // NewPutIngestsParamsWithContext creates a new PutIngestsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutIngestsParamsWithContext(ctx context.Context) *PutIngestsParams { - var () return &PutIngestsParams{ - Context: ctx, } } // NewPutIngestsParamsWithHTTPClient creates a new PutIngestsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutIngestsParamsWithHTTPClient(client *http.Client) *PutIngestsParams { - var () return &PutIngestsParams{ HTTPClient: client, } } -/*PutIngestsParams contains all the parameters to send to the API endpoint -for the put ingests operation typically these are written to a http.Request +/* PutIngestsParams contains all the parameters to send to the API endpoint + for the put ingests operation. + + Typically these are written to a http.Request. */ type PutIngestsParams struct { - /*IngestRequest - An array of new Ingest records + /* IngestRequest. + An array of new Ingest records */ IngestRequest *sf_gate_models.IngestRequest @@ -77,6 +76,21 @@ type PutIngestsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutIngestsParams) WithDefaults() *PutIngestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put ingests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutIngestsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put ingests params func (o *PutIngestsParams) WithTimeout(timeout time.Duration) *PutIngestsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutIngestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.IngestRequest != nil { if err := r.SetBodyParam(o.IngestRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/ingests/put_ingests_responses.go b/api/sf-gate/sf_gate_client/ingests/put_ingests_responses.go index 54cf0aa..5c39b09 100644 --- a/api/sf-gate/sf_gate_client/ingests/put_ingests_responses.go +++ b/api/sf-gate/sf_gate_client/ingests/put_ingests_responses.go @@ -63,9 +63,8 @@ func (o *PutIngestsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutIngestsOK() *PutIngestsOK { return &PutIngestsOK{} } -/*PutIngestsOK handles this case with default header values. +/* PutIngestsOK describes a response with status code 200, with default header values. Taxnexus Response with Ingest objects */ @@ -85,7 +84,6 @@ type PutIngestsOK struct { func (o *PutIngestsOK) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsOK %+v", 200, o.Payload) } - func (o *PutIngestsOK) GetPayload() *sf_gate_models.IngestResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPutIngestsUnauthorized() *PutIngestsUnauthorized { return &PutIngestsUnauthorized{} } -/*PutIngestsUnauthorized handles this case with default header values. +/* PutIngestsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PutIngestsUnauthorized struct { func (o *PutIngestsUnauthorized) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsUnauthorized %+v", 401, o.Payload) } - func (o *PutIngestsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPutIngestsForbidden() *PutIngestsForbidden { return &PutIngestsForbidden{} } -/*PutIngestsForbidden handles this case with default header values. +/* PutIngestsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PutIngestsForbidden struct { func (o *PutIngestsForbidden) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsForbidden %+v", 403, o.Payload) } - func (o *PutIngestsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPutIngestsNotFound() *PutIngestsNotFound { return &PutIngestsNotFound{} } -/*PutIngestsNotFound handles this case with default header values. +/* PutIngestsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PutIngestsNotFound struct { func (o *PutIngestsNotFound) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsNotFound %+v", 404, o.Payload) } - func (o *PutIngestsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPutIngestsUnprocessableEntity() *PutIngestsUnprocessableEntity { return &PutIngestsUnprocessableEntity{} } -/*PutIngestsUnprocessableEntity handles this case with default header values. +/* PutIngestsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PutIngestsUnprocessableEntity struct { func (o *PutIngestsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutIngestsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPutIngestsInternalServerError() *PutIngestsInternalServerError { return &PutIngestsInternalServerError{} } -/*PutIngestsInternalServerError handles this case with default header values. +/* PutIngestsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PutIngestsInternalServerError struct { func (o *PutIngestsInternalServerError) Error() string { return fmt.Sprintf("[PUT /ingests][%d] putIngestsInternalServerError %+v", 500, o.Payload) } - func (o *PutIngestsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/invoices/get_invoices_parameters.go b/api/sf-gate/sf_gate_client/invoices/get_invoices_parameters.go index 067291c..4b1a601 100644 --- a/api/sf-gate/sf_gate_client/invoices/get_invoices_parameters.go +++ b/api/sf-gate/sf_gate_client/invoices/get_invoices_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetInvoicesParams creates a new GetInvoicesParams object -// with the default values initialized. +// NewGetInvoicesParams creates a new GetInvoicesParams 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 NewGetInvoicesParams() *GetInvoicesParams { - var () return &GetInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewGetInvoicesParamsWithTimeout creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetInvoicesParamsWithTimeout(timeout time.Duration) *GetInvoicesParams { - var () return &GetInvoicesParams{ - timeout: timeout, } } // NewGetInvoicesParamsWithContext creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetInvoicesParamsWithContext(ctx context.Context) *GetInvoicesParams { - var () return &GetInvoicesParams{ - Context: ctx, } } // NewGetInvoicesParamsWithHTTPClient creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetInvoicesParamsWithHTTPClient(client *http.Client) *GetInvoicesParams { - var () return &GetInvoicesParams{ HTTPClient: client, } } -/*GetInvoicesParams contains all the parameters to send to the API endpoint -for the get invoices operation typically these are written to a http.Request +/* GetInvoicesParams contains all the parameters to send to the API endpoint + for the get invoices operation. + + Typically these are written to a http.Request. */ type GetInvoicesParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*InvoiceID - Taxnexus Id of the Invoice to be retrieved + /* InvoiceID. + + Taxnexus Id of the Invoice to be retrieved */ InvoiceID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInvoicesParams) WithDefaults() *GetInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get invoices params func (o *GetInvoicesParams) WithTimeout(timeout time.Duration) *GetInvoicesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.InvoiceID != nil { // query param invoiceId var qrInvoiceID string + if o.InvoiceID != nil { qrInvoiceID = *o.InvoiceID } qInvoiceID := qrInvoiceID if qInvoiceID != "" { + if err := r.SetQueryParam("invoiceId", qInvoiceID); 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 { diff --git a/api/sf-gate/sf_gate_client/invoices/get_invoices_responses.go b/api/sf-gate/sf_gate_client/invoices/get_invoices_responses.go index fa4d07f..011c9f2 100644 --- a/api/sf-gate/sf_gate_client/invoices/get_invoices_responses.go +++ b/api/sf-gate/sf_gate_client/invoices/get_invoices_responses.go @@ -63,9 +63,8 @@ func (o *GetInvoicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetInvoicesOK() *GetInvoicesOK { return &GetInvoicesOK{} } -/*GetInvoicesOK handles this case with default header values. +/* GetInvoicesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Invoice (full) objects */ @@ -85,7 +84,6 @@ type GetInvoicesOK struct { func (o *GetInvoicesOK) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesOK %+v", 200, o.Payload) } - func (o *GetInvoicesOK) GetPayload() *sf_gate_models.InvoiceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetInvoicesUnauthorized() *GetInvoicesUnauthorized { return &GetInvoicesUnauthorized{} } -/*GetInvoicesUnauthorized handles this case with default header values. +/* GetInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetInvoicesUnauthorized struct { func (o *GetInvoicesUnauthorized) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *GetInvoicesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetInvoicesForbidden() *GetInvoicesForbidden { return &GetInvoicesForbidden{} } -/*GetInvoicesForbidden handles this case with default header values. +/* GetInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetInvoicesForbidden struct { func (o *GetInvoicesForbidden) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesForbidden %+v", 403, o.Payload) } - func (o *GetInvoicesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetInvoicesNotFound() *GetInvoicesNotFound { return &GetInvoicesNotFound{} } -/*GetInvoicesNotFound handles this case with default header values. +/* GetInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetInvoicesNotFound struct { func (o *GetInvoicesNotFound) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesNotFound %+v", 404, o.Payload) } - func (o *GetInvoicesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetInvoicesUnprocessableEntity() *GetInvoicesUnprocessableEntity { return &GetInvoicesUnprocessableEntity{} } -/*GetInvoicesUnprocessableEntity handles this case with default header values. +/* GetInvoicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetInvoicesUnprocessableEntity struct { func (o *GetInvoicesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetInvoicesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetInvoicesInternalServerError() *GetInvoicesInternalServerError { return &GetInvoicesInternalServerError{} } -/*GetInvoicesInternalServerError handles this case with default header values. +/* GetInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetInvoicesInternalServerError struct { func (o *GetInvoicesInternalServerError) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *GetInvoicesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/invoices/invoices_client.go b/api/sf-gate/sf_gate_client/invoices/invoices_client.go index ef4f4cb..b7d34f9 100644 --- a/api/sf-gate/sf_gate_client/invoices/invoices_client.go +++ b/api/sf-gate/sf_gate_client/invoices/invoices_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoicesOK, error) + GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvoicesOK, error) - PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostInvoicesOK, error) + PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostInvoicesOK, error) - PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutInvoicesOK, error) + PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutInvoicesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Taxnexus Invoices */ -func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoicesOK, error) { +func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getInvoices", Method: "GET", PathPattern: "/invoices", @@ -63,7 +65,12 @@ func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientA Create New Invoices */ -func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostInvoicesOK, error) { +func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postInvoices", Method: "POST", PathPattern: "/invoices", @@ -100,7 +106,12 @@ func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.Clien 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 } @@ -119,13 +130,12 @@ func (a *Client) PostInvoices(params *PostInvoicesParams, authInfo runtime.Clien Put a list of Invoices */ -func (a *Client) PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutInvoicesOK, error) { +func (a *Client) PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putInvoices", Method: "PUT", PathPattern: "/invoices", @@ -137,7 +147,12 @@ func (a *Client) PutInvoices(params *PutInvoicesParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/invoices/post_invoices_parameters.go b/api/sf-gate/sf_gate_client/invoices/post_invoices_parameters.go index 9718c00..d345c5f 100644 --- a/api/sf-gate/sf_gate_client/invoices/post_invoices_parameters.go +++ b/api/sf-gate/sf_gate_client/invoices/post_invoices_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostInvoicesParams creates a new PostInvoicesParams object -// with the default values initialized. +// NewPostInvoicesParams creates a new PostInvoicesParams 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 NewPostInvoicesParams() *PostInvoicesParams { - var () return &PostInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewPostInvoicesParamsWithTimeout creates a new PostInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostInvoicesParamsWithTimeout(timeout time.Duration) *PostInvoicesParams { - var () return &PostInvoicesParams{ - timeout: timeout, } } // NewPostInvoicesParamsWithContext creates a new PostInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostInvoicesParamsWithContext(ctx context.Context) *PostInvoicesParams { - var () return &PostInvoicesParams{ - Context: ctx, } } // NewPostInvoicesParamsWithHTTPClient creates a new PostInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostInvoicesParamsWithHTTPClient(client *http.Client) *PostInvoicesParams { - var () return &PostInvoicesParams{ HTTPClient: client, } } -/*PostInvoicesParams contains all the parameters to send to the API endpoint -for the post invoices operation typically these are written to a http.Request +/* PostInvoicesParams contains all the parameters to send to the API endpoint + for the post invoices operation. + + Typically these are written to a http.Request. */ type PostInvoicesParams struct { - /*InvoiceRequest*/ + // InvoiceRequest. InvoiceRequest *sf_gate_models.InvoiceRequest timeout time.Duration @@ -74,6 +73,21 @@ type PostInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostInvoicesParams) WithDefaults() *PostInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post invoices params func (o *PostInvoicesParams) WithTimeout(timeout time.Duration) *PostInvoicesParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.InvoiceRequest != nil { if err := r.SetBodyParam(o.InvoiceRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/invoices/post_invoices_responses.go b/api/sf-gate/sf_gate_client/invoices/post_invoices_responses.go index 47bd506..995c2c9 100644 --- a/api/sf-gate/sf_gate_client/invoices/post_invoices_responses.go +++ b/api/sf-gate/sf_gate_client/invoices/post_invoices_responses.go @@ -57,9 +57,8 @@ func (o *PostInvoicesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostInvoicesOK() *PostInvoicesOK { return &PostInvoicesOK{} } -/*PostInvoicesOK handles this case with default header values. +/* PostInvoicesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Invoice (full) objects */ @@ -79,7 +78,6 @@ type PostInvoicesOK struct { func (o *PostInvoicesOK) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesOK %+v", 200, o.Payload) } - func (o *PostInvoicesOK) GetPayload() *sf_gate_models.InvoiceResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostInvoicesUnauthorized() *PostInvoicesUnauthorized { return &PostInvoicesUnauthorized{} } -/*PostInvoicesUnauthorized handles this case with default header values. +/* PostInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostInvoicesUnauthorized struct { func (o *PostInvoicesUnauthorized) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *PostInvoicesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostInvoicesForbidden() *PostInvoicesForbidden { return &PostInvoicesForbidden{} } -/*PostInvoicesForbidden handles this case with default header values. +/* PostInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostInvoicesForbidden struct { func (o *PostInvoicesForbidden) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesForbidden %+v", 403, o.Payload) } - func (o *PostInvoicesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostInvoicesNotFound() *PostInvoicesNotFound { return &PostInvoicesNotFound{} } -/*PostInvoicesNotFound handles this case with default header values. +/* PostInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostInvoicesNotFound struct { func (o *PostInvoicesNotFound) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesNotFound %+v", 404, o.Payload) } - func (o *PostInvoicesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostInvoicesInternalServerError() *PostInvoicesInternalServerError { return &PostInvoicesInternalServerError{} } -/*PostInvoicesInternalServerError handles this case with default header values. +/* PostInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostInvoicesInternalServerError struct { func (o *PostInvoicesInternalServerError) Error() string { return fmt.Sprintf("[POST /invoices][%d] postInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *PostInvoicesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/invoices/put_invoices_parameters.go b/api/sf-gate/sf_gate_client/invoices/put_invoices_parameters.go index ea3b8e0..f32b3d4 100644 --- a/api/sf-gate/sf_gate_client/invoices/put_invoices_parameters.go +++ b/api/sf-gate/sf_gate_client/invoices/put_invoices_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutInvoicesParams creates a new PutInvoicesParams object -// with the default values initialized. +// NewPutInvoicesParams creates a new PutInvoicesParams 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 NewPutInvoicesParams() *PutInvoicesParams { - var () return &PutInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewPutInvoicesParamsWithTimeout creates a new PutInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutInvoicesParamsWithTimeout(timeout time.Duration) *PutInvoicesParams { - var () return &PutInvoicesParams{ - timeout: timeout, } } // NewPutInvoicesParamsWithContext creates a new PutInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutInvoicesParamsWithContext(ctx context.Context) *PutInvoicesParams { - var () return &PutInvoicesParams{ - Context: ctx, } } // NewPutInvoicesParamsWithHTTPClient creates a new PutInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutInvoicesParamsWithHTTPClient(client *http.Client) *PutInvoicesParams { - var () return &PutInvoicesParams{ HTTPClient: client, } } -/*PutInvoicesParams contains all the parameters to send to the API endpoint -for the put invoices operation typically these are written to a http.Request +/* PutInvoicesParams contains all the parameters to send to the API endpoint + for the put invoices operation. + + Typically these are written to a http.Request. */ type PutInvoicesParams struct { - /*InvoiceRequest*/ + // InvoiceRequest. InvoiceRequest *sf_gate_models.InvoiceRequest timeout time.Duration @@ -74,6 +73,21 @@ type PutInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutInvoicesParams) WithDefaults() *PutInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put invoices params func (o *PutInvoicesParams) WithTimeout(timeout time.Duration) *PutInvoicesParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PutInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.InvoiceRequest != nil { if err := r.SetBodyParam(o.InvoiceRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/invoices/put_invoices_responses.go b/api/sf-gate/sf_gate_client/invoices/put_invoices_responses.go index cbc8609..a307308 100644 --- a/api/sf-gate/sf_gate_client/invoices/put_invoices_responses.go +++ b/api/sf-gate/sf_gate_client/invoices/put_invoices_responses.go @@ -57,9 +57,8 @@ func (o *PutInvoicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutInvoicesOK() *PutInvoicesOK { return &PutInvoicesOK{} } -/*PutInvoicesOK handles this case with default header values. +/* PutInvoicesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Invoice (full) objects */ @@ -79,7 +78,6 @@ type PutInvoicesOK struct { func (o *PutInvoicesOK) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesOK %+v", 200, o.Payload) } - func (o *PutInvoicesOK) GetPayload() *sf_gate_models.InvoiceResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutInvoicesUnauthorized() *PutInvoicesUnauthorized { return &PutInvoicesUnauthorized{} } -/*PutInvoicesUnauthorized handles this case with default header values. +/* PutInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutInvoicesUnauthorized struct { func (o *PutInvoicesUnauthorized) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *PutInvoicesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutInvoicesForbidden() *PutInvoicesForbidden { return &PutInvoicesForbidden{} } -/*PutInvoicesForbidden handles this case with default header values. +/* PutInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutInvoicesForbidden struct { func (o *PutInvoicesForbidden) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesForbidden %+v", 403, o.Payload) } - func (o *PutInvoicesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutInvoicesNotFound() *PutInvoicesNotFound { return &PutInvoicesNotFound{} } -/*PutInvoicesNotFound handles this case with default header values. +/* PutInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutInvoicesNotFound struct { func (o *PutInvoicesNotFound) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesNotFound %+v", 404, o.Payload) } - func (o *PutInvoicesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutInvoicesInternalServerError() *PutInvoicesInternalServerError { return &PutInvoicesInternalServerError{} } -/*PutInvoicesInternalServerError handles this case with default header values. +/* PutInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutInvoicesInternalServerError struct { func (o *PutInvoicesInternalServerError) Error() string { return fmt.Sprintf("[PUT /invoices][%d] putInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *PutInvoicesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/jobs/get_jobs_parameters.go b/api/sf-gate/sf_gate_client/jobs/get_jobs_parameters.go index b917ddd..d458048 100644 --- a/api/sf-gate/sf_gate_client/jobs/get_jobs_parameters.go +++ b/api/sf-gate/sf_gate_client/jobs/get_jobs_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetJobsParams creates a new GetJobsParams object -// with the default values initialized. +// NewGetJobsParams creates a new GetJobsParams 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 NewGetJobsParams() *GetJobsParams { - var () return &GetJobsParams{ - timeout: cr.DefaultTimeout, } } // NewGetJobsParamsWithTimeout creates a new GetJobsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetJobsParamsWithTimeout(timeout time.Duration) *GetJobsParams { - var () return &GetJobsParams{ - timeout: timeout, } } // NewGetJobsParamsWithContext creates a new GetJobsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetJobsParamsWithContext(ctx context.Context) *GetJobsParams { - var () return &GetJobsParams{ - Context: ctx, } } // NewGetJobsParamsWithHTTPClient creates a new GetJobsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetJobsParamsWithHTTPClient(client *http.Client) *GetJobsParams { - var () return &GetJobsParams{ HTTPClient: client, } } -/*GetJobsParams contains all the parameters to send to the API endpoint -for the get jobs operation typically these are written to a http.Request +/* GetJobsParams contains all the parameters to send to the API endpoint + for the get jobs operation. + + Typically these are written to a http.Request. */ type GetJobsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*AccountNumber - The Taxnexus Account Number of the Account to be used a record retrieval + /* AccountNumber. + + The Taxnexus Account Number of the Account to be used a record retrieval */ AccountNumber *string - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*JobID - Taxnexus Record Id of a Job record + /* JobID. + + Taxnexus Record Id of a Job record */ JobID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetJobsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobsParams) WithDefaults() *GetJobsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetJobsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get jobs params func (o *GetJobsParams) WithTimeout(timeout time.Duration) *GetJobsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis // 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.AccountNumber != nil { // query param accountNumber var qrAccountNumber string + if o.AccountNumber != nil { qrAccountNumber = *o.AccountNumber } qAccountNumber := qrAccountNumber if qAccountNumber != "" { + if err := r.SetQueryParam("accountNumber", qAccountNumber); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.JobID != nil { // query param jobId var qrJobID string + if o.JobID != nil { qrJobID = *o.JobID } qJobID := qrJobID if qJobID != "" { + if err := r.SetQueryParam("jobId", qJobID); 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 { diff --git a/api/sf-gate/sf_gate_client/jobs/get_jobs_responses.go b/api/sf-gate/sf_gate_client/jobs/get_jobs_responses.go index 4a01871..6245641 100644 --- a/api/sf-gate/sf_gate_client/jobs/get_jobs_responses.go +++ b/api/sf-gate/sf_gate_client/jobs/get_jobs_responses.go @@ -63,9 +63,8 @@ func (o *GetJobsReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetJobsOK() *GetJobsOK { return &GetJobsOK{} } -/*GetJobsOK handles this case with default header values. +/* GetJobsOK describes a response with status code 200, with default header values. Taxnexus Response with Job objects */ @@ -85,7 +84,6 @@ type GetJobsOK struct { func (o *GetJobsOK) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsOK %+v", 200, o.Payload) } - func (o *GetJobsOK) GetPayload() *sf_gate_models.JobResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetJobsUnauthorized() *GetJobsUnauthorized { return &GetJobsUnauthorized{} } -/*GetJobsUnauthorized handles this case with default header values. +/* GetJobsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetJobsUnauthorized struct { func (o *GetJobsUnauthorized) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsUnauthorized %+v", 401, o.Payload) } - func (o *GetJobsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetJobsForbidden() *GetJobsForbidden { return &GetJobsForbidden{} } -/*GetJobsForbidden handles this case with default header values. +/* GetJobsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetJobsForbidden struct { func (o *GetJobsForbidden) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsForbidden %+v", 403, o.Payload) } - func (o *GetJobsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetJobsNotFound() *GetJobsNotFound { return &GetJobsNotFound{} } -/*GetJobsNotFound handles this case with default header values. +/* GetJobsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetJobsNotFound struct { func (o *GetJobsNotFound) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsNotFound %+v", 404, o.Payload) } - func (o *GetJobsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetJobsUnprocessableEntity() *GetJobsUnprocessableEntity { return &GetJobsUnprocessableEntity{} } -/*GetJobsUnprocessableEntity handles this case with default header values. +/* GetJobsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetJobsUnprocessableEntity struct { func (o *GetJobsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetJobsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetJobsInternalServerError() *GetJobsInternalServerError { return &GetJobsInternalServerError{} } -/*GetJobsInternalServerError handles this case with default header values. +/* GetJobsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetJobsInternalServerError struct { func (o *GetJobsInternalServerError) Error() string { return fmt.Sprintf("[GET /jobs][%d] getJobsInternalServerError %+v", 500, o.Payload) } - func (o *GetJobsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/jobs/jobs_client.go b/api/sf-gate/sf_gate_client/jobs/jobs_client.go index 6da38d5..e9acde4 100644 --- a/api/sf-gate/sf_gate_client/jobs/jobs_client.go +++ b/api/sf-gate/sf_gate_client/jobs/jobs_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobsOK, error) + GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobsOK, error) - PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PostJobsOK, error) + PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostJobsOK, error) - PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PutJobsOK, error) + PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutJobsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Job records from the datastore */ -func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter) (*GetJobsOK, error) { +func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetJobsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetJobsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getJobs", Method: "GET", PathPattern: "/jobs", @@ -63,7 +65,12 @@ func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoW 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 } @@ -82,13 +89,12 @@ func (a *Client) GetJobs(params *GetJobsParams, authInfo runtime.ClientAuthInfoW Create and enqueue Jobs in Taxnexus */ -func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PostJobsOK, error) { +func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostJobsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostJobsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postJobs", Method: "POST", PathPattern: "/jobs", @@ -100,7 +106,12 @@ func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInf 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 } @@ -119,13 +130,12 @@ func (a *Client) PostJobs(params *PostJobsParams, authInfo runtime.ClientAuthInf Update Jobs in Taxnexus */ -func (a *Client) PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter) (*PutJobsOK, error) { +func (a *Client) PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutJobsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutJobsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putJobs", Method: "PUT", PathPattern: "/jobs", @@ -137,7 +147,12 @@ func (a *Client) PutJobs(params *PutJobsParams, authInfo runtime.ClientAuthInfoW 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 } diff --git a/api/sf-gate/sf_gate_client/jobs/post_jobs_parameters.go b/api/sf-gate/sf_gate_client/jobs/post_jobs_parameters.go index b8b4dae..0cf896b 100644 --- a/api/sf-gate/sf_gate_client/jobs/post_jobs_parameters.go +++ b/api/sf-gate/sf_gate_client/jobs/post_jobs_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostJobsParams creates a new PostJobsParams object -// with the default values initialized. +// NewPostJobsParams creates a new PostJobsParams 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 NewPostJobsParams() *PostJobsParams { - var () return &PostJobsParams{ - timeout: cr.DefaultTimeout, } } // NewPostJobsParamsWithTimeout creates a new PostJobsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostJobsParamsWithTimeout(timeout time.Duration) *PostJobsParams { - var () return &PostJobsParams{ - timeout: timeout, } } // NewPostJobsParamsWithContext creates a new PostJobsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostJobsParamsWithContext(ctx context.Context) *PostJobsParams { - var () return &PostJobsParams{ - Context: ctx, } } // NewPostJobsParamsWithHTTPClient creates a new PostJobsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostJobsParamsWithHTTPClient(client *http.Client) *PostJobsParams { - var () return &PostJobsParams{ HTTPClient: client, } } -/*PostJobsParams contains all the parameters to send to the API endpoint -for the post jobs operation typically these are written to a http.Request +/* PostJobsParams contains all the parameters to send to the API endpoint + for the post jobs operation. + + Typically these are written to a http.Request. */ type PostJobsParams struct { - /*JobRequest - An array of new Job records + /* JobRequest. + An array of new Job records */ JobRequest *sf_gate_models.JobRequest @@ -77,6 +76,21 @@ type PostJobsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostJobsParams) WithDefaults() *PostJobsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostJobsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post jobs params func (o *PostJobsParams) WithTimeout(timeout time.Duration) *PostJobsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.JobRequest != nil { if err := r.SetBodyParam(o.JobRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/jobs/post_jobs_responses.go b/api/sf-gate/sf_gate_client/jobs/post_jobs_responses.go index 8df65f2..6da1d7f 100644 --- a/api/sf-gate/sf_gate_client/jobs/post_jobs_responses.go +++ b/api/sf-gate/sf_gate_client/jobs/post_jobs_responses.go @@ -63,9 +63,8 @@ func (o *PostJobsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostJobsOK() *PostJobsOK { return &PostJobsOK{} } -/*PostJobsOK handles this case with default header values. +/* PostJobsOK describes a response with status code 200, with default header values. Taxnexus Response with Job objects */ @@ -85,7 +84,6 @@ type PostJobsOK struct { func (o *PostJobsOK) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsOK %+v", 200, o.Payload) } - func (o *PostJobsOK) GetPayload() *sf_gate_models.JobResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostJobsUnauthorized() *PostJobsUnauthorized { return &PostJobsUnauthorized{} } -/*PostJobsUnauthorized handles this case with default header values. +/* PostJobsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostJobsUnauthorized struct { func (o *PostJobsUnauthorized) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsUnauthorized %+v", 401, o.Payload) } - func (o *PostJobsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostJobsForbidden() *PostJobsForbidden { return &PostJobsForbidden{} } -/*PostJobsForbidden handles this case with default header values. +/* PostJobsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostJobsForbidden struct { func (o *PostJobsForbidden) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsForbidden %+v", 403, o.Payload) } - func (o *PostJobsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostJobsNotFound() *PostJobsNotFound { return &PostJobsNotFound{} } -/*PostJobsNotFound handles this case with default header values. +/* PostJobsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostJobsNotFound struct { func (o *PostJobsNotFound) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsNotFound %+v", 404, o.Payload) } - func (o *PostJobsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostJobsUnprocessableEntity() *PostJobsUnprocessableEntity { return &PostJobsUnprocessableEntity{} } -/*PostJobsUnprocessableEntity handles this case with default header values. +/* PostJobsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostJobsUnprocessableEntity struct { func (o *PostJobsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostJobsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostJobsInternalServerError() *PostJobsInternalServerError { return &PostJobsInternalServerError{} } -/*PostJobsInternalServerError handles this case with default header values. +/* PostJobsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostJobsInternalServerError struct { func (o *PostJobsInternalServerError) Error() string { return fmt.Sprintf("[POST /jobs][%d] postJobsInternalServerError %+v", 500, o.Payload) } - func (o *PostJobsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/jobs/put_jobs_parameters.go b/api/sf-gate/sf_gate_client/jobs/put_jobs_parameters.go index abeaae3..cce1a5e 100644 --- a/api/sf-gate/sf_gate_client/jobs/put_jobs_parameters.go +++ b/api/sf-gate/sf_gate_client/jobs/put_jobs_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutJobsParams creates a new PutJobsParams object -// with the default values initialized. +// NewPutJobsParams creates a new PutJobsParams 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 NewPutJobsParams() *PutJobsParams { - var () return &PutJobsParams{ - timeout: cr.DefaultTimeout, } } // NewPutJobsParamsWithTimeout creates a new PutJobsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutJobsParamsWithTimeout(timeout time.Duration) *PutJobsParams { - var () return &PutJobsParams{ - timeout: timeout, } } // NewPutJobsParamsWithContext creates a new PutJobsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutJobsParamsWithContext(ctx context.Context) *PutJobsParams { - var () return &PutJobsParams{ - Context: ctx, } } // NewPutJobsParamsWithHTTPClient creates a new PutJobsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutJobsParamsWithHTTPClient(client *http.Client) *PutJobsParams { - var () return &PutJobsParams{ HTTPClient: client, } } -/*PutJobsParams contains all the parameters to send to the API endpoint -for the put jobs operation typically these are written to a http.Request +/* PutJobsParams contains all the parameters to send to the API endpoint + for the put jobs operation. + + Typically these are written to a http.Request. */ type PutJobsParams struct { - /*JobRequest - An array of new Job records + /* JobRequest. + An array of new Job records */ JobRequest *sf_gate_models.JobRequest @@ -77,6 +76,21 @@ type PutJobsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutJobsParams) WithDefaults() *PutJobsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put jobs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutJobsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put jobs params func (o *PutJobsParams) WithTimeout(timeout time.Duration) *PutJobsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis return err } var res []error - if o.JobRequest != nil { if err := r.SetBodyParam(o.JobRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/jobs/put_jobs_responses.go b/api/sf-gate/sf_gate_client/jobs/put_jobs_responses.go index d4d130e..42b1af2 100644 --- a/api/sf-gate/sf_gate_client/jobs/put_jobs_responses.go +++ b/api/sf-gate/sf_gate_client/jobs/put_jobs_responses.go @@ -63,9 +63,8 @@ func (o *PutJobsReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutJobsOK() *PutJobsOK { return &PutJobsOK{} } -/*PutJobsOK handles this case with default header values. +/* PutJobsOK describes a response with status code 200, with default header values. Taxnexus Response with Job objects */ @@ -85,7 +84,6 @@ type PutJobsOK struct { func (o *PutJobsOK) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsOK %+v", 200, o.Payload) } - func (o *PutJobsOK) GetPayload() *sf_gate_models.JobResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPutJobsUnauthorized() *PutJobsUnauthorized { return &PutJobsUnauthorized{} } -/*PutJobsUnauthorized handles this case with default header values. +/* PutJobsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PutJobsUnauthorized struct { func (o *PutJobsUnauthorized) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsUnauthorized %+v", 401, o.Payload) } - func (o *PutJobsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPutJobsForbidden() *PutJobsForbidden { return &PutJobsForbidden{} } -/*PutJobsForbidden handles this case with default header values. +/* PutJobsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PutJobsForbidden struct { func (o *PutJobsForbidden) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsForbidden %+v", 403, o.Payload) } - func (o *PutJobsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPutJobsNotFound() *PutJobsNotFound { return &PutJobsNotFound{} } -/*PutJobsNotFound handles this case with default header values. +/* PutJobsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PutJobsNotFound struct { func (o *PutJobsNotFound) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsNotFound %+v", 404, o.Payload) } - func (o *PutJobsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPutJobsUnprocessableEntity() *PutJobsUnprocessableEntity { return &PutJobsUnprocessableEntity{} } -/*PutJobsUnprocessableEntity handles this case with default header values. +/* PutJobsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PutJobsUnprocessableEntity struct { func (o *PutJobsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutJobsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPutJobsInternalServerError() *PutJobsInternalServerError { return &PutJobsInternalServerError{} } -/*PutJobsInternalServerError handles this case with default header values. +/* PutJobsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PutJobsInternalServerError struct { func (o *PutJobsInternalServerError) Error() string { return fmt.Sprintf("[PUT /jobs][%d] putJobsInternalServerError %+v", 500, o.Payload) } - func (o *PutJobsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/license_types/get_license_types_parameters.go b/api/sf-gate/sf_gate_client/license_types/get_license_types_parameters.go index 9358508..fd64511 100644 --- a/api/sf-gate/sf_gate_client/license_types/get_license_types_parameters.go +++ b/api/sf-gate/sf_gate_client/license_types/get_license_types_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetLicenseTypesParams creates a new GetLicenseTypesParams object -// with the default values initialized. +// NewGetLicenseTypesParams creates a new GetLicenseTypesParams 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 NewGetLicenseTypesParams() *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetLicenseTypesParamsWithTimeout creates a new GetLicenseTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLicenseTypesParamsWithTimeout(timeout time.Duration) *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ - timeout: timeout, } } // NewGetLicenseTypesParamsWithContext creates a new GetLicenseTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLicenseTypesParamsWithContext(ctx context.Context) *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ - Context: ctx, } } // NewGetLicenseTypesParamsWithHTTPClient creates a new GetLicenseTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLicenseTypesParamsWithHTTPClient(client *http.Client) *GetLicenseTypesParams { - var () return &GetLicenseTypesParams{ HTTPClient: client, } } -/*GetLicenseTypesParams contains all the parameters to send to the API endpoint -for the get license types operation typically these are written to a http.Request +/* GetLicenseTypesParams contains all the parameters to send to the API endpoint + for the get license types operation. + + Typically these are written to a http.Request. */ type GetLicenseTypesParams struct { - /*Active - Retrieve only active records? + /* Active. + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*LicensetypeID - Taxnexus Id of the License Type to be retrieved + /* LicensetypeID. + + Taxnexus Id of the License Type to be retrieved */ LicensetypeID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -96,6 +103,21 @@ type GetLicenseTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get license types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicenseTypesParams) WithDefaults() *GetLicenseTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get license types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicenseTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get license types params func (o *GetLicenseTypesParams) WithTimeout(timeout time.Duration) *GetLicenseTypesParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetLicenseTypesParams) WriteToRequest(r runtime.ClientRequest, reg strf // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.LicensetypeID != nil { // query param licensetypeId var qrLicensetypeID string + if o.LicensetypeID != nil { qrLicensetypeID = *o.LicensetypeID } qLicensetypeID := qrLicensetypeID if qLicensetypeID != "" { + if err := r.SetQueryParam("licensetypeId", qLicensetypeID); 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 { diff --git a/api/sf-gate/sf_gate_client/license_types/get_license_types_responses.go b/api/sf-gate/sf_gate_client/license_types/get_license_types_responses.go index 37c50dc..02e5881 100644 --- a/api/sf-gate/sf_gate_client/license_types/get_license_types_responses.go +++ b/api/sf-gate/sf_gate_client/license_types/get_license_types_responses.go @@ -63,9 +63,8 @@ func (o *GetLicenseTypesReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetLicenseTypesOK() *GetLicenseTypesOK { return &GetLicenseTypesOK{} } -/*GetLicenseTypesOK handles this case with default header values. +/* GetLicenseTypesOK describes a response with status code 200, with default header values. An array of License Type Objects */ @@ -85,7 +84,6 @@ type GetLicenseTypesOK struct { func (o *GetLicenseTypesOK) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesOK %+v", 200, o.Payload) } - func (o *GetLicenseTypesOK) GetPayload() *sf_gate_models.LicenseTypeResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetLicenseTypesUnauthorized() *GetLicenseTypesUnauthorized { return &GetLicenseTypesUnauthorized{} } -/*GetLicenseTypesUnauthorized handles this case with default header values. +/* GetLicenseTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetLicenseTypesUnauthorized struct { func (o *GetLicenseTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetLicenseTypesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetLicenseTypesForbidden() *GetLicenseTypesForbidden { return &GetLicenseTypesForbidden{} } -/*GetLicenseTypesForbidden handles this case with default header values. +/* GetLicenseTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetLicenseTypesForbidden struct { func (o *GetLicenseTypesForbidden) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesForbidden %+v", 403, o.Payload) } - func (o *GetLicenseTypesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetLicenseTypesNotFound() *GetLicenseTypesNotFound { return &GetLicenseTypesNotFound{} } -/*GetLicenseTypesNotFound handles this case with default header values. +/* GetLicenseTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetLicenseTypesNotFound struct { func (o *GetLicenseTypesNotFound) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesNotFound %+v", 404, o.Payload) } - func (o *GetLicenseTypesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetLicenseTypesUnprocessableEntity() *GetLicenseTypesUnprocessableEntity return &GetLicenseTypesUnprocessableEntity{} } -/*GetLicenseTypesUnprocessableEntity handles this case with default header values. +/* GetLicenseTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetLicenseTypesUnprocessableEntity struct { func (o *GetLicenseTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetLicenseTypesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetLicenseTypesInternalServerError() *GetLicenseTypesInternalServerError return &GetLicenseTypesInternalServerError{} } -/*GetLicenseTypesInternalServerError handles this case with default header values. +/* GetLicenseTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetLicenseTypesInternalServerError struct { func (o *GetLicenseTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /licensetypes][%d] getLicenseTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetLicenseTypesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/license_types/license_types_client.go b/api/sf-gate/sf_gate_client/license_types/license_types_client.go index ce787dd..e683fee 100644 --- a/api/sf-gate/sf_gate_client/license_types/license_types_client.go +++ b/api/sf-gate/sf_gate_client/license_types/license_types_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicenseTypesOK, error) + GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicenseTypesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Retrieve LicenseType records */ -func (a *Client) GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicenseTypesOK, error) { +func (a *Client) GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicenseTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLicenseTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLicenseTypes", Method: "GET", PathPattern: "/licensetypes", @@ -59,7 +61,12 @@ func (a *Client) GetLicenseTypes(params *GetLicenseTypesParams, authInfo runtime 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 } diff --git a/api/sf-gate/sf_gate_client/licenses/get_licenses_parameters.go b/api/sf-gate/sf_gate_client/licenses/get_licenses_parameters.go index bbab9b1..d784923 100644 --- a/api/sf-gate/sf_gate_client/licenses/get_licenses_parameters.go +++ b/api/sf-gate/sf_gate_client/licenses/get_licenses_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetLicensesParams creates a new GetLicensesParams object -// with the default values initialized. +// NewGetLicensesParams creates a new GetLicensesParams 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 NewGetLicensesParams() *GetLicensesParams { - var () return &GetLicensesParams{ - timeout: cr.DefaultTimeout, } } // NewGetLicensesParamsWithTimeout creates a new GetLicensesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLicensesParamsWithTimeout(timeout time.Duration) *GetLicensesParams { - var () return &GetLicensesParams{ - timeout: timeout, } } // NewGetLicensesParamsWithContext creates a new GetLicensesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLicensesParamsWithContext(ctx context.Context) *GetLicensesParams { - var () return &GetLicensesParams{ - Context: ctx, } } // NewGetLicensesParamsWithHTTPClient creates a new GetLicensesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLicensesParamsWithHTTPClient(client *http.Client) *GetLicensesParams { - var () return &GetLicensesParams{ HTTPClient: client, } } -/*GetLicensesParams contains all the parameters to send to the API endpoint -for the get licenses operation typically these are written to a http.Request +/* GetLicensesParams contains all the parameters to send to the API endpoint + for the get licenses operation. + + Typically these are written to a http.Request. */ type GetLicensesParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*LicenseID - Taxnexus Id of the License to be retrieved + /* LicenseID. + + Taxnexus Id of the License to be retrieved */ LicenseID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -101,6 +109,21 @@ type GetLicensesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicensesParams) WithDefaults() *GetLicensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLicensesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get licenses params func (o *GetLicensesParams) WithTimeout(timeout time.Duration) *GetLicensesParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetLicensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if o.LicenseID != nil { // query param licenseId var qrLicenseID string + if o.LicenseID != nil { qrLicenseID = *o.LicenseID } qLicenseID := qrLicenseID if qLicenseID != "" { + if err := r.SetQueryParam("licenseId", qLicenseID); 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 { diff --git a/api/sf-gate/sf_gate_client/licenses/get_licenses_responses.go b/api/sf-gate/sf_gate_client/licenses/get_licenses_responses.go index 2b9d589..c60bc7b 100644 --- a/api/sf-gate/sf_gate_client/licenses/get_licenses_responses.go +++ b/api/sf-gate/sf_gate_client/licenses/get_licenses_responses.go @@ -63,9 +63,8 @@ func (o *GetLicensesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetLicensesOK() *GetLicensesOK { return &GetLicensesOK{} } -/*GetLicensesOK handles this case with default header values. +/* GetLicensesOK describes a response with status code 200, with default header values. An array of License Objects */ @@ -85,7 +84,6 @@ type GetLicensesOK struct { func (o *GetLicensesOK) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesOK %+v", 200, o.Payload) } - func (o *GetLicensesOK) GetPayload() *sf_gate_models.LicenseResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetLicensesUnauthorized() *GetLicensesUnauthorized { return &GetLicensesUnauthorized{} } -/*GetLicensesUnauthorized handles this case with default header values. +/* GetLicensesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetLicensesUnauthorized struct { func (o *GetLicensesUnauthorized) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesUnauthorized %+v", 401, o.Payload) } - func (o *GetLicensesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetLicensesForbidden() *GetLicensesForbidden { return &GetLicensesForbidden{} } -/*GetLicensesForbidden handles this case with default header values. +/* GetLicensesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetLicensesForbidden struct { func (o *GetLicensesForbidden) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesForbidden %+v", 403, o.Payload) } - func (o *GetLicensesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetLicensesNotFound() *GetLicensesNotFound { return &GetLicensesNotFound{} } -/*GetLicensesNotFound handles this case with default header values. +/* GetLicensesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetLicensesNotFound struct { func (o *GetLicensesNotFound) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesNotFound %+v", 404, o.Payload) } - func (o *GetLicensesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetLicensesUnprocessableEntity() *GetLicensesUnprocessableEntity { return &GetLicensesUnprocessableEntity{} } -/*GetLicensesUnprocessableEntity handles this case with default header values. +/* GetLicensesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetLicensesUnprocessableEntity struct { func (o *GetLicensesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetLicensesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetLicensesInternalServerError() *GetLicensesInternalServerError { return &GetLicensesInternalServerError{} } -/*GetLicensesInternalServerError handles this case with default header values. +/* GetLicensesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetLicensesInternalServerError struct { func (o *GetLicensesInternalServerError) Error() string { return fmt.Sprintf("[GET /licenses][%d] getLicensesInternalServerError %+v", 500, o.Payload) } - func (o *GetLicensesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/licenses/licenses_client.go b/api/sf-gate/sf_gate_client/licenses/licenses_client.go index 81d082f..c1c3542 100644 --- a/api/sf-gate/sf_gate_client/licenses/licenses_client.go +++ b/api/sf-gate/sf_gate_client/licenses/licenses_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicensesOK, error) + GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicensesOK, error) - PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLicensesOK, error) + PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLicensesOK, error) - PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PutLicensesOK, error) + PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLicensesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Retrieve all licenses, filter with parameters */ -func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLicensesOK, error) { +func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicensesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLicensesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getLicenses", Method: "GET", PathPattern: "/licenses", @@ -63,7 +65,12 @@ func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetLicenses(params *GetLicensesParams, authInfo runtime.ClientA Create new Licenses */ -func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLicensesOK, error) { +func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLicensesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostLicensesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postLicenses", Method: "POST", PathPattern: "/licenses", @@ -100,7 +106,12 @@ func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.Clien 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 } @@ -119,13 +130,12 @@ func (a *Client) PostLicenses(params *PostLicensesParams, authInfo runtime.Clien Add or update licenses */ -func (a *Client) PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter) (*PutLicensesOK, error) { +func (a *Client) PutLicenses(params *PutLicensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutLicensesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutLicensesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putLicenses", Method: "PUT", PathPattern: "/licenses", @@ -137,7 +147,12 @@ func (a *Client) PutLicenses(params *PutLicensesParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/licenses/post_licenses_parameters.go b/api/sf-gate/sf_gate_client/licenses/post_licenses_parameters.go index 09972a3..129aae0 100644 --- a/api/sf-gate/sf_gate_client/licenses/post_licenses_parameters.go +++ b/api/sf-gate/sf_gate_client/licenses/post_licenses_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostLicensesParams creates a new PostLicensesParams object -// with the default values initialized. +// NewPostLicensesParams creates a new PostLicensesParams 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 NewPostLicensesParams() *PostLicensesParams { - var () return &PostLicensesParams{ - timeout: cr.DefaultTimeout, } } // NewPostLicensesParamsWithTimeout creates a new PostLicensesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostLicensesParamsWithTimeout(timeout time.Duration) *PostLicensesParams { - var () return &PostLicensesParams{ - timeout: timeout, } } // NewPostLicensesParamsWithContext creates a new PostLicensesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostLicensesParamsWithContext(ctx context.Context) *PostLicensesParams { - var () return &PostLicensesParams{ - Context: ctx, } } // NewPostLicensesParamsWithHTTPClient creates a new PostLicensesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostLicensesParamsWithHTTPClient(client *http.Client) *PostLicensesParams { - var () return &PostLicensesParams{ HTTPClient: client, } } -/*PostLicensesParams contains all the parameters to send to the API endpoint -for the post licenses operation typically these are written to a http.Request +/* PostLicensesParams contains all the parameters to send to the API endpoint + for the post licenses operation. + + Typically these are written to a http.Request. */ type PostLicensesParams struct { - /*LicenseRequest - The new licenses + /* LicenseRequest. + The new licenses */ LicenseRequest *sf_gate_models.LicenseRequest @@ -77,6 +76,21 @@ type PostLicensesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLicensesParams) WithDefaults() *PostLicensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLicensesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post licenses params func (o *PostLicensesParams) WithTimeout(timeout time.Duration) *PostLicensesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostLicensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.LicenseRequest != nil { if err := r.SetBodyParam(o.LicenseRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/licenses/post_licenses_responses.go b/api/sf-gate/sf_gate_client/licenses/post_licenses_responses.go index 5d65853..0523d94 100644 --- a/api/sf-gate/sf_gate_client/licenses/post_licenses_responses.go +++ b/api/sf-gate/sf_gate_client/licenses/post_licenses_responses.go @@ -57,9 +57,8 @@ func (o *PostLicensesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostLicensesOK() *PostLicensesOK { return &PostLicensesOK{} } -/*PostLicensesOK handles this case with default header values. +/* PostLicensesOK describes a response with status code 200, with default header values. An array of License Objects */ @@ -79,7 +78,6 @@ type PostLicensesOK struct { func (o *PostLicensesOK) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesOK %+v", 200, o.Payload) } - func (o *PostLicensesOK) GetPayload() *sf_gate_models.LicenseResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostLicensesUnauthorized() *PostLicensesUnauthorized { return &PostLicensesUnauthorized{} } -/*PostLicensesUnauthorized handles this case with default header values. +/* PostLicensesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostLicensesUnauthorized struct { func (o *PostLicensesUnauthorized) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesUnauthorized %+v", 401, o.Payload) } - func (o *PostLicensesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostLicensesForbidden() *PostLicensesForbidden { return &PostLicensesForbidden{} } -/*PostLicensesForbidden handles this case with default header values. +/* PostLicensesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostLicensesForbidden struct { func (o *PostLicensesForbidden) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesForbidden %+v", 403, o.Payload) } - func (o *PostLicensesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostLicensesNotFound() *PostLicensesNotFound { return &PostLicensesNotFound{} } -/*PostLicensesNotFound handles this case with default header values. +/* PostLicensesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostLicensesNotFound struct { func (o *PostLicensesNotFound) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesNotFound %+v", 404, o.Payload) } - func (o *PostLicensesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostLicensesInternalServerError() *PostLicensesInternalServerError { return &PostLicensesInternalServerError{} } -/*PostLicensesInternalServerError handles this case with default header values. +/* PostLicensesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostLicensesInternalServerError struct { func (o *PostLicensesInternalServerError) Error() string { return fmt.Sprintf("[POST /licenses][%d] postLicensesInternalServerError %+v", 500, o.Payload) } - func (o *PostLicensesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/licenses/put_licenses_parameters.go b/api/sf-gate/sf_gate_client/licenses/put_licenses_parameters.go index d3defec..171fdb6 100644 --- a/api/sf-gate/sf_gate_client/licenses/put_licenses_parameters.go +++ b/api/sf-gate/sf_gate_client/licenses/put_licenses_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutLicensesParams creates a new PutLicensesParams object -// with the default values initialized. +// NewPutLicensesParams creates a new PutLicensesParams 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 NewPutLicensesParams() *PutLicensesParams { - var () return &PutLicensesParams{ - timeout: cr.DefaultTimeout, } } // NewPutLicensesParamsWithTimeout creates a new PutLicensesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutLicensesParamsWithTimeout(timeout time.Duration) *PutLicensesParams { - var () return &PutLicensesParams{ - timeout: timeout, } } // NewPutLicensesParamsWithContext creates a new PutLicensesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutLicensesParamsWithContext(ctx context.Context) *PutLicensesParams { - var () return &PutLicensesParams{ - Context: ctx, } } // NewPutLicensesParamsWithHTTPClient creates a new PutLicensesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutLicensesParamsWithHTTPClient(client *http.Client) *PutLicensesParams { - var () return &PutLicensesParams{ HTTPClient: client, } } -/*PutLicensesParams contains all the parameters to send to the API endpoint -for the put licenses operation typically these are written to a http.Request +/* PutLicensesParams contains all the parameters to send to the API endpoint + for the put licenses operation. + + Typically these are written to a http.Request. */ type PutLicensesParams struct { - /*LicenseRequest - The updated licenses + /* LicenseRequest. + The updated licenses */ LicenseRequest *sf_gate_models.LicenseRequest @@ -77,6 +76,21 @@ type PutLicensesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutLicensesParams) WithDefaults() *PutLicensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put licenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutLicensesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put licenses params func (o *PutLicensesParams) WithTimeout(timeout time.Duration) *PutLicensesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutLicensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.LicenseRequest != nil { if err := r.SetBodyParam(o.LicenseRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/licenses/put_licenses_responses.go b/api/sf-gate/sf_gate_client/licenses/put_licenses_responses.go index 27ebabe..36938d8 100644 --- a/api/sf-gate/sf_gate_client/licenses/put_licenses_responses.go +++ b/api/sf-gate/sf_gate_client/licenses/put_licenses_responses.go @@ -57,9 +57,8 @@ func (o *PutLicensesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutLicensesOK() *PutLicensesOK { return &PutLicensesOK{} } -/*PutLicensesOK handles this case with default header values. +/* PutLicensesOK describes a response with status code 200, with default header values. An array of License Objects */ @@ -79,7 +78,6 @@ type PutLicensesOK struct { func (o *PutLicensesOK) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesOK %+v", 200, o.Payload) } - func (o *PutLicensesOK) GetPayload() *sf_gate_models.LicenseResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutLicensesUnauthorized() *PutLicensesUnauthorized { return &PutLicensesUnauthorized{} } -/*PutLicensesUnauthorized handles this case with default header values. +/* PutLicensesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutLicensesUnauthorized struct { func (o *PutLicensesUnauthorized) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesUnauthorized %+v", 401, o.Payload) } - func (o *PutLicensesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutLicensesForbidden() *PutLicensesForbidden { return &PutLicensesForbidden{} } -/*PutLicensesForbidden handles this case with default header values. +/* PutLicensesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutLicensesForbidden struct { func (o *PutLicensesForbidden) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesForbidden %+v", 403, o.Payload) } - func (o *PutLicensesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutLicensesNotFound() *PutLicensesNotFound { return &PutLicensesNotFound{} } -/*PutLicensesNotFound handles this case with default header values. +/* PutLicensesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutLicensesNotFound struct { func (o *PutLicensesNotFound) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesNotFound %+v", 404, o.Payload) } - func (o *PutLicensesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutLicensesInternalServerError() *PutLicensesInternalServerError { return &PutLicensesInternalServerError{} } -/*PutLicensesInternalServerError handles this case with default header values. +/* PutLicensesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutLicensesInternalServerError struct { func (o *PutLicensesInternalServerError) Error() string { return fmt.Sprintf("[PUT /licenses][%d] putLicensesInternalServerError %+v", 500, o.Payload) } - func (o *PutLicensesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/notebooks/get_notebooks_parameters.go b/api/sf-gate/sf_gate_client/notebooks/get_notebooks_parameters.go index 8f91b11..9e4017a 100644 --- a/api/sf-gate/sf_gate_client/notebooks/get_notebooks_parameters.go +++ b/api/sf-gate/sf_gate_client/notebooks/get_notebooks_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetNotebooksParams creates a new GetNotebooksParams object -// with the default values initialized. +// NewGetNotebooksParams creates a new GetNotebooksParams 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 NewGetNotebooksParams() *GetNotebooksParams { - var () return &GetNotebooksParams{ - timeout: cr.DefaultTimeout, } } // NewGetNotebooksParamsWithTimeout creates a new GetNotebooksParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetNotebooksParamsWithTimeout(timeout time.Duration) *GetNotebooksParams { - var () return &GetNotebooksParams{ - timeout: timeout, } } // NewGetNotebooksParamsWithContext creates a new GetNotebooksParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetNotebooksParamsWithContext(ctx context.Context) *GetNotebooksParams { - var () return &GetNotebooksParams{ - Context: ctx, } } // NewGetNotebooksParamsWithHTTPClient creates a new GetNotebooksParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetNotebooksParamsWithHTTPClient(client *http.Client) *GetNotebooksParams { - var () return &GetNotebooksParams{ HTTPClient: client, } } -/*GetNotebooksParams contains all the parameters to send to the API endpoint -for the get notebooks operation typically these are written to a http.Request +/* GetNotebooksParams contains all the parameters to send to the API endpoint + for the get notebooks operation. + + Typically these are written to a http.Request. */ type GetNotebooksParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*NotebookID - Template ID + /* NotebookID. + + Template ID */ NotebookID *string - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 @@ -86,6 +91,21 @@ type GetNotebooksParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetNotebooksParams) WithDefaults() *GetNotebooksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetNotebooksParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get notebooks params func (o *GetNotebooksParams) WithTimeout(timeout time.Duration) *GetNotebooksParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetNotebooksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // 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.NotebookID != nil { // query param notebookId var qrNotebookID string + if o.NotebookID != nil { qrNotebookID = *o.NotebookID } qNotebookID := qrNotebookID if qNotebookID != "" { + if err := r.SetQueryParam("notebookId", qNotebookID); 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 { diff --git a/api/sf-gate/sf_gate_client/notebooks/get_notebooks_responses.go b/api/sf-gate/sf_gate_client/notebooks/get_notebooks_responses.go index 0a1b134..c95ec1e 100644 --- a/api/sf-gate/sf_gate_client/notebooks/get_notebooks_responses.go +++ b/api/sf-gate/sf_gate_client/notebooks/get_notebooks_responses.go @@ -63,9 +63,8 @@ func (o *GetNotebooksReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetNotebooksOK() *GetNotebooksOK { return &GetNotebooksOK{} } -/*GetNotebooksOK handles this case with default header values. +/* GetNotebooksOK describes a response with status code 200, with default header values. Taxnexus Response with Notebook objects */ @@ -85,7 +84,6 @@ type GetNotebooksOK struct { func (o *GetNotebooksOK) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksOK %+v", 200, o.Payload) } - func (o *GetNotebooksOK) GetPayload() *sf_gate_models.NotebookResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetNotebooksUnauthorized() *GetNotebooksUnauthorized { return &GetNotebooksUnauthorized{} } -/*GetNotebooksUnauthorized handles this case with default header values. +/* GetNotebooksUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetNotebooksUnauthorized struct { func (o *GetNotebooksUnauthorized) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksUnauthorized %+v", 401, o.Payload) } - func (o *GetNotebooksUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetNotebooksForbidden() *GetNotebooksForbidden { return &GetNotebooksForbidden{} } -/*GetNotebooksForbidden handles this case with default header values. +/* GetNotebooksForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetNotebooksForbidden struct { func (o *GetNotebooksForbidden) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksForbidden %+v", 403, o.Payload) } - func (o *GetNotebooksForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetNotebooksNotFound() *GetNotebooksNotFound { return &GetNotebooksNotFound{} } -/*GetNotebooksNotFound handles this case with default header values. +/* GetNotebooksNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetNotebooksNotFound struct { func (o *GetNotebooksNotFound) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksNotFound %+v", 404, o.Payload) } - func (o *GetNotebooksNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetNotebooksUnprocessableEntity() *GetNotebooksUnprocessableEntity { return &GetNotebooksUnprocessableEntity{} } -/*GetNotebooksUnprocessableEntity handles this case with default header values. +/* GetNotebooksUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetNotebooksUnprocessableEntity struct { func (o *GetNotebooksUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetNotebooksUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetNotebooksInternalServerError() *GetNotebooksInternalServerError { return &GetNotebooksInternalServerError{} } -/*GetNotebooksInternalServerError handles this case with default header values. +/* GetNotebooksInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetNotebooksInternalServerError struct { func (o *GetNotebooksInternalServerError) Error() string { return fmt.Sprintf("[GET /notebooks][%d] getNotebooksInternalServerError %+v", 500, o.Payload) } - func (o *GetNotebooksInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/notebooks/notebooks_client.go b/api/sf-gate/sf_gate_client/notebooks/notebooks_client.go index dc897ea..ef25440 100644 --- a/api/sf-gate/sf_gate_client/notebooks/notebooks_client.go +++ b/api/sf-gate/sf_gate_client/notebooks/notebooks_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*GetNotebooksOK, error) + GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetNotebooksOK, error) - PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PostNotebooksOK, error) + PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostNotebooksOK, error) - PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PutNotebooksOK, error) + PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutNotebooksOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Notebook records from the datastore */ -func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*GetNotebooksOK, error) { +func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetNotebooksOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetNotebooksParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getNotebooks", Method: "GET", PathPattern: "/notebooks", @@ -63,7 +65,12 @@ func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.Clien 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 } @@ -82,13 +89,12 @@ func (a *Client) GetNotebooks(params *GetNotebooksParams, authInfo runtime.Clien Create Notebooks in Taxnexus */ -func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PostNotebooksOK, error) { +func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostNotebooksOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostNotebooksParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postNotebooks", Method: "POST", PathPattern: "/notebooks", @@ -100,7 +106,12 @@ func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.Cli 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 } @@ -119,13 +130,12 @@ func (a *Client) PostNotebooks(params *PostNotebooksParams, authInfo runtime.Cli Update Notebooks in Taxnexus */ -func (a *Client) PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter) (*PutNotebooksOK, error) { +func (a *Client) PutNotebooks(params *PutNotebooksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutNotebooksOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutNotebooksParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putNotebooks", Method: "PUT", PathPattern: "/notebooks", @@ -137,7 +147,12 @@ func (a *Client) PutNotebooks(params *PutNotebooksParams, authInfo runtime.Clien 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 } diff --git a/api/sf-gate/sf_gate_client/notebooks/post_notebooks_parameters.go b/api/sf-gate/sf_gate_client/notebooks/post_notebooks_parameters.go index 7d38d2e..d44534b 100644 --- a/api/sf-gate/sf_gate_client/notebooks/post_notebooks_parameters.go +++ b/api/sf-gate/sf_gate_client/notebooks/post_notebooks_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostNotebooksParams creates a new PostNotebooksParams object -// with the default values initialized. +// NewPostNotebooksParams creates a new PostNotebooksParams 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 NewPostNotebooksParams() *PostNotebooksParams { - var () return &PostNotebooksParams{ - timeout: cr.DefaultTimeout, } } // NewPostNotebooksParamsWithTimeout creates a new PostNotebooksParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostNotebooksParamsWithTimeout(timeout time.Duration) *PostNotebooksParams { - var () return &PostNotebooksParams{ - timeout: timeout, } } // NewPostNotebooksParamsWithContext creates a new PostNotebooksParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostNotebooksParamsWithContext(ctx context.Context) *PostNotebooksParams { - var () return &PostNotebooksParams{ - Context: ctx, } } // NewPostNotebooksParamsWithHTTPClient creates a new PostNotebooksParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostNotebooksParamsWithHTTPClient(client *http.Client) *PostNotebooksParams { - var () return &PostNotebooksParams{ HTTPClient: client, } } -/*PostNotebooksParams contains all the parameters to send to the API endpoint -for the post notebooks operation typically these are written to a http.Request +/* PostNotebooksParams contains all the parameters to send to the API endpoint + for the post notebooks operation. + + Typically these are written to a http.Request. */ type PostNotebooksParams struct { - /*NotebookRequest - An array of Notebook records + /* NotebookRequest. + An array of Notebook records */ NotebookRequest *sf_gate_models.NotebookRequest @@ -77,6 +76,21 @@ type PostNotebooksParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostNotebooksParams) WithDefaults() *PostNotebooksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostNotebooksParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post notebooks params func (o *PostNotebooksParams) WithTimeout(timeout time.Duration) *PostNotebooksParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostNotebooksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.NotebookRequest != nil { if err := r.SetBodyParam(o.NotebookRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/notebooks/post_notebooks_responses.go b/api/sf-gate/sf_gate_client/notebooks/post_notebooks_responses.go index 771eeed..05d11ee 100644 --- a/api/sf-gate/sf_gate_client/notebooks/post_notebooks_responses.go +++ b/api/sf-gate/sf_gate_client/notebooks/post_notebooks_responses.go @@ -63,9 +63,8 @@ func (o *PostNotebooksReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostNotebooksOK() *PostNotebooksOK { return &PostNotebooksOK{} } -/*PostNotebooksOK handles this case with default header values. +/* PostNotebooksOK describes a response with status code 200, with default header values. Taxnexus Response with Notebook objects */ @@ -85,7 +84,6 @@ type PostNotebooksOK struct { func (o *PostNotebooksOK) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksOK %+v", 200, o.Payload) } - func (o *PostNotebooksOK) GetPayload() *sf_gate_models.NotebookResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostNotebooksUnauthorized() *PostNotebooksUnauthorized { return &PostNotebooksUnauthorized{} } -/*PostNotebooksUnauthorized handles this case with default header values. +/* PostNotebooksUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostNotebooksUnauthorized struct { func (o *PostNotebooksUnauthorized) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksUnauthorized %+v", 401, o.Payload) } - func (o *PostNotebooksUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostNotebooksForbidden() *PostNotebooksForbidden { return &PostNotebooksForbidden{} } -/*PostNotebooksForbidden handles this case with default header values. +/* PostNotebooksForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostNotebooksForbidden struct { func (o *PostNotebooksForbidden) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksForbidden %+v", 403, o.Payload) } - func (o *PostNotebooksForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostNotebooksNotFound() *PostNotebooksNotFound { return &PostNotebooksNotFound{} } -/*PostNotebooksNotFound handles this case with default header values. +/* PostNotebooksNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostNotebooksNotFound struct { func (o *PostNotebooksNotFound) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksNotFound %+v", 404, o.Payload) } - func (o *PostNotebooksNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostNotebooksUnprocessableEntity() *PostNotebooksUnprocessableEntity { return &PostNotebooksUnprocessableEntity{} } -/*PostNotebooksUnprocessableEntity handles this case with default header values. +/* PostNotebooksUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostNotebooksUnprocessableEntity struct { func (o *PostNotebooksUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostNotebooksUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostNotebooksInternalServerError() *PostNotebooksInternalServerError { return &PostNotebooksInternalServerError{} } -/*PostNotebooksInternalServerError handles this case with default header values. +/* PostNotebooksInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostNotebooksInternalServerError struct { func (o *PostNotebooksInternalServerError) Error() string { return fmt.Sprintf("[POST /notebooks][%d] postNotebooksInternalServerError %+v", 500, o.Payload) } - func (o *PostNotebooksInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/notebooks/put_notebooks_parameters.go b/api/sf-gate/sf_gate_client/notebooks/put_notebooks_parameters.go index 5ea38dd..55e58b6 100644 --- a/api/sf-gate/sf_gate_client/notebooks/put_notebooks_parameters.go +++ b/api/sf-gate/sf_gate_client/notebooks/put_notebooks_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutNotebooksParams creates a new PutNotebooksParams object -// with the default values initialized. +// NewPutNotebooksParams creates a new PutNotebooksParams 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 NewPutNotebooksParams() *PutNotebooksParams { - var () return &PutNotebooksParams{ - timeout: cr.DefaultTimeout, } } // NewPutNotebooksParamsWithTimeout creates a new PutNotebooksParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutNotebooksParamsWithTimeout(timeout time.Duration) *PutNotebooksParams { - var () return &PutNotebooksParams{ - timeout: timeout, } } // NewPutNotebooksParamsWithContext creates a new PutNotebooksParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutNotebooksParamsWithContext(ctx context.Context) *PutNotebooksParams { - var () return &PutNotebooksParams{ - Context: ctx, } } // NewPutNotebooksParamsWithHTTPClient creates a new PutNotebooksParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutNotebooksParamsWithHTTPClient(client *http.Client) *PutNotebooksParams { - var () return &PutNotebooksParams{ HTTPClient: client, } } -/*PutNotebooksParams contains all the parameters to send to the API endpoint -for the put notebooks operation typically these are written to a http.Request +/* PutNotebooksParams contains all the parameters to send to the API endpoint + for the put notebooks operation. + + Typically these are written to a http.Request. */ type PutNotebooksParams struct { - /*NotebookRequest - An array of Notebook records + /* NotebookRequest. + An array of Notebook records */ NotebookRequest *sf_gate_models.NotebookRequest @@ -77,6 +76,21 @@ type PutNotebooksParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutNotebooksParams) WithDefaults() *PutNotebooksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put notebooks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutNotebooksParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put notebooks params func (o *PutNotebooksParams) WithTimeout(timeout time.Duration) *PutNotebooksParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutNotebooksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.NotebookRequest != nil { if err := r.SetBodyParam(o.NotebookRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/notebooks/put_notebooks_responses.go b/api/sf-gate/sf_gate_client/notebooks/put_notebooks_responses.go index 7aa3593..0c2fa1e 100644 --- a/api/sf-gate/sf_gate_client/notebooks/put_notebooks_responses.go +++ b/api/sf-gate/sf_gate_client/notebooks/put_notebooks_responses.go @@ -63,9 +63,8 @@ func (o *PutNotebooksReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutNotebooksOK() *PutNotebooksOK { return &PutNotebooksOK{} } -/*PutNotebooksOK handles this case with default header values. +/* PutNotebooksOK describes a response with status code 200, with default header values. Taxnexus Response with Notebook objects */ @@ -85,7 +84,6 @@ type PutNotebooksOK struct { func (o *PutNotebooksOK) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksOK %+v", 200, o.Payload) } - func (o *PutNotebooksOK) GetPayload() *sf_gate_models.NotebookResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPutNotebooksUnauthorized() *PutNotebooksUnauthorized { return &PutNotebooksUnauthorized{} } -/*PutNotebooksUnauthorized handles this case with default header values. +/* PutNotebooksUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PutNotebooksUnauthorized struct { func (o *PutNotebooksUnauthorized) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksUnauthorized %+v", 401, o.Payload) } - func (o *PutNotebooksUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPutNotebooksForbidden() *PutNotebooksForbidden { return &PutNotebooksForbidden{} } -/*PutNotebooksForbidden handles this case with default header values. +/* PutNotebooksForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PutNotebooksForbidden struct { func (o *PutNotebooksForbidden) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksForbidden %+v", 403, o.Payload) } - func (o *PutNotebooksForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPutNotebooksNotFound() *PutNotebooksNotFound { return &PutNotebooksNotFound{} } -/*PutNotebooksNotFound handles this case with default header values. +/* PutNotebooksNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PutNotebooksNotFound struct { func (o *PutNotebooksNotFound) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksNotFound %+v", 404, o.Payload) } - func (o *PutNotebooksNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPutNotebooksUnprocessableEntity() *PutNotebooksUnprocessableEntity { return &PutNotebooksUnprocessableEntity{} } -/*PutNotebooksUnprocessableEntity handles this case with default header values. +/* PutNotebooksUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PutNotebooksUnprocessableEntity struct { func (o *PutNotebooksUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutNotebooksUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPutNotebooksInternalServerError() *PutNotebooksInternalServerError { return &PutNotebooksInternalServerError{} } -/*PutNotebooksInternalServerError handles this case with default header values. +/* PutNotebooksInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PutNotebooksInternalServerError struct { func (o *PutNotebooksInternalServerError) Error() string { return fmt.Sprintf("[PUT /notebooks][%d] putNotebooksInternalServerError %+v", 500, o.Payload) } - func (o *PutNotebooksInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/orders/get_orders_parameters.go b/api/sf-gate/sf_gate_client/orders/get_orders_parameters.go index fb8afac..8a72fd2 100644 --- a/api/sf-gate/sf_gate_client/orders/get_orders_parameters.go +++ b/api/sf-gate/sf_gate_client/orders/get_orders_parameters.go @@ -21,83 +21,92 @@ import ( "github.com/go-openapi/swag" ) -// NewGetOrdersParams creates a new GetOrdersParams object -// with the default values initialized. +// NewGetOrdersParams creates a new GetOrdersParams 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 NewGetOrdersParams() *GetOrdersParams { - var () return &GetOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewGetOrdersParamsWithTimeout creates a new GetOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetOrdersParamsWithTimeout(timeout time.Duration) *GetOrdersParams { - var () return &GetOrdersParams{ - timeout: timeout, } } // NewGetOrdersParamsWithContext creates a new GetOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetOrdersParamsWithContext(ctx context.Context) *GetOrdersParams { - var () return &GetOrdersParams{ - Context: ctx, } } // NewGetOrdersParamsWithHTTPClient creates a new GetOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetOrdersParamsWithHTTPClient(client *http.Client) *GetOrdersParams { - var () return &GetOrdersParams{ HTTPClient: client, } } -/*GetOrdersParams contains all the parameters to send to the API endpoint -for the get orders operation typically these are written to a http.Request +/* GetOrdersParams contains all the parameters to send to the API endpoint + for the get orders operation. + + Typically these are written to a http.Request. */ type GetOrdersParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*AccountNumber - The Taxnexus Account Number of the Account to be used a record retrieval + /* AccountNumber. + + The Taxnexus Account Number of the Account to be used a record retrieval */ AccountNumber *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*OrderID - Taxnexus Id of the Company to be retrieved + /* OrderID. + + Taxnexus Id of the Company to be retrieved */ OrderID *string @@ -106,6 +115,21 @@ type GetOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOrdersParams) WithDefaults() *GetOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get orders params func (o *GetOrdersParams) WithTimeout(timeout time.Duration) *GetOrdersParams { o.SetTimeout(timeout) @@ -228,112 +252,119 @@ func (o *GetOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // 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.AccountNumber != nil { // query param accountNumber var qrAccountNumber string + if o.AccountNumber != nil { qrAccountNumber = *o.AccountNumber } qAccountNumber := qrAccountNumber if qAccountNumber != "" { + if err := r.SetQueryParam("accountNumber", qAccountNumber); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.OrderID != nil { // query param orderId var qrOrderID string + if o.OrderID != nil { qrOrderID = *o.OrderID } qOrderID := qrOrderID if qOrderID != "" { + if err := r.SetQueryParam("orderId", qOrderID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/orders/get_orders_responses.go b/api/sf-gate/sf_gate_client/orders/get_orders_responses.go index ae25f0e..8c9e745 100644 --- a/api/sf-gate/sf_gate_client/orders/get_orders_responses.go +++ b/api/sf-gate/sf_gate_client/orders/get_orders_responses.go @@ -63,9 +63,8 @@ func (o *GetOrdersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetOrdersOK() *GetOrdersOK { return &GetOrdersOK{} } -/*GetOrdersOK handles this case with default header values. +/* GetOrdersOK describes a response with status code 200, with default header values. An array of Order objects */ @@ -85,7 +84,6 @@ type GetOrdersOK struct { func (o *GetOrdersOK) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersOK %+v", 200, o.Payload) } - func (o *GetOrdersOK) GetPayload() *sf_gate_models.OrderResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetOrdersUnauthorized() *GetOrdersUnauthorized { return &GetOrdersUnauthorized{} } -/*GetOrdersUnauthorized handles this case with default header values. +/* GetOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetOrdersUnauthorized struct { func (o *GetOrdersUnauthorized) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersUnauthorized %+v", 401, o.Payload) } - func (o *GetOrdersUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetOrdersForbidden() *GetOrdersForbidden { return &GetOrdersForbidden{} } -/*GetOrdersForbidden handles this case with default header values. +/* GetOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetOrdersForbidden struct { func (o *GetOrdersForbidden) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersForbidden %+v", 403, o.Payload) } - func (o *GetOrdersForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetOrdersNotFound() *GetOrdersNotFound { return &GetOrdersNotFound{} } -/*GetOrdersNotFound handles this case with default header values. +/* GetOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetOrdersNotFound struct { func (o *GetOrdersNotFound) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersNotFound %+v", 404, o.Payload) } - func (o *GetOrdersNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetOrdersUnprocessableEntity() *GetOrdersUnprocessableEntity { return &GetOrdersUnprocessableEntity{} } -/*GetOrdersUnprocessableEntity handles this case with default header values. +/* GetOrdersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetOrdersUnprocessableEntity struct { func (o *GetOrdersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetOrdersUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetOrdersInternalServerError() *GetOrdersInternalServerError { return &GetOrdersInternalServerError{} } -/*GetOrdersInternalServerError handles this case with default header values. +/* GetOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetOrdersInternalServerError struct { func (o *GetOrdersInternalServerError) Error() string { return fmt.Sprintf("[GET /orders][%d] getOrdersInternalServerError %+v", 500, o.Payload) } - func (o *GetOrdersInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/orders/orders_client.go b/api/sf-gate/sf_gate_client/orders/orders_client.go index f056315..fabfe2a 100644 --- a/api/sf-gate/sf_gate_client/orders/orders_client.go +++ b/api/sf-gate/sf_gate_client/orders/orders_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*GetOrdersOK, error) + GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrdersOK, error) - PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostOrdersOK, error) + PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOrdersOK, error) - PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PutOrdersOK, error) + PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutOrdersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Orders */ -func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*GetOrdersOK, error) { +func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getOrders", Method: "GET", PathPattern: "/orders", @@ -63,7 +65,12 @@ func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthI 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 } @@ -82,13 +89,12 @@ func (a *Client) GetOrders(params *GetOrdersParams, authInfo runtime.ClientAuthI Create new Orders */ -func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PostOrdersOK, error) { +func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postOrders", Method: "POST", PathPattern: "/orders", @@ -100,7 +106,12 @@ func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAut 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 } @@ -119,13 +130,12 @@ func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAut Create new Orders */ -func (a *Client) PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PutOrdersOK, error) { +func (a *Client) PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutOrdersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutOrdersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putOrders", Method: "PUT", PathPattern: "/orders", @@ -137,7 +147,12 @@ func (a *Client) PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/sf-gate/sf_gate_client/orders/post_orders_parameters.go b/api/sf-gate/sf_gate_client/orders/post_orders_parameters.go index a778ad1..3bb9779 100644 --- a/api/sf-gate/sf_gate_client/orders/post_orders_parameters.go +++ b/api/sf-gate/sf_gate_client/orders/post_orders_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostOrdersParams creates a new PostOrdersParams object -// with the default values initialized. +// NewPostOrdersParams creates a new PostOrdersParams 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 NewPostOrdersParams() *PostOrdersParams { - var () return &PostOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewPostOrdersParamsWithTimeout creates a new PostOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostOrdersParamsWithTimeout(timeout time.Duration) *PostOrdersParams { - var () return &PostOrdersParams{ - timeout: timeout, } } // NewPostOrdersParamsWithContext creates a new PostOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostOrdersParamsWithContext(ctx context.Context) *PostOrdersParams { - var () return &PostOrdersParams{ - Context: ctx, } } // NewPostOrdersParamsWithHTTPClient creates a new PostOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostOrdersParamsWithHTTPClient(client *http.Client) *PostOrdersParams { - var () return &PostOrdersParams{ HTTPClient: client, } } -/*PostOrdersParams contains all the parameters to send to the API endpoint -for the post orders operation typically these are written to a http.Request +/* PostOrdersParams contains all the parameters to send to the API endpoint + for the post orders operation. + + Typically these are written to a http.Request. */ type PostOrdersParams struct { - /*Order*/ + // Order. Order *sf_gate_models.OrderBasicRequest timeout time.Duration @@ -74,6 +73,21 @@ type PostOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostOrdersParams) WithDefaults() *PostOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post orders params func (o *PostOrdersParams) WithTimeout(timeout time.Duration) *PostOrdersParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.Order != nil { if err := r.SetBodyParam(o.Order); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/orders/post_orders_responses.go b/api/sf-gate/sf_gate_client/orders/post_orders_responses.go index f224730..ada6344 100644 --- a/api/sf-gate/sf_gate_client/orders/post_orders_responses.go +++ b/api/sf-gate/sf_gate_client/orders/post_orders_responses.go @@ -57,9 +57,8 @@ func (o *PostOrdersReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostOrdersOK() *PostOrdersOK { return &PostOrdersOK{} } -/*PostOrdersOK handles this case with default header values. +/* PostOrdersOK describes a response with status code 200, with default header values. An array of Order objects */ @@ -79,7 +78,6 @@ type PostOrdersOK struct { func (o *PostOrdersOK) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersOK %+v", 200, o.Payload) } - func (o *PostOrdersOK) GetPayload() *sf_gate_models.OrderResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostOrdersUnauthorized() *PostOrdersUnauthorized { return &PostOrdersUnauthorized{} } -/*PostOrdersUnauthorized handles this case with default header values. +/* PostOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostOrdersUnauthorized struct { func (o *PostOrdersUnauthorized) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersUnauthorized %+v", 401, o.Payload) } - func (o *PostOrdersUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostOrdersForbidden() *PostOrdersForbidden { return &PostOrdersForbidden{} } -/*PostOrdersForbidden handles this case with default header values. +/* PostOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostOrdersForbidden struct { func (o *PostOrdersForbidden) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersForbidden %+v", 403, o.Payload) } - func (o *PostOrdersForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostOrdersNotFound() *PostOrdersNotFound { return &PostOrdersNotFound{} } -/*PostOrdersNotFound handles this case with default header values. +/* PostOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostOrdersNotFound struct { func (o *PostOrdersNotFound) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersNotFound %+v", 404, o.Payload) } - func (o *PostOrdersNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostOrdersInternalServerError() *PostOrdersInternalServerError { return &PostOrdersInternalServerError{} } -/*PostOrdersInternalServerError handles this case with default header values. +/* PostOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostOrdersInternalServerError struct { func (o *PostOrdersInternalServerError) Error() string { return fmt.Sprintf("[POST /orders][%d] postOrdersInternalServerError %+v", 500, o.Payload) } - func (o *PostOrdersInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/orders/put_orders_parameters.go b/api/sf-gate/sf_gate_client/orders/put_orders_parameters.go index abc1ccd..87f346a 100644 --- a/api/sf-gate/sf_gate_client/orders/put_orders_parameters.go +++ b/api/sf-gate/sf_gate_client/orders/put_orders_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutOrdersParams creates a new PutOrdersParams object -// with the default values initialized. +// NewPutOrdersParams creates a new PutOrdersParams 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 NewPutOrdersParams() *PutOrdersParams { - var () return &PutOrdersParams{ - timeout: cr.DefaultTimeout, } } // NewPutOrdersParamsWithTimeout creates a new PutOrdersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutOrdersParamsWithTimeout(timeout time.Duration) *PutOrdersParams { - var () return &PutOrdersParams{ - timeout: timeout, } } // NewPutOrdersParamsWithContext creates a new PutOrdersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutOrdersParamsWithContext(ctx context.Context) *PutOrdersParams { - var () return &PutOrdersParams{ - Context: ctx, } } // NewPutOrdersParamsWithHTTPClient creates a new PutOrdersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutOrdersParamsWithHTTPClient(client *http.Client) *PutOrdersParams { - var () return &PutOrdersParams{ HTTPClient: client, } } -/*PutOrdersParams contains all the parameters to send to the API endpoint -for the put orders operation typically these are written to a http.Request +/* PutOrdersParams contains all the parameters to send to the API endpoint + for the put orders operation. + + Typically these are written to a http.Request. */ type PutOrdersParams struct { - /*Order*/ + // Order. Order *sf_gate_models.Order timeout time.Duration @@ -74,6 +73,21 @@ type PutOrdersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutOrdersParams) WithDefaults() *PutOrdersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put orders params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutOrdersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put orders params func (o *PutOrdersParams) WithTimeout(timeout time.Duration) *PutOrdersParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PutOrdersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.Order != nil { if err := r.SetBodyParam(o.Order); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/orders/put_orders_responses.go b/api/sf-gate/sf_gate_client/orders/put_orders_responses.go index ef61967..161ba9a 100644 --- a/api/sf-gate/sf_gate_client/orders/put_orders_responses.go +++ b/api/sf-gate/sf_gate_client/orders/put_orders_responses.go @@ -57,9 +57,8 @@ func (o *PutOrdersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutOrdersOK() *PutOrdersOK { return &PutOrdersOK{} } -/*PutOrdersOK handles this case with default header values. +/* PutOrdersOK describes a response with status code 200, with default header values. An array of Order objects */ @@ -79,7 +78,6 @@ type PutOrdersOK struct { func (o *PutOrdersOK) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersOK %+v", 200, o.Payload) } - func (o *PutOrdersOK) GetPayload() *sf_gate_models.OrderResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutOrdersUnauthorized() *PutOrdersUnauthorized { return &PutOrdersUnauthorized{} } -/*PutOrdersUnauthorized handles this case with default header values. +/* PutOrdersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutOrdersUnauthorized struct { func (o *PutOrdersUnauthorized) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersUnauthorized %+v", 401, o.Payload) } - func (o *PutOrdersUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutOrdersForbidden() *PutOrdersForbidden { return &PutOrdersForbidden{} } -/*PutOrdersForbidden handles this case with default header values. +/* PutOrdersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutOrdersForbidden struct { func (o *PutOrdersForbidden) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersForbidden %+v", 403, o.Payload) } - func (o *PutOrdersForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutOrdersNotFound() *PutOrdersNotFound { return &PutOrdersNotFound{} } -/*PutOrdersNotFound handles this case with default header values. +/* PutOrdersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutOrdersNotFound struct { func (o *PutOrdersNotFound) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersNotFound %+v", 404, o.Payload) } - func (o *PutOrdersNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutOrdersInternalServerError() *PutOrdersInternalServerError { return &PutOrdersInternalServerError{} } -/*PutOrdersInternalServerError handles this case with default header values. +/* PutOrdersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutOrdersInternalServerError struct { func (o *PutOrdersInternalServerError) Error() string { return fmt.Sprintf("[PUT /orders][%d] putOrdersInternalServerError %+v", 500, o.Payload) } - func (o *PutOrdersInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/periods/get_periods_parameters.go b/api/sf-gate/sf_gate_client/periods/get_periods_parameters.go index 0c3b084..d6f204f 100644 --- a/api/sf-gate/sf_gate_client/periods/get_periods_parameters.go +++ b/api/sf-gate/sf_gate_client/periods/get_periods_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPeriodsParams creates a new GetPeriodsParams object -// with the default values initialized. +// NewGetPeriodsParams creates a new GetPeriodsParams 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 NewGetPeriodsParams() *GetPeriodsParams { - var () return &GetPeriodsParams{ - timeout: cr.DefaultTimeout, } } // NewGetPeriodsParamsWithTimeout creates a new GetPeriodsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPeriodsParamsWithTimeout(timeout time.Duration) *GetPeriodsParams { - var () return &GetPeriodsParams{ - timeout: timeout, } } // NewGetPeriodsParamsWithContext creates a new GetPeriodsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPeriodsParamsWithContext(ctx context.Context) *GetPeriodsParams { - var () return &GetPeriodsParams{ - Context: ctx, } } // NewGetPeriodsParamsWithHTTPClient creates a new GetPeriodsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPeriodsParamsWithHTTPClient(client *http.Client) *GetPeriodsParams { - var () return &GetPeriodsParams{ HTTPClient: client, } } -/*GetPeriodsParams contains all the parameters to send to the API endpoint -for the get periods operation typically these are written to a http.Request +/* GetPeriodsParams contains all the parameters to send to the API endpoint + for the get periods operation. + + Typically these are written to a http.Request. */ type GetPeriodsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*PeriodID - Taxnexus Id of the Period to be used a record retrieval + /* PeriodID. + + Taxnexus Id of the Period to be used a record retrieval */ PeriodID *string @@ -91,6 +97,21 @@ type GetPeriodsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get periods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPeriodsParams) WithDefaults() *GetPeriodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get periods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPeriodsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get periods params func (o *GetPeriodsParams) WithTimeout(timeout time.Duration) *GetPeriodsParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetPeriodsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // 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.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 o.PeriodID != nil { // query param periodId var qrPeriodID string + if o.PeriodID != nil { qrPeriodID = *o.PeriodID } qPeriodID := qrPeriodID if qPeriodID != "" { + if err := r.SetQueryParam("periodId", qPeriodID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/periods/get_periods_responses.go b/api/sf-gate/sf_gate_client/periods/get_periods_responses.go index 7f24b15..af88245 100644 --- a/api/sf-gate/sf_gate_client/periods/get_periods_responses.go +++ b/api/sf-gate/sf_gate_client/periods/get_periods_responses.go @@ -63,9 +63,8 @@ func (o *GetPeriodsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetPeriodsOK() *GetPeriodsOK { return &GetPeriodsOK{} } -/*GetPeriodsOK handles this case with default header values. +/* GetPeriodsOK describes a response with status code 200, with default header values. Taxnexus Response with Period objects */ @@ -85,7 +84,6 @@ type GetPeriodsOK struct { func (o *GetPeriodsOK) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsOK %+v", 200, o.Payload) } - func (o *GetPeriodsOK) GetPayload() *sf_gate_models.PeriodResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetPeriodsUnauthorized() *GetPeriodsUnauthorized { return &GetPeriodsUnauthorized{} } -/*GetPeriodsUnauthorized handles this case with default header values. +/* GetPeriodsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetPeriodsUnauthorized struct { func (o *GetPeriodsUnauthorized) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsUnauthorized %+v", 401, o.Payload) } - func (o *GetPeriodsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetPeriodsForbidden() *GetPeriodsForbidden { return &GetPeriodsForbidden{} } -/*GetPeriodsForbidden handles this case with default header values. +/* GetPeriodsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetPeriodsForbidden struct { func (o *GetPeriodsForbidden) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsForbidden %+v", 403, o.Payload) } - func (o *GetPeriodsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetPeriodsNotFound() *GetPeriodsNotFound { return &GetPeriodsNotFound{} } -/*GetPeriodsNotFound handles this case with default header values. +/* GetPeriodsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetPeriodsNotFound struct { func (o *GetPeriodsNotFound) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsNotFound %+v", 404, o.Payload) } - func (o *GetPeriodsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetPeriodsUnprocessableEntity() *GetPeriodsUnprocessableEntity { return &GetPeriodsUnprocessableEntity{} } -/*GetPeriodsUnprocessableEntity handles this case with default header values. +/* GetPeriodsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetPeriodsUnprocessableEntity struct { func (o *GetPeriodsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPeriodsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetPeriodsInternalServerError() *GetPeriodsInternalServerError { return &GetPeriodsInternalServerError{} } -/*GetPeriodsInternalServerError handles this case with default header values. +/* GetPeriodsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetPeriodsInternalServerError struct { func (o *GetPeriodsInternalServerError) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsInternalServerError %+v", 500, o.Payload) } - func (o *GetPeriodsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/periods/periods_client.go b/api/sf-gate/sf_gate_client/periods/periods_client.go index 0dd5869..618b0c8 100644 --- a/api/sf-gate/sf_gate_client/periods/periods_client.go +++ b/api/sf-gate/sf_gate_client/periods/periods_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPeriodsOK, error) + GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPeriodsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of Periods for an Account */ -func (a *Client) GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPeriodsOK, error) { +func (a *Client) GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPeriodsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPeriodsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPeriods", Method: "GET", PathPattern: "/periods", @@ -59,7 +61,12 @@ func (a *Client) GetPeriods(params *GetPeriodsParams, authInfo runtime.ClientAut 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 } diff --git a/api/sf-gate/sf_gate_client/places/get_places_parameters.go b/api/sf-gate/sf_gate_client/places/get_places_parameters.go index 58644c3..a6a7783 100644 --- a/api/sf-gate/sf_gate_client/places/get_places_parameters.go +++ b/api/sf-gate/sf_gate_client/places/get_places_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPlacesParams creates a new GetPlacesParams object -// with the default values initialized. +// NewGetPlacesParams creates a new GetPlacesParams 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 NewGetPlacesParams() *GetPlacesParams { - var () return &GetPlacesParams{ - timeout: cr.DefaultTimeout, } } // NewGetPlacesParamsWithTimeout creates a new GetPlacesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPlacesParamsWithTimeout(timeout time.Duration) *GetPlacesParams { - var () return &GetPlacesParams{ - timeout: timeout, } } // NewGetPlacesParamsWithContext creates a new GetPlacesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPlacesParamsWithContext(ctx context.Context) *GetPlacesParams { - var () return &GetPlacesParams{ - Context: ctx, } } // NewGetPlacesParamsWithHTTPClient creates a new GetPlacesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPlacesParamsWithHTTPClient(client *http.Client) *GetPlacesParams { - var () return &GetPlacesParams{ HTTPClient: client, } } -/*GetPlacesParams contains all the parameters to send to the API endpoint -for the get places operation typically these are written to a http.Request +/* GetPlacesParams contains all the parameters to send to the API endpoint + for the get places operation. + + Typically these are written to a http.Request. */ type GetPlacesParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*PlaceID - The City name (must be accompanied by State) + /* PlaceID. + + The City name (must be accompanied by State) */ PlaceID *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string @@ -91,6 +97,21 @@ type GetPlacesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get places params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesParams) WithDefaults() *GetPlacesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get places params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPlacesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get places params func (o *GetPlacesParams) WithTimeout(timeout time.Duration) *GetPlacesParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetPlacesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // 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 o.PlaceID != nil { // query param placeId var qrPlaceID string + if o.PlaceID != nil { qrPlaceID = *o.PlaceID } qPlaceID := qrPlaceID if qPlaceID != "" { + if err := r.SetQueryParam("placeId", qPlaceID); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/places/get_places_responses.go b/api/sf-gate/sf_gate_client/places/get_places_responses.go index 1547992..39c13f3 100644 --- a/api/sf-gate/sf_gate_client/places/get_places_responses.go +++ b/api/sf-gate/sf_gate_client/places/get_places_responses.go @@ -63,9 +63,8 @@ func (o *GetPlacesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetPlacesOK() *GetPlacesOK { return &GetPlacesOK{} } -/*GetPlacesOK handles this case with default header values. +/* GetPlacesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Place objects */ @@ -85,7 +84,6 @@ type GetPlacesOK struct { func (o *GetPlacesOK) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesOK %+v", 200, o.Payload) } - func (o *GetPlacesOK) GetPayload() *sf_gate_models.PlaceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetPlacesUnauthorized() *GetPlacesUnauthorized { return &GetPlacesUnauthorized{} } -/*GetPlacesUnauthorized handles this case with default header values. +/* GetPlacesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetPlacesUnauthorized struct { func (o *GetPlacesUnauthorized) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesUnauthorized %+v", 401, o.Payload) } - func (o *GetPlacesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetPlacesForbidden() *GetPlacesForbidden { return &GetPlacesForbidden{} } -/*GetPlacesForbidden handles this case with default header values. +/* GetPlacesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetPlacesForbidden struct { func (o *GetPlacesForbidden) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesForbidden %+v", 403, o.Payload) } - func (o *GetPlacesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetPlacesNotFound() *GetPlacesNotFound { return &GetPlacesNotFound{} } -/*GetPlacesNotFound handles this case with default header values. +/* GetPlacesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetPlacesNotFound struct { func (o *GetPlacesNotFound) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesNotFound %+v", 404, o.Payload) } - func (o *GetPlacesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetPlacesUnprocessableEntity() *GetPlacesUnprocessableEntity { return &GetPlacesUnprocessableEntity{} } -/*GetPlacesUnprocessableEntity handles this case with default header values. +/* GetPlacesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetPlacesUnprocessableEntity struct { func (o *GetPlacesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPlacesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetPlacesInternalServerError() *GetPlacesInternalServerError { return &GetPlacesInternalServerError{} } -/*GetPlacesInternalServerError handles this case with default header values. +/* GetPlacesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetPlacesInternalServerError struct { func (o *GetPlacesInternalServerError) Error() string { return fmt.Sprintf("[GET /places][%d] getPlacesInternalServerError %+v", 500, o.Payload) } - func (o *GetPlacesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/places/places_client.go b/api/sf-gate/sf_gate_client/places/places_client.go index 270c1fd..f15cc28 100644 --- a/api/sf-gate/sf_gate_client/places/places_client.go +++ b/api/sf-gate/sf_gate_client/places/places_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlacesOK, error) + GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlacesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Retrieve Places, filter with parameters */ -func (a *Client) GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlacesOK, error) { +func (a *Client) GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPlacesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPlacesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPlaces", Method: "GET", PathPattern: "/places", @@ -59,7 +61,12 @@ func (a *Client) GetPlaces(params *GetPlacesParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/sf-gate/sf_gate_client/products/get_products_parameters.go b/api/sf-gate/sf_gate_client/products/get_products_parameters.go index ca40b6f..8a22642 100644 --- a/api/sf-gate/sf_gate_client/products/get_products_parameters.go +++ b/api/sf-gate/sf_gate_client/products/get_products_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetProductsParams creates a new GetProductsParams object -// with the default values initialized. +// NewGetProductsParams creates a new GetProductsParams 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 NewGetProductsParams() *GetProductsParams { - var () return &GetProductsParams{ - timeout: cr.DefaultTimeout, } } // NewGetProductsParamsWithTimeout creates a new GetProductsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetProductsParamsWithTimeout(timeout time.Duration) *GetProductsParams { - var () return &GetProductsParams{ - timeout: timeout, } } // NewGetProductsParamsWithContext creates a new GetProductsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetProductsParamsWithContext(ctx context.Context) *GetProductsParams { - var () return &GetProductsParams{ - Context: ctx, } } // NewGetProductsParamsWithHTTPClient creates a new GetProductsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetProductsParamsWithHTTPClient(client *http.Client) *GetProductsParams { - var () return &GetProductsParams{ HTTPClient: client, } } -/*GetProductsParams contains all the parameters to send to the API endpoint -for the get products operation typically these are written to a http.Request +/* GetProductsParams contains all the parameters to send to the API endpoint + for the get products operation. + + Typically these are written to a http.Request. */ type GetProductsParams struct { - /*Active - Retrieve only active records? + /* Active. + Retrieve only active records? */ Active *bool - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*ProductID - Taxnexus Id of the Account to be used a record retrieval + /* ProductID. + + Taxnexus Id of the Account to be used a record retrieval */ ProductID *string @@ -91,6 +97,21 @@ type GetProductsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsParams) WithDefaults() *GetProductsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get products params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetProductsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get products params func (o *GetProductsParams) WithTimeout(timeout time.Duration) *GetProductsParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetProductsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.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 o.ProductID != nil { // query param productId var qrProductID string + if o.ProductID != nil { qrProductID = *o.ProductID } qProductID := qrProductID if qProductID != "" { + if err := r.SetQueryParam("productId", qProductID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/products/get_products_responses.go b/api/sf-gate/sf_gate_client/products/get_products_responses.go index eed44c5..09c9cab 100644 --- a/api/sf-gate/sf_gate_client/products/get_products_responses.go +++ b/api/sf-gate/sf_gate_client/products/get_products_responses.go @@ -63,9 +63,8 @@ func (o *GetProductsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetProductsOK() *GetProductsOK { return &GetProductsOK{} } -/*GetProductsOK handles this case with default header values. +/* GetProductsOK describes a response with status code 200, with default header values. An array of Product objects */ @@ -85,7 +84,6 @@ type GetProductsOK struct { func (o *GetProductsOK) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsOK %+v", 200, o.Payload) } - func (o *GetProductsOK) GetPayload() *sf_gate_models.ProductResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetProductsUnauthorized() *GetProductsUnauthorized { return &GetProductsUnauthorized{} } -/*GetProductsUnauthorized handles this case with default header values. +/* GetProductsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetProductsUnauthorized struct { func (o *GetProductsUnauthorized) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsUnauthorized %+v", 401, o.Payload) } - func (o *GetProductsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetProductsForbidden() *GetProductsForbidden { return &GetProductsForbidden{} } -/*GetProductsForbidden handles this case with default header values. +/* GetProductsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetProductsForbidden struct { func (o *GetProductsForbidden) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsForbidden %+v", 403, o.Payload) } - func (o *GetProductsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetProductsNotFound() *GetProductsNotFound { return &GetProductsNotFound{} } -/*GetProductsNotFound handles this case with default header values. +/* GetProductsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetProductsNotFound struct { func (o *GetProductsNotFound) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsNotFound %+v", 404, o.Payload) } - func (o *GetProductsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetProductsUnprocessableEntity() *GetProductsUnprocessableEntity { return &GetProductsUnprocessableEntity{} } -/*GetProductsUnprocessableEntity handles this case with default header values. +/* GetProductsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetProductsUnprocessableEntity struct { func (o *GetProductsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetProductsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetProductsInternalServerError() *GetProductsInternalServerError { return &GetProductsInternalServerError{} } -/*GetProductsInternalServerError handles this case with default header values. +/* GetProductsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetProductsInternalServerError struct { func (o *GetProductsInternalServerError) Error() string { return fmt.Sprintf("[GET /products][%d] getProductsInternalServerError %+v", 500, o.Payload) } - func (o *GetProductsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/products/products_client.go b/api/sf-gate/sf_gate_client/products/products_client.go index 06d25ed..6617ff8 100644 --- a/api/sf-gate/sf_gate_client/products/products_client.go +++ b/api/sf-gate/sf_gate_client/products/products_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error) + GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of all available Products */ -func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error) { +func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProductsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetProductsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getProducts", Method: "GET", PathPattern: "/products", @@ -59,7 +61,12 @@ func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/purchase_orders/get_pos_parameters.go b/api/sf-gate/sf_gate_client/purchase_orders/get_pos_parameters.go index 8bee489..59c1ce7 100644 --- a/api/sf-gate/sf_gate_client/purchase_orders/get_pos_parameters.go +++ b/api/sf-gate/sf_gate_client/purchase_orders/get_pos_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPosParams creates a new GetPosParams object -// with the default values initialized. +// NewGetPosParams creates a new GetPosParams 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 NewGetPosParams() *GetPosParams { - var () return &GetPosParams{ - timeout: cr.DefaultTimeout, } } // NewGetPosParamsWithTimeout creates a new GetPosParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPosParamsWithTimeout(timeout time.Duration) *GetPosParams { - var () return &GetPosParams{ - timeout: timeout, } } // NewGetPosParamsWithContext creates a new GetPosParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPosParamsWithContext(ctx context.Context) *GetPosParams { - var () return &GetPosParams{ - Context: ctx, } } // NewGetPosParamsWithHTTPClient creates a new GetPosParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPosParamsWithHTTPClient(client *http.Client) *GetPosParams { - var () return &GetPosParams{ HTTPClient: client, } } -/*GetPosParams contains all the parameters to send to the API endpoint -for the get pos operation typically these are written to a http.Request +/* GetPosParams contains all the parameters to send to the API endpoint + for the get pos operation. + + Typically these are written to a http.Request. */ type GetPosParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*PoID - Taxnexus Id of the Purchase Order to be retrieved + /* PoID. + + Taxnexus Id of the Purchase Order to be retrieved */ PoID *string @@ -101,6 +109,21 @@ type GetPosParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPosParams) WithDefaults() *GetPosParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPosParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get pos params func (o *GetPosParams) WithTimeout(timeout time.Duration) *GetPosParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetPosParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.PoID != nil { // query param poId var qrPoID string + if o.PoID != nil { qrPoID = *o.PoID } qPoID := qrPoID if qPoID != "" { + if err := r.SetQueryParam("poId", qPoID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/purchase_orders/get_pos_responses.go b/api/sf-gate/sf_gate_client/purchase_orders/get_pos_responses.go index 511c227..6c5b495 100644 --- a/api/sf-gate/sf_gate_client/purchase_orders/get_pos_responses.go +++ b/api/sf-gate/sf_gate_client/purchase_orders/get_pos_responses.go @@ -63,9 +63,8 @@ func (o *GetPosReader) ReadResponse(response runtime.ClientResponse, consumer ru return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetPosOK() *GetPosOK { return &GetPosOK{} } -/*GetPosOK handles this case with default header values. +/* GetPosOK describes a response with status code 200, with default header values. An array of Purchase Order objects */ @@ -85,7 +84,6 @@ type GetPosOK struct { func (o *GetPosOK) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosOK %+v", 200, o.Payload) } - func (o *GetPosOK) GetPayload() *sf_gate_models.PurchaseOrderResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetPosUnauthorized() *GetPosUnauthorized { return &GetPosUnauthorized{} } -/*GetPosUnauthorized handles this case with default header values. +/* GetPosUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetPosUnauthorized struct { func (o *GetPosUnauthorized) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosUnauthorized %+v", 401, o.Payload) } - func (o *GetPosUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetPosForbidden() *GetPosForbidden { return &GetPosForbidden{} } -/*GetPosForbidden handles this case with default header values. +/* GetPosForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetPosForbidden struct { func (o *GetPosForbidden) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosForbidden %+v", 403, o.Payload) } - func (o *GetPosForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetPosNotFound() *GetPosNotFound { return &GetPosNotFound{} } -/*GetPosNotFound handles this case with default header values. +/* GetPosNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetPosNotFound struct { func (o *GetPosNotFound) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosNotFound %+v", 404, o.Payload) } - func (o *GetPosNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetPosUnprocessableEntity() *GetPosUnprocessableEntity { return &GetPosUnprocessableEntity{} } -/*GetPosUnprocessableEntity handles this case with default header values. +/* GetPosUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetPosUnprocessableEntity struct { func (o *GetPosUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPosUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetPosInternalServerError() *GetPosInternalServerError { return &GetPosInternalServerError{} } -/*GetPosInternalServerError handles this case with default header values. +/* GetPosInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetPosInternalServerError struct { func (o *GetPosInternalServerError) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosInternalServerError %+v", 500, o.Payload) } - func (o *GetPosInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/purchase_orders/post_pos_parameters.go b/api/sf-gate/sf_gate_client/purchase_orders/post_pos_parameters.go index 90b1fe4..36154f0 100644 --- a/api/sf-gate/sf_gate_client/purchase_orders/post_pos_parameters.go +++ b/api/sf-gate/sf_gate_client/purchase_orders/post_pos_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostPosParams creates a new PostPosParams object -// with the default values initialized. +// NewPostPosParams creates a new PostPosParams 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 NewPostPosParams() *PostPosParams { - var () return &PostPosParams{ - timeout: cr.DefaultTimeout, } } // NewPostPosParamsWithTimeout creates a new PostPosParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPosParamsWithTimeout(timeout time.Duration) *PostPosParams { - var () return &PostPosParams{ - timeout: timeout, } } // NewPostPosParamsWithContext creates a new PostPosParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPosParamsWithContext(ctx context.Context) *PostPosParams { - var () return &PostPosParams{ - Context: ctx, } } // NewPostPosParamsWithHTTPClient creates a new PostPosParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPosParamsWithHTTPClient(client *http.Client) *PostPosParams { - var () return &PostPosParams{ HTTPClient: client, } } -/*PostPosParams contains all the parameters to send to the API endpoint -for the post pos operation typically these are written to a http.Request +/* PostPosParams contains all the parameters to send to the API endpoint + for the post pos operation. + + Typically these are written to a http.Request. */ type PostPosParams struct { - /*PurchaseOrderRequest*/ + // PurchaseOrderRequest. PurchaseOrderRequest *sf_gate_models.PurchaseOrderRequest timeout time.Duration @@ -74,6 +73,21 @@ type PostPosParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPosParams) WithDefaults() *PostPosParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPosParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post pos params func (o *PostPosParams) WithTimeout(timeout time.Duration) *PostPosParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostPosParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis return err } var res []error - if o.PurchaseOrderRequest != nil { if err := r.SetBodyParam(o.PurchaseOrderRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/purchase_orders/post_pos_responses.go b/api/sf-gate/sf_gate_client/purchase_orders/post_pos_responses.go index 32c1600..92282eb 100644 --- a/api/sf-gate/sf_gate_client/purchase_orders/post_pos_responses.go +++ b/api/sf-gate/sf_gate_client/purchase_orders/post_pos_responses.go @@ -57,9 +57,8 @@ func (o *PostPosReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostPosOK() *PostPosOK { return &PostPosOK{} } -/*PostPosOK handles this case with default header values. +/* PostPosOK describes a response with status code 200, with default header values. An array of Purchase Order objects */ @@ -79,7 +78,6 @@ type PostPosOK struct { func (o *PostPosOK) Error() string { return fmt.Sprintf("[POST /pos][%d] postPosOK %+v", 200, o.Payload) } - func (o *PostPosOK) GetPayload() *sf_gate_models.PurchaseOrderResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostPosUnauthorized() *PostPosUnauthorized { return &PostPosUnauthorized{} } -/*PostPosUnauthorized handles this case with default header values. +/* PostPosUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostPosUnauthorized struct { func (o *PostPosUnauthorized) Error() string { return fmt.Sprintf("[POST /pos][%d] postPosUnauthorized %+v", 401, o.Payload) } - func (o *PostPosUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostPosForbidden() *PostPosForbidden { return &PostPosForbidden{} } -/*PostPosForbidden handles this case with default header values. +/* PostPosForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostPosForbidden struct { func (o *PostPosForbidden) Error() string { return fmt.Sprintf("[POST /pos][%d] postPosForbidden %+v", 403, o.Payload) } - func (o *PostPosForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostPosNotFound() *PostPosNotFound { return &PostPosNotFound{} } -/*PostPosNotFound handles this case with default header values. +/* PostPosNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostPosNotFound struct { func (o *PostPosNotFound) Error() string { return fmt.Sprintf("[POST /pos][%d] postPosNotFound %+v", 404, o.Payload) } - func (o *PostPosNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostPosInternalServerError() *PostPosInternalServerError { return &PostPosInternalServerError{} } -/*PostPosInternalServerError handles this case with default header values. +/* PostPosInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostPosInternalServerError struct { func (o *PostPosInternalServerError) Error() string { return fmt.Sprintf("[POST /pos][%d] postPosInternalServerError %+v", 500, o.Payload) } - func (o *PostPosInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/purchase_orders/purchase_orders_client.go b/api/sf-gate/sf_gate_client/purchase_orders/purchase_orders_client.go index f5dbca9..b7daa8a 100644 --- a/api/sf-gate/sf_gate_client/purchase_orders/purchase_orders_client.go +++ b/api/sf-gate/sf_gate_client/purchase_orders/purchase_orders_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter) (*GetPosOK, error) + GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPosOK, error) - PostPos(params *PostPosParams, authInfo runtime.ClientAuthInfoWriter) (*PostPosOK, error) + PostPos(params *PostPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPosOK, error) - PutPos(params *PutPosParams, authInfo runtime.ClientAuthInfoWriter) (*PutPosOK, error) + PutPos(params *PutPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPosOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Purchase Orders */ -func (a *Client) GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter) (*GetPosOK, error) { +func (a *Client) GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPosOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPosParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPos", Method: "GET", PathPattern: "/pos", @@ -63,7 +65,12 @@ func (a *Client) GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWri 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 } @@ -82,13 +89,12 @@ func (a *Client) GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWri Create New Purchase Order */ -func (a *Client) PostPos(params *PostPosParams, authInfo runtime.ClientAuthInfoWriter) (*PostPosOK, error) { +func (a *Client) PostPos(params *PostPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPosOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPosParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPos", Method: "POST", PathPattern: "/pos", @@ -100,7 +106,12 @@ func (a *Client) PostPos(params *PostPosParams, authInfo runtime.ClientAuthInfoW 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 } @@ -119,13 +130,12 @@ func (a *Client) PostPos(params *PostPosParams, authInfo runtime.ClientAuthInfoW Upsert a list of Purchase Order */ -func (a *Client) PutPos(params *PutPosParams, authInfo runtime.ClientAuthInfoWriter) (*PutPosOK, error) { +func (a *Client) PutPos(params *PutPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutPosOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutPosParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putPos", Method: "PUT", PathPattern: "/pos", @@ -137,7 +147,12 @@ func (a *Client) PutPos(params *PutPosParams, authInfo runtime.ClientAuthInfoWri 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 } diff --git a/api/sf-gate/sf_gate_client/purchase_orders/put_pos_parameters.go b/api/sf-gate/sf_gate_client/purchase_orders/put_pos_parameters.go index abd0635..5986b09 100644 --- a/api/sf-gate/sf_gate_client/purchase_orders/put_pos_parameters.go +++ b/api/sf-gate/sf_gate_client/purchase_orders/put_pos_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutPosParams creates a new PutPosParams object -// with the default values initialized. +// NewPutPosParams creates a new PutPosParams 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 NewPutPosParams() *PutPosParams { - var () return &PutPosParams{ - timeout: cr.DefaultTimeout, } } // NewPutPosParamsWithTimeout creates a new PutPosParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutPosParamsWithTimeout(timeout time.Duration) *PutPosParams { - var () return &PutPosParams{ - timeout: timeout, } } // NewPutPosParamsWithContext creates a new PutPosParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutPosParamsWithContext(ctx context.Context) *PutPosParams { - var () return &PutPosParams{ - Context: ctx, } } // NewPutPosParamsWithHTTPClient creates a new PutPosParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutPosParamsWithHTTPClient(client *http.Client) *PutPosParams { - var () return &PutPosParams{ HTTPClient: client, } } -/*PutPosParams contains all the parameters to send to the API endpoint -for the put pos operation typically these are written to a http.Request +/* PutPosParams contains all the parameters to send to the API endpoint + for the put pos operation. + + Typically these are written to a http.Request. */ type PutPosParams struct { - /*PurchaseOrderRequest*/ + // PurchaseOrderRequest. PurchaseOrderRequest *sf_gate_models.PurchaseOrderRequest timeout time.Duration @@ -74,6 +73,21 @@ type PutPosParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPosParams) WithDefaults() *PutPosParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutPosParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put pos params func (o *PutPosParams) WithTimeout(timeout time.Duration) *PutPosParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PutPosParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist return err } var res []error - if o.PurchaseOrderRequest != nil { if err := r.SetBodyParam(o.PurchaseOrderRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/purchase_orders/put_pos_responses.go b/api/sf-gate/sf_gate_client/purchase_orders/put_pos_responses.go index 4e18360..2d9804a 100644 --- a/api/sf-gate/sf_gate_client/purchase_orders/put_pos_responses.go +++ b/api/sf-gate/sf_gate_client/purchase_orders/put_pos_responses.go @@ -57,9 +57,8 @@ func (o *PutPosReader) ReadResponse(response runtime.ClientResponse, consumer ru return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutPosOK() *PutPosOK { return &PutPosOK{} } -/*PutPosOK handles this case with default header values. +/* PutPosOK describes a response with status code 200, with default header values. An array of Purchase Order objects */ @@ -79,7 +78,6 @@ type PutPosOK struct { func (o *PutPosOK) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPosOK %+v", 200, o.Payload) } - func (o *PutPosOK) GetPayload() *sf_gate_models.PurchaseOrderResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutPosUnauthorized() *PutPosUnauthorized { return &PutPosUnauthorized{} } -/*PutPosUnauthorized handles this case with default header values. +/* PutPosUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutPosUnauthorized struct { func (o *PutPosUnauthorized) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPosUnauthorized %+v", 401, o.Payload) } - func (o *PutPosUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutPosForbidden() *PutPosForbidden { return &PutPosForbidden{} } -/*PutPosForbidden handles this case with default header values. +/* PutPosForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutPosForbidden struct { func (o *PutPosForbidden) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPosForbidden %+v", 403, o.Payload) } - func (o *PutPosForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutPosNotFound() *PutPosNotFound { return &PutPosNotFound{} } -/*PutPosNotFound handles this case with default header values. +/* PutPosNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutPosNotFound struct { func (o *PutPosNotFound) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPosNotFound %+v", 404, o.Payload) } - func (o *PutPosNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutPosInternalServerError() *PutPosInternalServerError { return &PutPosInternalServerError{} } -/*PutPosInternalServerError handles this case with default header values. +/* PutPosInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutPosInternalServerError struct { func (o *PutPosInternalServerError) Error() string { return fmt.Sprintf("[PUT /pos][%d] putPosInternalServerError %+v", 500, o.Payload) } - func (o *PutPosInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/quotes/get_quotes_parameters.go b/api/sf-gate/sf_gate_client/quotes/get_quotes_parameters.go index 5e51fa7..7d7e977 100644 --- a/api/sf-gate/sf_gate_client/quotes/get_quotes_parameters.go +++ b/api/sf-gate/sf_gate_client/quotes/get_quotes_parameters.go @@ -21,83 +21,92 @@ import ( "github.com/go-openapi/swag" ) -// NewGetQuotesParams creates a new GetQuotesParams object -// with the default values initialized. +// NewGetQuotesParams creates a new GetQuotesParams 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 NewGetQuotesParams() *GetQuotesParams { - var () return &GetQuotesParams{ - timeout: cr.DefaultTimeout, } } // NewGetQuotesParamsWithTimeout creates a new GetQuotesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetQuotesParamsWithTimeout(timeout time.Duration) *GetQuotesParams { - var () return &GetQuotesParams{ - timeout: timeout, } } // NewGetQuotesParamsWithContext creates a new GetQuotesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetQuotesParamsWithContext(ctx context.Context) *GetQuotesParams { - var () return &GetQuotesParams{ - Context: ctx, } } // NewGetQuotesParamsWithHTTPClient creates a new GetQuotesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetQuotesParamsWithHTTPClient(client *http.Client) *GetQuotesParams { - var () return &GetQuotesParams{ HTTPClient: client, } } -/*GetQuotesParams contains all the parameters to send to the API endpoint -for the get quotes operation typically these are written to a http.Request +/* GetQuotesParams contains all the parameters to send to the API endpoint + for the get quotes operation. + + Typically these are written to a http.Request. */ type GetQuotesParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*AccountNumber - The Taxnexus Account Number of the Account to be used a record retrieval + /* AccountNumber. + + The Taxnexus Account Number of the Account to be used a record retrieval */ AccountNumber *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*QuoteID - Taxnexus Id of the Company to be retrieved + /* QuoteID. + + Taxnexus Id of the Company to be retrieved */ QuoteID *string @@ -106,6 +115,21 @@ type GetQuotesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetQuotesParams) WithDefaults() *GetQuotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetQuotesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get quotes params func (o *GetQuotesParams) WithTimeout(timeout time.Duration) *GetQuotesParams { o.SetTimeout(timeout) @@ -228,112 +252,119 @@ func (o *GetQuotesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // 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.AccountNumber != nil { // query param accountNumber var qrAccountNumber string + if o.AccountNumber != nil { qrAccountNumber = *o.AccountNumber } qAccountNumber := qrAccountNumber if qAccountNumber != "" { + if err := r.SetQueryParam("accountNumber", qAccountNumber); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.QuoteID != nil { // query param quoteId var qrQuoteID string + if o.QuoteID != nil { qrQuoteID = *o.QuoteID } qQuoteID := qrQuoteID if qQuoteID != "" { + if err := r.SetQueryParam("quoteId", qQuoteID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/quotes/get_quotes_responses.go b/api/sf-gate/sf_gate_client/quotes/get_quotes_responses.go index fbb83b6..045db6b 100644 --- a/api/sf-gate/sf_gate_client/quotes/get_quotes_responses.go +++ b/api/sf-gate/sf_gate_client/quotes/get_quotes_responses.go @@ -63,9 +63,8 @@ func (o *GetQuotesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetQuotesOK() *GetQuotesOK { return &GetQuotesOK{} } -/*GetQuotesOK handles this case with default header values. +/* GetQuotesOK describes a response with status code 200, with default header values. An array of Quote objects */ @@ -85,7 +84,6 @@ type GetQuotesOK struct { func (o *GetQuotesOK) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesOK %+v", 200, o.Payload) } - func (o *GetQuotesOK) GetPayload() *sf_gate_models.QuoteResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetQuotesUnauthorized() *GetQuotesUnauthorized { return &GetQuotesUnauthorized{} } -/*GetQuotesUnauthorized handles this case with default header values. +/* GetQuotesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetQuotesUnauthorized struct { func (o *GetQuotesUnauthorized) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesUnauthorized %+v", 401, o.Payload) } - func (o *GetQuotesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetQuotesForbidden() *GetQuotesForbidden { return &GetQuotesForbidden{} } -/*GetQuotesForbidden handles this case with default header values. +/* GetQuotesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetQuotesForbidden struct { func (o *GetQuotesForbidden) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesForbidden %+v", 403, o.Payload) } - func (o *GetQuotesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetQuotesNotFound() *GetQuotesNotFound { return &GetQuotesNotFound{} } -/*GetQuotesNotFound handles this case with default header values. +/* GetQuotesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetQuotesNotFound struct { func (o *GetQuotesNotFound) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesNotFound %+v", 404, o.Payload) } - func (o *GetQuotesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetQuotesUnprocessableEntity() *GetQuotesUnprocessableEntity { return &GetQuotesUnprocessableEntity{} } -/*GetQuotesUnprocessableEntity handles this case with default header values. +/* GetQuotesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetQuotesUnprocessableEntity struct { func (o *GetQuotesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetQuotesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetQuotesInternalServerError() *GetQuotesInternalServerError { return &GetQuotesInternalServerError{} } -/*GetQuotesInternalServerError handles this case with default header values. +/* GetQuotesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetQuotesInternalServerError struct { func (o *GetQuotesInternalServerError) Error() string { return fmt.Sprintf("[GET /quotes][%d] getQuotesInternalServerError %+v", 500, o.Payload) } - func (o *GetQuotesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/quotes/post_quotes_parameters.go b/api/sf-gate/sf_gate_client/quotes/post_quotes_parameters.go index a24dd49..8f8c7bd 100644 --- a/api/sf-gate/sf_gate_client/quotes/post_quotes_parameters.go +++ b/api/sf-gate/sf_gate_client/quotes/post_quotes_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostQuotesParams creates a new PostQuotesParams object -// with the default values initialized. +// NewPostQuotesParams creates a new PostQuotesParams 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 NewPostQuotesParams() *PostQuotesParams { - var () return &PostQuotesParams{ - timeout: cr.DefaultTimeout, } } // NewPostQuotesParamsWithTimeout creates a new PostQuotesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostQuotesParamsWithTimeout(timeout time.Duration) *PostQuotesParams { - var () return &PostQuotesParams{ - timeout: timeout, } } // NewPostQuotesParamsWithContext creates a new PostQuotesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostQuotesParamsWithContext(ctx context.Context) *PostQuotesParams { - var () return &PostQuotesParams{ - Context: ctx, } } // NewPostQuotesParamsWithHTTPClient creates a new PostQuotesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostQuotesParamsWithHTTPClient(client *http.Client) *PostQuotesParams { - var () return &PostQuotesParams{ HTTPClient: client, } } -/*PostQuotesParams contains all the parameters to send to the API endpoint -for the post quotes operation typically these are written to a http.Request +/* PostQuotesParams contains all the parameters to send to the API endpoint + for the post quotes operation. + + Typically these are written to a http.Request. */ type PostQuotesParams struct { - /*Order*/ + // Order. Order *sf_gate_models.Order timeout time.Duration @@ -74,6 +73,21 @@ type PostQuotesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostQuotesParams) WithDefaults() *PostQuotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostQuotesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post quotes params func (o *PostQuotesParams) WithTimeout(timeout time.Duration) *PostQuotesParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PostQuotesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.Order != nil { if err := r.SetBodyParam(o.Order); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/quotes/post_quotes_responses.go b/api/sf-gate/sf_gate_client/quotes/post_quotes_responses.go index 47c1547..c137f78 100644 --- a/api/sf-gate/sf_gate_client/quotes/post_quotes_responses.go +++ b/api/sf-gate/sf_gate_client/quotes/post_quotes_responses.go @@ -57,9 +57,8 @@ func (o *PostQuotesReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostQuotesOK() *PostQuotesOK { return &PostQuotesOK{} } -/*PostQuotesOK handles this case with default header values. +/* PostQuotesOK describes a response with status code 200, with default header values. An array of Quote objects */ @@ -79,7 +78,6 @@ type PostQuotesOK struct { func (o *PostQuotesOK) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesOK %+v", 200, o.Payload) } - func (o *PostQuotesOK) GetPayload() *sf_gate_models.QuoteResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostQuotesUnauthorized() *PostQuotesUnauthorized { return &PostQuotesUnauthorized{} } -/*PostQuotesUnauthorized handles this case with default header values. +/* PostQuotesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostQuotesUnauthorized struct { func (o *PostQuotesUnauthorized) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesUnauthorized %+v", 401, o.Payload) } - func (o *PostQuotesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostQuotesForbidden() *PostQuotesForbidden { return &PostQuotesForbidden{} } -/*PostQuotesForbidden handles this case with default header values. +/* PostQuotesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostQuotesForbidden struct { func (o *PostQuotesForbidden) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesForbidden %+v", 403, o.Payload) } - func (o *PostQuotesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostQuotesNotFound() *PostQuotesNotFound { return &PostQuotesNotFound{} } -/*PostQuotesNotFound handles this case with default header values. +/* PostQuotesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostQuotesNotFound struct { func (o *PostQuotesNotFound) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesNotFound %+v", 404, o.Payload) } - func (o *PostQuotesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostQuotesInternalServerError() *PostQuotesInternalServerError { return &PostQuotesInternalServerError{} } -/*PostQuotesInternalServerError handles this case with default header values. +/* PostQuotesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostQuotesInternalServerError struct { func (o *PostQuotesInternalServerError) Error() string { return fmt.Sprintf("[POST /quotes][%d] postQuotesInternalServerError %+v", 500, o.Payload) } - func (o *PostQuotesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/quotes/put_quotes_parameters.go b/api/sf-gate/sf_gate_client/quotes/put_quotes_parameters.go index 95a1045..0135805 100644 --- a/api/sf-gate/sf_gate_client/quotes/put_quotes_parameters.go +++ b/api/sf-gate/sf_gate_client/quotes/put_quotes_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutQuotesParams creates a new PutQuotesParams object -// with the default values initialized. +// NewPutQuotesParams creates a new PutQuotesParams 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 NewPutQuotesParams() *PutQuotesParams { - var () return &PutQuotesParams{ - timeout: cr.DefaultTimeout, } } // NewPutQuotesParamsWithTimeout creates a new PutQuotesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutQuotesParamsWithTimeout(timeout time.Duration) *PutQuotesParams { - var () return &PutQuotesParams{ - timeout: timeout, } } // NewPutQuotesParamsWithContext creates a new PutQuotesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutQuotesParamsWithContext(ctx context.Context) *PutQuotesParams { - var () return &PutQuotesParams{ - Context: ctx, } } // NewPutQuotesParamsWithHTTPClient creates a new PutQuotesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutQuotesParamsWithHTTPClient(client *http.Client) *PutQuotesParams { - var () return &PutQuotesParams{ HTTPClient: client, } } -/*PutQuotesParams contains all the parameters to send to the API endpoint -for the put quotes operation typically these are written to a http.Request +/* PutQuotesParams contains all the parameters to send to the API endpoint + for the put quotes operation. + + Typically these are written to a http.Request. */ type PutQuotesParams struct { - /*Order*/ + // Order. Order *sf_gate_models.Order timeout time.Duration @@ -74,6 +73,21 @@ type PutQuotesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutQuotesParams) WithDefaults() *PutQuotesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put quotes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutQuotesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put quotes params func (o *PutQuotesParams) WithTimeout(timeout time.Duration) *PutQuotesParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PutQuotesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg return err } var res []error - if o.Order != nil { if err := r.SetBodyParam(o.Order); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/quotes/put_quotes_responses.go b/api/sf-gate/sf_gate_client/quotes/put_quotes_responses.go index b0df325..35f53f8 100644 --- a/api/sf-gate/sf_gate_client/quotes/put_quotes_responses.go +++ b/api/sf-gate/sf_gate_client/quotes/put_quotes_responses.go @@ -57,9 +57,8 @@ func (o *PutQuotesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutQuotesOK() *PutQuotesOK { return &PutQuotesOK{} } -/*PutQuotesOK handles this case with default header values. +/* PutQuotesOK describes a response with status code 200, with default header values. An array of Quote objects */ @@ -79,7 +78,6 @@ type PutQuotesOK struct { func (o *PutQuotesOK) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesOK %+v", 200, o.Payload) } - func (o *PutQuotesOK) GetPayload() *sf_gate_models.QuoteResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutQuotesUnauthorized() *PutQuotesUnauthorized { return &PutQuotesUnauthorized{} } -/*PutQuotesUnauthorized handles this case with default header values. +/* PutQuotesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutQuotesUnauthorized struct { func (o *PutQuotesUnauthorized) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesUnauthorized %+v", 401, o.Payload) } - func (o *PutQuotesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutQuotesForbidden() *PutQuotesForbidden { return &PutQuotesForbidden{} } -/*PutQuotesForbidden handles this case with default header values. +/* PutQuotesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutQuotesForbidden struct { func (o *PutQuotesForbidden) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesForbidden %+v", 403, o.Payload) } - func (o *PutQuotesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutQuotesNotFound() *PutQuotesNotFound { return &PutQuotesNotFound{} } -/*PutQuotesNotFound handles this case with default header values. +/* PutQuotesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutQuotesNotFound struct { func (o *PutQuotesNotFound) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesNotFound %+v", 404, o.Payload) } - func (o *PutQuotesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutQuotesInternalServerError() *PutQuotesInternalServerError { return &PutQuotesInternalServerError{} } -/*PutQuotesInternalServerError handles this case with default header values. +/* PutQuotesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutQuotesInternalServerError struct { func (o *PutQuotesInternalServerError) Error() string { return fmt.Sprintf("[PUT /quotes][%d] putQuotesInternalServerError %+v", 500, o.Payload) } - func (o *PutQuotesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/quotes/quotes_client.go b/api/sf-gate/sf_gate_client/quotes/quotes_client.go index f91984e..f83225c 100644 --- a/api/sf-gate/sf_gate_client/quotes/quotes_client.go +++ b/api/sf-gate/sf_gate_client/quotes/quotes_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*GetQuotesOK, error) + GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetQuotesOK, error) - PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PostQuotesOK, error) + PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostQuotesOK, error) - PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PutQuotesOK, error) + PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutQuotesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Taxnexus Quotes */ -func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*GetQuotesOK, error) { +func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetQuotesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetQuotesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getQuotes", Method: "GET", PathPattern: "/quotes", @@ -63,7 +65,12 @@ func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthI 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 } @@ -82,13 +89,12 @@ func (a *Client) GetQuotes(params *GetQuotesParams, authInfo runtime.ClientAuthI Create new Quotes */ -func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PostQuotesOK, error) { +func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostQuotesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostQuotesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postQuotes", Method: "POST", PathPattern: "/quotes", @@ -100,7 +106,12 @@ func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAut 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 } @@ -119,13 +130,12 @@ func (a *Client) PostQuotes(params *PostQuotesParams, authInfo runtime.ClientAut Update QUotes */ -func (a *Client) PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter) (*PutQuotesOK, error) { +func (a *Client) PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutQuotesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutQuotesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putQuotes", Method: "PUT", PathPattern: "/quotes", @@ -137,7 +147,12 @@ func (a *Client) PutQuotes(params *PutQuotesParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/sf-gate/sf_gate_client/roles/get_roles_parameters.go b/api/sf-gate/sf_gate_client/roles/get_roles_parameters.go index 203620e..7f73009 100644 --- a/api/sf-gate/sf_gate_client/roles/get_roles_parameters.go +++ b/api/sf-gate/sf_gate_client/roles/get_roles_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetRolesParams creates a new GetRolesParams object -// with the default values initialized. +// NewGetRolesParams creates a new GetRolesParams 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 NewGetRolesParams() *GetRolesParams { - var () return &GetRolesParams{ - timeout: cr.DefaultTimeout, } } // NewGetRolesParamsWithTimeout creates a new GetRolesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetRolesParamsWithTimeout(timeout time.Duration) *GetRolesParams { - var () return &GetRolesParams{ - timeout: timeout, } } // NewGetRolesParamsWithContext creates a new GetRolesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetRolesParamsWithContext(ctx context.Context) *GetRolesParams { - var () return &GetRolesParams{ - Context: ctx, } } // NewGetRolesParamsWithHTTPClient creates a new GetRolesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetRolesParamsWithHTTPClient(client *http.Client) *GetRolesParams { - var () return &GetRolesParams{ HTTPClient: client, } } -/*GetRolesParams contains all the parameters to send to the API endpoint -for the get roles operation typically these are written to a http.Request +/* GetRolesParams contains all the parameters to send to the API endpoint + for the get roles operation. + + Typically these are written to a http.Request. */ type GetRolesParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*RoleID - Taxnexus Id of the Role to be retrieved + /* RoleID. + + Taxnexus Id of the Role to be retrieved */ RoleID *string @@ -86,6 +91,21 @@ type GetRolesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRolesParams) WithDefaults() *GetRolesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get roles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRolesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get roles params func (o *GetRolesParams) WithTimeout(timeout time.Duration) *GetRolesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetRolesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // 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 o.RoleID != nil { // query param roleId var qrRoleID string + if o.RoleID != nil { qrRoleID = *o.RoleID } qRoleID := qrRoleID if qRoleID != "" { + if err := r.SetQueryParam("roleId", qRoleID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/roles/get_roles_responses.go b/api/sf-gate/sf_gate_client/roles/get_roles_responses.go index be2dfaf..f3fbeec 100644 --- a/api/sf-gate/sf_gate_client/roles/get_roles_responses.go +++ b/api/sf-gate/sf_gate_client/roles/get_roles_responses.go @@ -63,9 +63,8 @@ func (o *GetRolesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetRolesOK() *GetRolesOK { return &GetRolesOK{} } -/*GetRolesOK handles this case with default header values. +/* GetRolesOK describes a response with status code 200, with default header values. Taxnexus Response with Role objects */ @@ -85,7 +84,6 @@ type GetRolesOK struct { func (o *GetRolesOK) Error() string { return fmt.Sprintf("[GET /roles][%d] getRolesOK %+v", 200, o.Payload) } - func (o *GetRolesOK) GetPayload() *sf_gate_models.RoleResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetRolesUnauthorized() *GetRolesUnauthorized { return &GetRolesUnauthorized{} } -/*GetRolesUnauthorized handles this case with default header values. +/* GetRolesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetRolesUnauthorized struct { func (o *GetRolesUnauthorized) Error() string { return fmt.Sprintf("[GET /roles][%d] getRolesUnauthorized %+v", 401, o.Payload) } - func (o *GetRolesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetRolesForbidden() *GetRolesForbidden { return &GetRolesForbidden{} } -/*GetRolesForbidden handles this case with default header values. +/* GetRolesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetRolesForbidden struct { func (o *GetRolesForbidden) Error() string { return fmt.Sprintf("[GET /roles][%d] getRolesForbidden %+v", 403, o.Payload) } - func (o *GetRolesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetRolesNotFound() *GetRolesNotFound { return &GetRolesNotFound{} } -/*GetRolesNotFound handles this case with default header values. +/* GetRolesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetRolesNotFound struct { func (o *GetRolesNotFound) Error() string { return fmt.Sprintf("[GET /roles][%d] getRolesNotFound %+v", 404, o.Payload) } - func (o *GetRolesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetRolesUnprocessableEntity() *GetRolesUnprocessableEntity { return &GetRolesUnprocessableEntity{} } -/*GetRolesUnprocessableEntity handles this case with default header values. +/* GetRolesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetRolesUnprocessableEntity struct { func (o *GetRolesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /roles][%d] getRolesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetRolesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetRolesInternalServerError() *GetRolesInternalServerError { return &GetRolesInternalServerError{} } -/*GetRolesInternalServerError handles this case with default header values. +/* GetRolesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetRolesInternalServerError struct { func (o *GetRolesInternalServerError) Error() string { return fmt.Sprintf("[GET /roles][%d] getRolesInternalServerError %+v", 500, o.Payload) } - func (o *GetRolesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/roles/roles_client.go b/api/sf-gate/sf_gate_client/roles/roles_client.go index fe0f5cc..1a2c42e 100644 --- a/api/sf-gate/sf_gate_client/roles/roles_client.go +++ b/api/sf-gate/sf_gate_client/roles/roles_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetRoles(params *GetRolesParams, authInfo runtime.ClientAuthInfoWriter) (*GetRolesOK, error) + GetRoles(params *GetRolesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRolesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of Roles */ -func (a *Client) GetRoles(params *GetRolesParams, authInfo runtime.ClientAuthInfoWriter) (*GetRolesOK, error) { +func (a *Client) GetRoles(params *GetRolesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRolesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRolesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRoles", Method: "GET", PathPattern: "/roles", @@ -59,7 +61,12 @@ func (a *Client) GetRoles(params *GetRolesParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/sf-gate/sf_gate_client/services/get_services_parameters.go b/api/sf-gate/sf_gate_client/services/get_services_parameters.go index 8584cd5..8349ddd 100644 --- a/api/sf-gate/sf_gate_client/services/get_services_parameters.go +++ b/api/sf-gate/sf_gate_client/services/get_services_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetServicesParams creates a new GetServicesParams object -// with the default values initialized. +// NewGetServicesParams creates a new GetServicesParams 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 NewGetServicesParams() *GetServicesParams { - var () return &GetServicesParams{ - timeout: cr.DefaultTimeout, } } // NewGetServicesParamsWithTimeout creates a new GetServicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetServicesParamsWithTimeout(timeout time.Duration) *GetServicesParams { - var () return &GetServicesParams{ - timeout: timeout, } } // NewGetServicesParamsWithContext creates a new GetServicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetServicesParamsWithContext(ctx context.Context) *GetServicesParams { - var () return &GetServicesParams{ - Context: ctx, } } // NewGetServicesParamsWithHTTPClient creates a new GetServicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetServicesParamsWithHTTPClient(client *http.Client) *GetServicesParams { - var () return &GetServicesParams{ HTTPClient: client, } } -/*GetServicesParams contains all the parameters to send to the API endpoint -for the get services operation typically these are written to a http.Request +/* GetServicesParams contains all the parameters to send to the API endpoint + for the get services operation. + + Typically these are written to a http.Request. */ type GetServicesParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*ServiceID - Service ID + /* ServiceID. + + Service ID */ ServiceID *string @@ -86,6 +91,21 @@ type GetServicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServicesParams) WithDefaults() *GetServicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetServicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get services params func (o *GetServicesParams) WithTimeout(timeout time.Duration) *GetServicesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // 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 o.ServiceID != nil { // query param serviceId var qrServiceID string + if o.ServiceID != nil { qrServiceID = *o.ServiceID } qServiceID := qrServiceID if qServiceID != "" { + if err := r.SetQueryParam("serviceId", qServiceID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/services/get_services_responses.go b/api/sf-gate/sf_gate_client/services/get_services_responses.go index ad4ebfc..8fb1f18 100644 --- a/api/sf-gate/sf_gate_client/services/get_services_responses.go +++ b/api/sf-gate/sf_gate_client/services/get_services_responses.go @@ -63,9 +63,8 @@ func (o *GetServicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetServicesOK() *GetServicesOK { return &GetServicesOK{} } -/*GetServicesOK handles this case with default header values. +/* GetServicesOK describes a response with status code 200, with default header values. Taxnexus Response with Service objects */ @@ -85,7 +84,6 @@ type GetServicesOK struct { func (o *GetServicesOK) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesOK %+v", 200, o.Payload) } - func (o *GetServicesOK) GetPayload() *sf_gate_models.ServiceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetServicesUnauthorized() *GetServicesUnauthorized { return &GetServicesUnauthorized{} } -/*GetServicesUnauthorized handles this case with default header values. +/* GetServicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetServicesUnauthorized struct { func (o *GetServicesUnauthorized) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesUnauthorized %+v", 401, o.Payload) } - func (o *GetServicesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetServicesForbidden() *GetServicesForbidden { return &GetServicesForbidden{} } -/*GetServicesForbidden handles this case with default header values. +/* GetServicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetServicesForbidden struct { func (o *GetServicesForbidden) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesForbidden %+v", 403, o.Payload) } - func (o *GetServicesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetServicesNotFound() *GetServicesNotFound { return &GetServicesNotFound{} } -/*GetServicesNotFound handles this case with default header values. +/* GetServicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetServicesNotFound struct { func (o *GetServicesNotFound) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesNotFound %+v", 404, o.Payload) } - func (o *GetServicesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetServicesUnprocessableEntity() *GetServicesUnprocessableEntity { return &GetServicesUnprocessableEntity{} } -/*GetServicesUnprocessableEntity handles this case with default header values. +/* GetServicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetServicesUnprocessableEntity struct { func (o *GetServicesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetServicesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetServicesInternalServerError() *GetServicesInternalServerError { return &GetServicesInternalServerError{} } -/*GetServicesInternalServerError handles this case with default header values. +/* GetServicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetServicesInternalServerError struct { func (o *GetServicesInternalServerError) Error() string { return fmt.Sprintf("[GET /services][%d] getServicesInternalServerError %+v", 500, o.Payload) } - func (o *GetServicesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/services/post_services_parameters.go b/api/sf-gate/sf_gate_client/services/post_services_parameters.go index 5fa2206..551475a 100644 --- a/api/sf-gate/sf_gate_client/services/post_services_parameters.go +++ b/api/sf-gate/sf_gate_client/services/post_services_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostServicesParams creates a new PostServicesParams object -// with the default values initialized. +// NewPostServicesParams creates a new PostServicesParams 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 NewPostServicesParams() *PostServicesParams { - var () return &PostServicesParams{ - timeout: cr.DefaultTimeout, } } // NewPostServicesParamsWithTimeout creates a new PostServicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostServicesParamsWithTimeout(timeout time.Duration) *PostServicesParams { - var () return &PostServicesParams{ - timeout: timeout, } } // NewPostServicesParamsWithContext creates a new PostServicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostServicesParamsWithContext(ctx context.Context) *PostServicesParams { - var () return &PostServicesParams{ - Context: ctx, } } // NewPostServicesParamsWithHTTPClient creates a new PostServicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostServicesParamsWithHTTPClient(client *http.Client) *PostServicesParams { - var () return &PostServicesParams{ HTTPClient: client, } } -/*PostServicesParams contains all the parameters to send to the API endpoint -for the post services operation typically these are written to a http.Request +/* PostServicesParams contains all the parameters to send to the API endpoint + for the post services operation. + + Typically these are written to a http.Request. */ type PostServicesParams struct { - /*ServiceRequest - An array of Service records + /* ServiceRequest. + An array of Service records */ ServiceRequest *sf_gate_models.ServiceRequest @@ -77,6 +76,21 @@ type PostServicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostServicesParams) WithDefaults() *PostServicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostServicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post services params func (o *PostServicesParams) WithTimeout(timeout time.Duration) *PostServicesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if o.ServiceRequest != nil { if err := r.SetBodyParam(o.ServiceRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/services/post_services_responses.go b/api/sf-gate/sf_gate_client/services/post_services_responses.go index e7fe3a5..b562578 100644 --- a/api/sf-gate/sf_gate_client/services/post_services_responses.go +++ b/api/sf-gate/sf_gate_client/services/post_services_responses.go @@ -63,9 +63,8 @@ func (o *PostServicesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostServicesOK() *PostServicesOK { return &PostServicesOK{} } -/*PostServicesOK handles this case with default header values. +/* PostServicesOK describes a response with status code 200, with default header values. Taxnexus Response with Service objects */ @@ -85,7 +84,6 @@ type PostServicesOK struct { func (o *PostServicesOK) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesOK %+v", 200, o.Payload) } - func (o *PostServicesOK) GetPayload() *sf_gate_models.ServiceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostServicesUnauthorized() *PostServicesUnauthorized { return &PostServicesUnauthorized{} } -/*PostServicesUnauthorized handles this case with default header values. +/* PostServicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostServicesUnauthorized struct { func (o *PostServicesUnauthorized) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesUnauthorized %+v", 401, o.Payload) } - func (o *PostServicesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostServicesForbidden() *PostServicesForbidden { return &PostServicesForbidden{} } -/*PostServicesForbidden handles this case with default header values. +/* PostServicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostServicesForbidden struct { func (o *PostServicesForbidden) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesForbidden %+v", 403, o.Payload) } - func (o *PostServicesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostServicesNotFound() *PostServicesNotFound { return &PostServicesNotFound{} } -/*PostServicesNotFound handles this case with default header values. +/* PostServicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostServicesNotFound struct { func (o *PostServicesNotFound) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesNotFound %+v", 404, o.Payload) } - func (o *PostServicesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostServicesUnprocessableEntity() *PostServicesUnprocessableEntity { return &PostServicesUnprocessableEntity{} } -/*PostServicesUnprocessableEntity handles this case with default header values. +/* PostServicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostServicesUnprocessableEntity struct { func (o *PostServicesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostServicesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostServicesInternalServerError() *PostServicesInternalServerError { return &PostServicesInternalServerError{} } -/*PostServicesInternalServerError handles this case with default header values. +/* PostServicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostServicesInternalServerError struct { func (o *PostServicesInternalServerError) Error() string { return fmt.Sprintf("[POST /services][%d] postServicesInternalServerError %+v", 500, o.Payload) } - func (o *PostServicesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/services/put_services_parameters.go b/api/sf-gate/sf_gate_client/services/put_services_parameters.go index ef3c4b2..306f301 100644 --- a/api/sf-gate/sf_gate_client/services/put_services_parameters.go +++ b/api/sf-gate/sf_gate_client/services/put_services_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutServicesParams creates a new PutServicesParams object -// with the default values initialized. +// NewPutServicesParams creates a new PutServicesParams 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 NewPutServicesParams() *PutServicesParams { - var () return &PutServicesParams{ - timeout: cr.DefaultTimeout, } } // NewPutServicesParamsWithTimeout creates a new PutServicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutServicesParamsWithTimeout(timeout time.Duration) *PutServicesParams { - var () return &PutServicesParams{ - timeout: timeout, } } // NewPutServicesParamsWithContext creates a new PutServicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutServicesParamsWithContext(ctx context.Context) *PutServicesParams { - var () return &PutServicesParams{ - Context: ctx, } } // NewPutServicesParamsWithHTTPClient creates a new PutServicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutServicesParamsWithHTTPClient(client *http.Client) *PutServicesParams { - var () return &PutServicesParams{ HTTPClient: client, } } -/*PutServicesParams contains all the parameters to send to the API endpoint -for the put services operation typically these are written to a http.Request +/* PutServicesParams contains all the parameters to send to the API endpoint + for the put services operation. + + Typically these are written to a http.Request. */ type PutServicesParams struct { - /*ServiceRequest - An array of Service records + /* ServiceRequest. + An array of Service records */ ServiceRequest *sf_gate_models.ServiceRequest @@ -77,6 +76,21 @@ type PutServicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutServicesParams) WithDefaults() *PutServicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put services params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutServicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put services params func (o *PutServicesParams) WithTimeout(timeout time.Duration) *PutServicesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.ServiceRequest != nil { if err := r.SetBodyParam(o.ServiceRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/services/put_services_responses.go b/api/sf-gate/sf_gate_client/services/put_services_responses.go index ef869a6..f6b5a8f 100644 --- a/api/sf-gate/sf_gate_client/services/put_services_responses.go +++ b/api/sf-gate/sf_gate_client/services/put_services_responses.go @@ -63,9 +63,8 @@ func (o *PutServicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutServicesOK() *PutServicesOK { return &PutServicesOK{} } -/*PutServicesOK handles this case with default header values. +/* PutServicesOK describes a response with status code 200, with default header values. Taxnexus Response with Service objects */ @@ -85,7 +84,6 @@ type PutServicesOK struct { func (o *PutServicesOK) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesOK %+v", 200, o.Payload) } - func (o *PutServicesOK) GetPayload() *sf_gate_models.ServiceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPutServicesUnauthorized() *PutServicesUnauthorized { return &PutServicesUnauthorized{} } -/*PutServicesUnauthorized handles this case with default header values. +/* PutServicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PutServicesUnauthorized struct { func (o *PutServicesUnauthorized) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesUnauthorized %+v", 401, o.Payload) } - func (o *PutServicesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPutServicesForbidden() *PutServicesForbidden { return &PutServicesForbidden{} } -/*PutServicesForbidden handles this case with default header values. +/* PutServicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PutServicesForbidden struct { func (o *PutServicesForbidden) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesForbidden %+v", 403, o.Payload) } - func (o *PutServicesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPutServicesNotFound() *PutServicesNotFound { return &PutServicesNotFound{} } -/*PutServicesNotFound handles this case with default header values. +/* PutServicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PutServicesNotFound struct { func (o *PutServicesNotFound) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesNotFound %+v", 404, o.Payload) } - func (o *PutServicesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPutServicesUnprocessableEntity() *PutServicesUnprocessableEntity { return &PutServicesUnprocessableEntity{} } -/*PutServicesUnprocessableEntity handles this case with default header values. +/* PutServicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PutServicesUnprocessableEntity struct { func (o *PutServicesUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutServicesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPutServicesInternalServerError() *PutServicesInternalServerError { return &PutServicesInternalServerError{} } -/*PutServicesInternalServerError handles this case with default header values. +/* PutServicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PutServicesInternalServerError struct { func (o *PutServicesInternalServerError) Error() string { return fmt.Sprintf("[PUT /services][%d] putServicesInternalServerError %+v", 500, o.Payload) } - func (o *PutServicesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/services/services_client.go b/api/sf-gate/sf_gate_client/services/services_client.go index 8b5fcdb..72b3134 100644 --- a/api/sf-gate/sf_gate_client/services/services_client.go +++ b/api/sf-gate/sf_gate_client/services/services_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetServicesOK, error) + GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServicesOK, error) - PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostServicesOK, error) + PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostServicesOK, error) - PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutServicesOK, error) + PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutServicesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Services records from the datastore */ -func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetServicesOK, error) { +func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetServicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getServices", Method: "GET", PathPattern: "/services", @@ -63,7 +65,12 @@ func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientA 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 } @@ -82,13 +89,12 @@ func (a *Client) GetServices(params *GetServicesParams, authInfo runtime.ClientA Create Services in Taxnexus */ -func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PostServicesOK, error) { +func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostServicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostServicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postServices", Method: "POST", PathPattern: "/services", @@ -100,7 +106,12 @@ func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.Clien 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 } @@ -119,13 +130,12 @@ func (a *Client) PostServices(params *PostServicesParams, authInfo runtime.Clien Update Services in Taxnexus */ -func (a *Client) PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter) (*PutServicesOK, error) { +func (a *Client) PutServices(params *PutServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutServicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutServicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putServices", Method: "PUT", PathPattern: "/services", @@ -137,7 +147,12 @@ func (a *Client) PutServices(params *PutServicesParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/statements/get_statements_parameters.go b/api/sf-gate/sf_gate_client/statements/get_statements_parameters.go index d540fdd..ef0c61d 100644 --- a/api/sf-gate/sf_gate_client/statements/get_statements_parameters.go +++ b/api/sf-gate/sf_gate_client/statements/get_statements_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetStatementsParams creates a new GetStatementsParams object -// with the default values initialized. +// NewGetStatementsParams creates a new GetStatementsParams 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 NewGetStatementsParams() *GetStatementsParams { - var () return &GetStatementsParams{ - timeout: cr.DefaultTimeout, } } // NewGetStatementsParamsWithTimeout creates a new GetStatementsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStatementsParamsWithTimeout(timeout time.Duration) *GetStatementsParams { - var () return &GetStatementsParams{ - timeout: timeout, } } // NewGetStatementsParamsWithContext creates a new GetStatementsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStatementsParamsWithContext(ctx context.Context) *GetStatementsParams { - var () return &GetStatementsParams{ - Context: ctx, } } // NewGetStatementsParamsWithHTTPClient creates a new GetStatementsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStatementsParamsWithHTTPClient(client *http.Client) *GetStatementsParams { - var () return &GetStatementsParams{ HTTPClient: client, } } -/*GetStatementsParams contains all the parameters to send to the API endpoint -for the get statements operation typically these are written to a http.Request +/* GetStatementsParams contains all the parameters to send to the API endpoint + for the get statements operation. + + Typically these are written to a http.Request. */ type GetStatementsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*AccountNumber - The Taxnexus Account Number of the Account to be used a record retrieval + /* AccountNumber. + + The Taxnexus Account Number of the Account to be used a record retrieval */ AccountNumber *string - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*StatementID - Taxnexus Id of the Company to be retrieved + /* StatementID. + + Taxnexus Id of the Company to be retrieved */ StatementID *string @@ -101,6 +109,21 @@ type GetStatementsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get statements params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatementsParams) WithDefaults() *GetStatementsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get statements params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatementsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get statements params func (o *GetStatementsParams) WithTimeout(timeout time.Duration) *GetStatementsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetStatementsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt // 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.AccountNumber != nil { // query param accountNumber var qrAccountNumber string + if o.AccountNumber != nil { qrAccountNumber = *o.AccountNumber } qAccountNumber := qrAccountNumber if qAccountNumber != "" { + if err := r.SetQueryParam("accountNumber", qAccountNumber); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.StatementID != nil { // query param statementId var qrStatementID string + if o.StatementID != nil { qrStatementID = *o.StatementID } qStatementID := qrStatementID if qStatementID != "" { + if err := r.SetQueryParam("statementId", qStatementID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/statements/get_statements_responses.go b/api/sf-gate/sf_gate_client/statements/get_statements_responses.go index b2a3198..b3249e3 100644 --- a/api/sf-gate/sf_gate_client/statements/get_statements_responses.go +++ b/api/sf-gate/sf_gate_client/statements/get_statements_responses.go @@ -63,9 +63,8 @@ func (o *GetStatementsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetStatementsOK() *GetStatementsOK { return &GetStatementsOK{} } -/*GetStatementsOK handles this case with default header values. +/* GetStatementsOK describes a response with status code 200, with default header values. An array of Statement objects */ @@ -85,7 +84,6 @@ type GetStatementsOK struct { func (o *GetStatementsOK) Error() string { return fmt.Sprintf("[GET /statements][%d] getStatementsOK %+v", 200, o.Payload) } - func (o *GetStatementsOK) GetPayload() *sf_gate_models.StatementResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetStatementsUnauthorized() *GetStatementsUnauthorized { return &GetStatementsUnauthorized{} } -/*GetStatementsUnauthorized handles this case with default header values. +/* GetStatementsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetStatementsUnauthorized struct { func (o *GetStatementsUnauthorized) Error() string { return fmt.Sprintf("[GET /statements][%d] getStatementsUnauthorized %+v", 401, o.Payload) } - func (o *GetStatementsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetStatementsForbidden() *GetStatementsForbidden { return &GetStatementsForbidden{} } -/*GetStatementsForbidden handles this case with default header values. +/* GetStatementsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetStatementsForbidden struct { func (o *GetStatementsForbidden) Error() string { return fmt.Sprintf("[GET /statements][%d] getStatementsForbidden %+v", 403, o.Payload) } - func (o *GetStatementsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetStatementsNotFound() *GetStatementsNotFound { return &GetStatementsNotFound{} } -/*GetStatementsNotFound handles this case with default header values. +/* GetStatementsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetStatementsNotFound struct { func (o *GetStatementsNotFound) Error() string { return fmt.Sprintf("[GET /statements][%d] getStatementsNotFound %+v", 404, o.Payload) } - func (o *GetStatementsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetStatementsUnprocessableEntity() *GetStatementsUnprocessableEntity { return &GetStatementsUnprocessableEntity{} } -/*GetStatementsUnprocessableEntity handles this case with default header values. +/* GetStatementsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetStatementsUnprocessableEntity struct { func (o *GetStatementsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /statements][%d] getStatementsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetStatementsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetStatementsInternalServerError() *GetStatementsInternalServerError { return &GetStatementsInternalServerError{} } -/*GetStatementsInternalServerError handles this case with default header values. +/* GetStatementsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetStatementsInternalServerError struct { func (o *GetStatementsInternalServerError) Error() string { return fmt.Sprintf("[GET /statements][%d] getStatementsInternalServerError %+v", 500, o.Payload) } - func (o *GetStatementsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/statements/post_statements_parameters.go b/api/sf-gate/sf_gate_client/statements/post_statements_parameters.go index 16e4328..174020b 100644 --- a/api/sf-gate/sf_gate_client/statements/post_statements_parameters.go +++ b/api/sf-gate/sf_gate_client/statements/post_statements_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostStatementsParams creates a new PostStatementsParams object -// with the default values initialized. +// NewPostStatementsParams creates a new PostStatementsParams 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 NewPostStatementsParams() *PostStatementsParams { - var () return &PostStatementsParams{ - timeout: cr.DefaultTimeout, } } // NewPostStatementsParamsWithTimeout creates a new PostStatementsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostStatementsParamsWithTimeout(timeout time.Duration) *PostStatementsParams { - var () return &PostStatementsParams{ - timeout: timeout, } } // NewPostStatementsParamsWithContext creates a new PostStatementsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostStatementsParamsWithContext(ctx context.Context) *PostStatementsParams { - var () return &PostStatementsParams{ - Context: ctx, } } // NewPostStatementsParamsWithHTTPClient creates a new PostStatementsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostStatementsParamsWithHTTPClient(client *http.Client) *PostStatementsParams { - var () return &PostStatementsParams{ HTTPClient: client, } } -/*PostStatementsParams contains all the parameters to send to the API endpoint -for the post statements operation typically these are written to a http.Request +/* PostStatementsParams contains all the parameters to send to the API endpoint + for the post statements operation. + + Typically these are written to a http.Request. */ type PostStatementsParams struct { - /*StatementsRequest - An array of new Statement records + /* StatementsRequest. + An array of new Statement records */ StatementsRequest *sf_gate_models.StatementRequest @@ -77,6 +76,21 @@ type PostStatementsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post statements params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostStatementsParams) WithDefaults() *PostStatementsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post statements params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostStatementsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post statements params func (o *PostStatementsParams) WithTimeout(timeout time.Duration) *PostStatementsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostStatementsParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.StatementsRequest != nil { if err := r.SetBodyParam(o.StatementsRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/statements/post_statements_responses.go b/api/sf-gate/sf_gate_client/statements/post_statements_responses.go index f912d75..e5a7308 100644 --- a/api/sf-gate/sf_gate_client/statements/post_statements_responses.go +++ b/api/sf-gate/sf_gate_client/statements/post_statements_responses.go @@ -57,9 +57,8 @@ func (o *PostStatementsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostStatementsOK() *PostStatementsOK { return &PostStatementsOK{} } -/*PostStatementsOK handles this case with default header values. +/* PostStatementsOK describes a response with status code 200, with default header values. An array of Statement objects */ @@ -79,7 +78,6 @@ type PostStatementsOK struct { func (o *PostStatementsOK) Error() string { return fmt.Sprintf("[POST /statements][%d] postStatementsOK %+v", 200, o.Payload) } - func (o *PostStatementsOK) GetPayload() *sf_gate_models.StatementResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostStatementsUnauthorized() *PostStatementsUnauthorized { return &PostStatementsUnauthorized{} } -/*PostStatementsUnauthorized handles this case with default header values. +/* PostStatementsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostStatementsUnauthorized struct { func (o *PostStatementsUnauthorized) Error() string { return fmt.Sprintf("[POST /statements][%d] postStatementsUnauthorized %+v", 401, o.Payload) } - func (o *PostStatementsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostStatementsForbidden() *PostStatementsForbidden { return &PostStatementsForbidden{} } -/*PostStatementsForbidden handles this case with default header values. +/* PostStatementsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostStatementsForbidden struct { func (o *PostStatementsForbidden) Error() string { return fmt.Sprintf("[POST /statements][%d] postStatementsForbidden %+v", 403, o.Payload) } - func (o *PostStatementsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostStatementsNotFound() *PostStatementsNotFound { return &PostStatementsNotFound{} } -/*PostStatementsNotFound handles this case with default header values. +/* PostStatementsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostStatementsNotFound struct { func (o *PostStatementsNotFound) Error() string { return fmt.Sprintf("[POST /statements][%d] postStatementsNotFound %+v", 404, o.Payload) } - func (o *PostStatementsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostStatementsInternalServerError() *PostStatementsInternalServerError { return &PostStatementsInternalServerError{} } -/*PostStatementsInternalServerError handles this case with default header values. +/* PostStatementsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostStatementsInternalServerError struct { func (o *PostStatementsInternalServerError) Error() string { return fmt.Sprintf("[POST /statements][%d] postStatementsInternalServerError %+v", 500, o.Payload) } - func (o *PostStatementsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/statements/statements_client.go b/api/sf-gate/sf_gate_client/statements/statements_client.go index 086069c..c2e2077 100644 --- a/api/sf-gate/sf_gate_client/statements/statements_client.go +++ b/api/sf-gate/sf_gate_client/statements/statements_client.go @@ -29,11 +29,14 @@ type Client struct { 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 { - GetStatements(params *GetStatementsParams, authInfo runtime.ClientAuthInfoWriter) (*GetStatementsOK, error) + GetStatements(params *GetStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStatementsOK, error) - PostStatements(params *PostStatementsParams, authInfo runtime.ClientAuthInfoWriter) (*PostStatementsOK, error) + PostStatements(params *PostStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostStatementsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { Return a list of all available Statements */ -func (a *Client) GetStatements(params *GetStatementsParams, authInfo runtime.ClientAuthInfoWriter) (*GetStatementsOK, error) { +func (a *Client) GetStatements(params *GetStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStatementsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStatementsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getStatements", Method: "GET", PathPattern: "/statements", @@ -61,7 +63,12 @@ func (a *Client) GetStatements(params *GetStatementsParams, authInfo runtime.Cli 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 } @@ -80,13 +87,12 @@ func (a *Client) GetStatements(params *GetStatementsParams, authInfo runtime.Cli Create a new Statement for a particular Account with a Date Range */ -func (a *Client) PostStatements(params *PostStatementsParams, authInfo runtime.ClientAuthInfoWriter) (*PostStatementsOK, error) { +func (a *Client) PostStatements(params *PostStatementsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostStatementsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostStatementsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postStatements", Method: "POST", PathPattern: "/statements", @@ -98,7 +104,12 @@ func (a *Client) PostStatements(params *PostStatementsParams, authInfo runtime.C 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 } diff --git a/api/sf-gate/sf_gate_client/states/get_states_parameters.go b/api/sf-gate/sf_gate_client/states/get_states_parameters.go index 5275976..a279d8d 100644 --- a/api/sf-gate/sf_gate_client/states/get_states_parameters.go +++ b/api/sf-gate/sf_gate_client/states/get_states_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetStatesParams creates a new GetStatesParams object -// with the default values initialized. +// NewGetStatesParams creates a new GetStatesParams 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 NewGetStatesParams() *GetStatesParams { - var () return &GetStatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetStatesParamsWithTimeout creates a new GetStatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStatesParamsWithTimeout(timeout time.Duration) *GetStatesParams { - var () return &GetStatesParams{ - timeout: timeout, } } // NewGetStatesParamsWithContext creates a new GetStatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStatesParamsWithContext(ctx context.Context) *GetStatesParams { - var () return &GetStatesParams{ - Context: ctx, } } // NewGetStatesParamsWithHTTPClient creates a new GetStatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStatesParamsWithHTTPClient(client *http.Client) *GetStatesParams { - var () return &GetStatesParams{ HTTPClient: client, } } -/*GetStatesParams contains all the parameters to send to the API endpoint -for the get states operation typically these are written to a http.Request +/* GetStatesParams contains all the parameters to send to the API endpoint + for the get states operation. + + Typically these are written to a http.Request. */ type GetStatesParams struct { - /*Country - The Country abbreviation (2 char) + /* Country. + The Country abbreviation (2 char) */ Country *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*StateID - The State or Province abbreviation (2 char) + /* StateID. + + The State or Province abbreviation (2 char) */ StateID *string @@ -91,6 +97,21 @@ type GetStatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesParams) WithDefaults() *GetStatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get states params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get states params func (o *GetStatesParams) WithTimeout(timeout time.Duration) *GetStatesParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetStatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // query param country var qrCountry string + if o.Country != nil { qrCountry = *o.Country } qCountry := qrCountry if qCountry != "" { + if err := r.SetQueryParam("country", qCountry); 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 o.StateID != nil { // query param stateId var qrStateID string + if o.StateID != nil { qrStateID = *o.StateID } qStateID := qrStateID if qStateID != "" { + if err := r.SetQueryParam("stateId", qStateID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/states/get_states_responses.go b/api/sf-gate/sf_gate_client/states/get_states_responses.go index 1e252b7..fe5beba 100644 --- a/api/sf-gate/sf_gate_client/states/get_states_responses.go +++ b/api/sf-gate/sf_gate_client/states/get_states_responses.go @@ -63,9 +63,8 @@ func (o *GetStatesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetStatesOK() *GetStatesOK { return &GetStatesOK{} } -/*GetStatesOK handles this case with default header values. +/* GetStatesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of State objects */ @@ -85,7 +84,6 @@ type GetStatesOK struct { func (o *GetStatesOK) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesOK %+v", 200, o.Payload) } - func (o *GetStatesOK) GetPayload() *sf_gate_models.StateResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetStatesUnauthorized() *GetStatesUnauthorized { return &GetStatesUnauthorized{} } -/*GetStatesUnauthorized handles this case with default header values. +/* GetStatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetStatesUnauthorized struct { func (o *GetStatesUnauthorized) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesUnauthorized %+v", 401, o.Payload) } - func (o *GetStatesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetStatesForbidden() *GetStatesForbidden { return &GetStatesForbidden{} } -/*GetStatesForbidden handles this case with default header values. +/* GetStatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetStatesForbidden struct { func (o *GetStatesForbidden) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesForbidden %+v", 403, o.Payload) } - func (o *GetStatesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetStatesNotFound() *GetStatesNotFound { return &GetStatesNotFound{} } -/*GetStatesNotFound handles this case with default header values. +/* GetStatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetStatesNotFound struct { func (o *GetStatesNotFound) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesNotFound %+v", 404, o.Payload) } - func (o *GetStatesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetStatesUnprocessableEntity() *GetStatesUnprocessableEntity { return &GetStatesUnprocessableEntity{} } -/*GetStatesUnprocessableEntity handles this case with default header values. +/* GetStatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetStatesUnprocessableEntity struct { func (o *GetStatesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetStatesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetStatesInternalServerError() *GetStatesInternalServerError { return &GetStatesInternalServerError{} } -/*GetStatesInternalServerError handles this case with default header values. +/* GetStatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetStatesInternalServerError struct { func (o *GetStatesInternalServerError) Error() string { return fmt.Sprintf("[GET /states][%d] getStatesInternalServerError %+v", 500, o.Payload) } - func (o *GetStatesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/states/states_client.go b/api/sf-gate/sf_gate_client/states/states_client.go index a5996b8..caf557e 100644 --- a/api/sf-gate/sf_gate_client/states/states_client.go +++ b/api/sf-gate/sf_gate_client/states/states_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetStatesOK, error) + GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStatesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Retrieve States, filter with parameters */ -func (a *Client) GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetStatesOK, error) { +func (a *Client) GetStates(params *GetStatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetStatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getStates", Method: "GET", PathPattern: "/states", @@ -59,7 +61,12 @@ func (a *Client) GetStates(params *GetStatesParams, authInfo runtime.ClientAuthI 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 } diff --git a/api/sf-gate/sf_gate_client/submissions/get_submissions_parameters.go b/api/sf-gate/sf_gate_client/submissions/get_submissions_parameters.go index c88b566..5d33c8c 100644 --- a/api/sf-gate/sf_gate_client/submissions/get_submissions_parameters.go +++ b/api/sf-gate/sf_gate_client/submissions/get_submissions_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSubmissionsParams creates a new GetSubmissionsParams object -// with the default values initialized. +// NewGetSubmissionsParams creates a new GetSubmissionsParams 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 NewGetSubmissionsParams() *GetSubmissionsParams { - var () return &GetSubmissionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetSubmissionsParamsWithTimeout creates a new GetSubmissionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSubmissionsParamsWithTimeout(timeout time.Duration) *GetSubmissionsParams { - var () return &GetSubmissionsParams{ - timeout: timeout, } } // NewGetSubmissionsParamsWithContext creates a new GetSubmissionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSubmissionsParamsWithContext(ctx context.Context) *GetSubmissionsParams { - var () return &GetSubmissionsParams{ - Context: ctx, } } // NewGetSubmissionsParamsWithHTTPClient creates a new GetSubmissionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSubmissionsParamsWithHTTPClient(client *http.Client) *GetSubmissionsParams { - var () return &GetSubmissionsParams{ HTTPClient: client, } } -/*GetSubmissionsParams contains all the parameters to send to the API endpoint -for the get submissions operation typically these are written to a http.Request +/* GetSubmissionsParams contains all the parameters to send to the API endpoint + for the get submissions operation. + + Typically these are written to a http.Request. */ type GetSubmissionsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*SubmissionID - Taxnexus Id of the Submisssion to be retrieved + /* SubmissionID. + + Taxnexus Id of the Submisssion to be retrieved */ SubmissionID *string @@ -101,6 +109,21 @@ type GetSubmissionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSubmissionsParams) WithDefaults() *GetSubmissionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSubmissionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get submissions params func (o *GetSubmissionsParams) WithTimeout(timeout time.Duration) *GetSubmissionsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetSubmissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfm // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.SubmissionID != nil { // query param submissionId var qrSubmissionID string + if o.SubmissionID != nil { qrSubmissionID = *o.SubmissionID } qSubmissionID := qrSubmissionID if qSubmissionID != "" { + if err := r.SetQueryParam("submissionId", qSubmissionID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/submissions/get_submissions_responses.go b/api/sf-gate/sf_gate_client/submissions/get_submissions_responses.go index 94796ab..1624503 100644 --- a/api/sf-gate/sf_gate_client/submissions/get_submissions_responses.go +++ b/api/sf-gate/sf_gate_client/submissions/get_submissions_responses.go @@ -63,9 +63,8 @@ func (o *GetSubmissionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetSubmissionsOK() *GetSubmissionsOK { return &GetSubmissionsOK{} } -/*GetSubmissionsOK handles this case with default header values. +/* GetSubmissionsOK describes a response with status code 200, with default header values. Taxnexus Response with Submission objects */ @@ -85,7 +84,6 @@ type GetSubmissionsOK struct { func (o *GetSubmissionsOK) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsOK %+v", 200, o.Payload) } - func (o *GetSubmissionsOK) GetPayload() *sf_gate_models.SubmissionResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetSubmissionsUnauthorized() *GetSubmissionsUnauthorized { return &GetSubmissionsUnauthorized{} } -/*GetSubmissionsUnauthorized handles this case with default header values. +/* GetSubmissionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetSubmissionsUnauthorized struct { func (o *GetSubmissionsUnauthorized) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsUnauthorized %+v", 401, o.Payload) } - func (o *GetSubmissionsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetSubmissionsForbidden() *GetSubmissionsForbidden { return &GetSubmissionsForbidden{} } -/*GetSubmissionsForbidden handles this case with default header values. +/* GetSubmissionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetSubmissionsForbidden struct { func (o *GetSubmissionsForbidden) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsForbidden %+v", 403, o.Payload) } - func (o *GetSubmissionsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetSubmissionsNotFound() *GetSubmissionsNotFound { return &GetSubmissionsNotFound{} } -/*GetSubmissionsNotFound handles this case with default header values. +/* GetSubmissionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetSubmissionsNotFound struct { func (o *GetSubmissionsNotFound) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsNotFound %+v", 404, o.Payload) } - func (o *GetSubmissionsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetSubmissionsUnprocessableEntity() *GetSubmissionsUnprocessableEntity { return &GetSubmissionsUnprocessableEntity{} } -/*GetSubmissionsUnprocessableEntity handles this case with default header values. +/* GetSubmissionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetSubmissionsUnprocessableEntity struct { func (o *GetSubmissionsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetSubmissionsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetSubmissionsInternalServerError() *GetSubmissionsInternalServerError { return &GetSubmissionsInternalServerError{} } -/*GetSubmissionsInternalServerError handles this case with default header values. +/* GetSubmissionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetSubmissionsInternalServerError struct { func (o *GetSubmissionsInternalServerError) Error() string { return fmt.Sprintf("[GET /submissions][%d] getSubmissionsInternalServerError %+v", 500, o.Payload) } - func (o *GetSubmissionsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/submissions/post_submissions_parameters.go b/api/sf-gate/sf_gate_client/submissions/post_submissions_parameters.go index 36d5b8f..5e92d3c 100644 --- a/api/sf-gate/sf_gate_client/submissions/post_submissions_parameters.go +++ b/api/sf-gate/sf_gate_client/submissions/post_submissions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostSubmissionsParams creates a new PostSubmissionsParams object -// with the default values initialized. +// NewPostSubmissionsParams creates a new PostSubmissionsParams 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 NewPostSubmissionsParams() *PostSubmissionsParams { - var () return &PostSubmissionsParams{ - timeout: cr.DefaultTimeout, } } // NewPostSubmissionsParamsWithTimeout creates a new PostSubmissionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostSubmissionsParamsWithTimeout(timeout time.Duration) *PostSubmissionsParams { - var () return &PostSubmissionsParams{ - timeout: timeout, } } // NewPostSubmissionsParamsWithContext creates a new PostSubmissionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostSubmissionsParamsWithContext(ctx context.Context) *PostSubmissionsParams { - var () return &PostSubmissionsParams{ - Context: ctx, } } // NewPostSubmissionsParamsWithHTTPClient creates a new PostSubmissionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostSubmissionsParamsWithHTTPClient(client *http.Client) *PostSubmissionsParams { - var () return &PostSubmissionsParams{ HTTPClient: client, } } -/*PostSubmissionsParams contains all the parameters to send to the API endpoint -for the post submissions operation typically these are written to a http.Request +/* PostSubmissionsParams contains all the parameters to send to the API endpoint + for the post submissions operation. + + Typically these are written to a http.Request. */ type PostSubmissionsParams struct { - /*SubmisssionsRequest - An array of new Submission records + /* SubmisssionsRequest. + An array of new Submission records */ SubmisssionsRequest *sf_gate_models.SubmissionRequest @@ -77,6 +76,21 @@ type PostSubmissionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSubmissionsParams) WithDefaults() *PostSubmissionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSubmissionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post submissions params func (o *PostSubmissionsParams) WithTimeout(timeout time.Duration) *PostSubmissionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostSubmissionsParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.SubmisssionsRequest != nil { if err := r.SetBodyParam(o.SubmisssionsRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/submissions/post_submissions_responses.go b/api/sf-gate/sf_gate_client/submissions/post_submissions_responses.go index 7f06b61..5c5b737 100644 --- a/api/sf-gate/sf_gate_client/submissions/post_submissions_responses.go +++ b/api/sf-gate/sf_gate_client/submissions/post_submissions_responses.go @@ -57,9 +57,8 @@ func (o *PostSubmissionsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostSubmissionsOK() *PostSubmissionsOK { return &PostSubmissionsOK{} } -/*PostSubmissionsOK handles this case with default header values. +/* PostSubmissionsOK describes a response with status code 200, with default header values. Taxnexus Response with Submission objects */ @@ -79,7 +78,6 @@ type PostSubmissionsOK struct { func (o *PostSubmissionsOK) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsOK %+v", 200, o.Payload) } - func (o *PostSubmissionsOK) GetPayload() *sf_gate_models.SubmissionResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostSubmissionsUnauthorized() *PostSubmissionsUnauthorized { return &PostSubmissionsUnauthorized{} } -/*PostSubmissionsUnauthorized handles this case with default header values. +/* PostSubmissionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostSubmissionsUnauthorized struct { func (o *PostSubmissionsUnauthorized) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsUnauthorized %+v", 401, o.Payload) } - func (o *PostSubmissionsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostSubmissionsForbidden() *PostSubmissionsForbidden { return &PostSubmissionsForbidden{} } -/*PostSubmissionsForbidden handles this case with default header values. +/* PostSubmissionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostSubmissionsForbidden struct { func (o *PostSubmissionsForbidden) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsForbidden %+v", 403, o.Payload) } - func (o *PostSubmissionsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostSubmissionsNotFound() *PostSubmissionsNotFound { return &PostSubmissionsNotFound{} } -/*PostSubmissionsNotFound handles this case with default header values. +/* PostSubmissionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostSubmissionsNotFound struct { func (o *PostSubmissionsNotFound) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsNotFound %+v", 404, o.Payload) } - func (o *PostSubmissionsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostSubmissionsInternalServerError() *PostSubmissionsInternalServerError return &PostSubmissionsInternalServerError{} } -/*PostSubmissionsInternalServerError handles this case with default header values. +/* PostSubmissionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostSubmissionsInternalServerError struct { func (o *PostSubmissionsInternalServerError) Error() string { return fmt.Sprintf("[POST /submissions][%d] postSubmissionsInternalServerError %+v", 500, o.Payload) } - func (o *PostSubmissionsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/submissions/put_submissions_parameters.go b/api/sf-gate/sf_gate_client/submissions/put_submissions_parameters.go index 248f1fe..a1cc48c 100644 --- a/api/sf-gate/sf_gate_client/submissions/put_submissions_parameters.go +++ b/api/sf-gate/sf_gate_client/submissions/put_submissions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutSubmissionsParams creates a new PutSubmissionsParams object -// with the default values initialized. +// NewPutSubmissionsParams creates a new PutSubmissionsParams 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 NewPutSubmissionsParams() *PutSubmissionsParams { - var () return &PutSubmissionsParams{ - timeout: cr.DefaultTimeout, } } // NewPutSubmissionsParamsWithTimeout creates a new PutSubmissionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutSubmissionsParamsWithTimeout(timeout time.Duration) *PutSubmissionsParams { - var () return &PutSubmissionsParams{ - timeout: timeout, } } // NewPutSubmissionsParamsWithContext creates a new PutSubmissionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutSubmissionsParamsWithContext(ctx context.Context) *PutSubmissionsParams { - var () return &PutSubmissionsParams{ - Context: ctx, } } // NewPutSubmissionsParamsWithHTTPClient creates a new PutSubmissionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutSubmissionsParamsWithHTTPClient(client *http.Client) *PutSubmissionsParams { - var () return &PutSubmissionsParams{ HTTPClient: client, } } -/*PutSubmissionsParams contains all the parameters to send to the API endpoint -for the put submissions operation typically these are written to a http.Request +/* PutSubmissionsParams contains all the parameters to send to the API endpoint + for the put submissions operation. + + Typically these are written to a http.Request. */ type PutSubmissionsParams struct { - /*SubmisssionsRequest - An array of new Submission records + /* SubmisssionsRequest. + An array of new Submission records */ SubmisssionsRequest *sf_gate_models.SubmissionRequest @@ -77,6 +76,21 @@ type PutSubmissionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSubmissionsParams) WithDefaults() *PutSubmissionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put submissions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSubmissionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put submissions params func (o *PutSubmissionsParams) WithTimeout(timeout time.Duration) *PutSubmissionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutSubmissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.SubmisssionsRequest != nil { if err := r.SetBodyParam(o.SubmisssionsRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/submissions/put_submissions_responses.go b/api/sf-gate/sf_gate_client/submissions/put_submissions_responses.go index 6683f8b..6af18dc 100644 --- a/api/sf-gate/sf_gate_client/submissions/put_submissions_responses.go +++ b/api/sf-gate/sf_gate_client/submissions/put_submissions_responses.go @@ -57,9 +57,8 @@ func (o *PutSubmissionsReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutSubmissionsOK() *PutSubmissionsOK { return &PutSubmissionsOK{} } -/*PutSubmissionsOK handles this case with default header values. +/* PutSubmissionsOK describes a response with status code 200, with default header values. Taxnexus Response with Submission objects */ @@ -79,7 +78,6 @@ type PutSubmissionsOK struct { func (o *PutSubmissionsOK) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsOK %+v", 200, o.Payload) } - func (o *PutSubmissionsOK) GetPayload() *sf_gate_models.SubmissionResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutSubmissionsUnauthorized() *PutSubmissionsUnauthorized { return &PutSubmissionsUnauthorized{} } -/*PutSubmissionsUnauthorized handles this case with default header values. +/* PutSubmissionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutSubmissionsUnauthorized struct { func (o *PutSubmissionsUnauthorized) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsUnauthorized %+v", 401, o.Payload) } - func (o *PutSubmissionsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutSubmissionsForbidden() *PutSubmissionsForbidden { return &PutSubmissionsForbidden{} } -/*PutSubmissionsForbidden handles this case with default header values. +/* PutSubmissionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutSubmissionsForbidden struct { func (o *PutSubmissionsForbidden) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsForbidden %+v", 403, o.Payload) } - func (o *PutSubmissionsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutSubmissionsNotFound() *PutSubmissionsNotFound { return &PutSubmissionsNotFound{} } -/*PutSubmissionsNotFound handles this case with default header values. +/* PutSubmissionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutSubmissionsNotFound struct { func (o *PutSubmissionsNotFound) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsNotFound %+v", 404, o.Payload) } - func (o *PutSubmissionsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutSubmissionsInternalServerError() *PutSubmissionsInternalServerError { return &PutSubmissionsInternalServerError{} } -/*PutSubmissionsInternalServerError handles this case with default header values. +/* PutSubmissionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutSubmissionsInternalServerError struct { func (o *PutSubmissionsInternalServerError) Error() string { return fmt.Sprintf("[PUT /submissions][%d] putSubmissionsInternalServerError %+v", 500, o.Payload) } - func (o *PutSubmissionsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/submissions/submissions_client.go b/api/sf-gate/sf_gate_client/submissions/submissions_client.go index a13c9ae..33eb5b3 100644 --- a/api/sf-gate/sf_gate_client/submissions/submissions_client.go +++ b/api/sf-gate/sf_gate_client/submissions/submissions_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubmissionsOK, error) + GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSubmissionsOK, error) - PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubmissionsOK, error) + PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSubmissionsOK, error) - PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubmissionsOK, error) + PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSubmissionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Submissions */ -func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubmissionsOK, error) { +func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSubmissionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSubmissionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSubmissions", Method: "GET", PathPattern: "/submissions", @@ -63,7 +65,12 @@ func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.C 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 } @@ -82,13 +89,12 @@ func (a *Client) GetSubmissions(params *GetSubmissionsParams, authInfo runtime.C Create new Sumissions */ -func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubmissionsOK, error) { +func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSubmissionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostSubmissionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postSubmissions", Method: "POST", PathPattern: "/submissions", @@ -100,7 +106,12 @@ func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime 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 } @@ -119,13 +130,12 @@ func (a *Client) PostSubmissions(params *PostSubmissionsParams, authInfo runtime Update all the fields in a Submission record identified by Taxnexus Id */ -func (a *Client) PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubmissionsOK, error) { +func (a *Client) PutSubmissions(params *PutSubmissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSubmissionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutSubmissionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putSubmissions", Method: "PUT", PathPattern: "/submissions", @@ -137,7 +147,12 @@ func (a *Client) PutSubmissions(params *PutSubmissionsParams, authInfo runtime.C 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 } diff --git a/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_parameters.go b/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_parameters.go index e27f0a2..2ee5a92 100644 --- a/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_parameters.go +++ b/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_parameters.go @@ -21,78 +21,86 @@ import ( "github.com/go-openapi/swag" ) -// NewGetSubscriptionsParams creates a new GetSubscriptionsParams object -// with the default values initialized. +// NewGetSubscriptionsParams creates a new GetSubscriptionsParams 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 NewGetSubscriptionsParams() *GetSubscriptionsParams { - var () return &GetSubscriptionsParams{ - timeout: cr.DefaultTimeout, } } // NewGetSubscriptionsParamsWithTimeout creates a new GetSubscriptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetSubscriptionsParamsWithTimeout(timeout time.Duration) *GetSubscriptionsParams { - var () return &GetSubscriptionsParams{ - timeout: timeout, } } // NewGetSubscriptionsParamsWithContext creates a new GetSubscriptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetSubscriptionsParamsWithContext(ctx context.Context) *GetSubscriptionsParams { - var () return &GetSubscriptionsParams{ - Context: ctx, } } // NewGetSubscriptionsParamsWithHTTPClient creates a new GetSubscriptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetSubscriptionsParamsWithHTTPClient(client *http.Client) *GetSubscriptionsParams { - var () return &GetSubscriptionsParams{ HTTPClient: client, } } -/*GetSubscriptionsParams contains all the parameters to send to the API endpoint -for the get subscriptions operation typically these are written to a http.Request +/* GetSubscriptionsParams contains all the parameters to send to the API endpoint + for the get subscriptions operation. + + Typically these are written to a http.Request. */ type GetSubscriptionsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*SubscriptionID - Taxnexus Id of the Subscription to be retrieved + /* SubscriptionID. + + Taxnexus Id of the Subscription to be retrieved */ SubscriptionID *string @@ -101,6 +109,21 @@ type GetSubscriptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get subscriptions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSubscriptionsParams) WithDefaults() *GetSubscriptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get subscriptions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetSubscriptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get subscriptions params func (o *GetSubscriptionsParams) WithTimeout(timeout time.Duration) *GetSubscriptionsParams { o.SetTimeout(timeout) @@ -212,96 +235,102 @@ func (o *GetSubscriptionsParams) WriteToRequest(r runtime.ClientRequest, reg str // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.CompanyID != nil { // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.SubscriptionID != nil { // query param subscriptionId var qrSubscriptionID string + if o.SubscriptionID != nil { qrSubscriptionID = *o.SubscriptionID } qSubscriptionID := qrSubscriptionID if qSubscriptionID != "" { + if err := r.SetQueryParam("subscriptionId", qSubscriptionID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_responses.go b/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_responses.go index bbf18f6..a3de569 100644 --- a/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_responses.go +++ b/api/sf-gate/sf_gate_client/subscriptions/get_subscriptions_responses.go @@ -63,9 +63,8 @@ func (o *GetSubscriptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetSubscriptionsOK() *GetSubscriptionsOK { return &GetSubscriptionsOK{} } -/*GetSubscriptionsOK handles this case with default header values. +/* GetSubscriptionsOK describes a response with status code 200, with default header values. An array of Subscription Objects */ @@ -85,7 +84,6 @@ type GetSubscriptionsOK struct { func (o *GetSubscriptionsOK) Error() string { return fmt.Sprintf("[GET /subscriptions][%d] getSubscriptionsOK %+v", 200, o.Payload) } - func (o *GetSubscriptionsOK) GetPayload() *sf_gate_models.SubscriptionResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetSubscriptionsUnauthorized() *GetSubscriptionsUnauthorized { return &GetSubscriptionsUnauthorized{} } -/*GetSubscriptionsUnauthorized handles this case with default header values. +/* GetSubscriptionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetSubscriptionsUnauthorized struct { func (o *GetSubscriptionsUnauthorized) Error() string { return fmt.Sprintf("[GET /subscriptions][%d] getSubscriptionsUnauthorized %+v", 401, o.Payload) } - func (o *GetSubscriptionsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetSubscriptionsForbidden() *GetSubscriptionsForbidden { return &GetSubscriptionsForbidden{} } -/*GetSubscriptionsForbidden handles this case with default header values. +/* GetSubscriptionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetSubscriptionsForbidden struct { func (o *GetSubscriptionsForbidden) Error() string { return fmt.Sprintf("[GET /subscriptions][%d] getSubscriptionsForbidden %+v", 403, o.Payload) } - func (o *GetSubscriptionsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetSubscriptionsNotFound() *GetSubscriptionsNotFound { return &GetSubscriptionsNotFound{} } -/*GetSubscriptionsNotFound handles this case with default header values. +/* GetSubscriptionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetSubscriptionsNotFound struct { func (o *GetSubscriptionsNotFound) Error() string { return fmt.Sprintf("[GET /subscriptions][%d] getSubscriptionsNotFound %+v", 404, o.Payload) } - func (o *GetSubscriptionsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetSubscriptionsUnprocessableEntity() *GetSubscriptionsUnprocessableEnti return &GetSubscriptionsUnprocessableEntity{} } -/*GetSubscriptionsUnprocessableEntity handles this case with default header values. +/* GetSubscriptionsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetSubscriptionsUnprocessableEntity struct { func (o *GetSubscriptionsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /subscriptions][%d] getSubscriptionsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetSubscriptionsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetSubscriptionsInternalServerError() *GetSubscriptionsInternalServerErr return &GetSubscriptionsInternalServerError{} } -/*GetSubscriptionsInternalServerError handles this case with default header values. +/* GetSubscriptionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetSubscriptionsInternalServerError struct { func (o *GetSubscriptionsInternalServerError) Error() string { return fmt.Sprintf("[GET /subscriptions][%d] getSubscriptionsInternalServerError %+v", 500, o.Payload) } - func (o *GetSubscriptionsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_parameters.go b/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_parameters.go index 1cd12aa..dd7ebbe 100644 --- a/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_parameters.go +++ b/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostSubscriptionsParams creates a new PostSubscriptionsParams object -// with the default values initialized. +// NewPostSubscriptionsParams creates a new PostSubscriptionsParams 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 NewPostSubscriptionsParams() *PostSubscriptionsParams { - var () return &PostSubscriptionsParams{ - timeout: cr.DefaultTimeout, } } // NewPostSubscriptionsParamsWithTimeout creates a new PostSubscriptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostSubscriptionsParamsWithTimeout(timeout time.Duration) *PostSubscriptionsParams { - var () return &PostSubscriptionsParams{ - timeout: timeout, } } // NewPostSubscriptionsParamsWithContext creates a new PostSubscriptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostSubscriptionsParamsWithContext(ctx context.Context) *PostSubscriptionsParams { - var () return &PostSubscriptionsParams{ - Context: ctx, } } // NewPostSubscriptionsParamsWithHTTPClient creates a new PostSubscriptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostSubscriptionsParamsWithHTTPClient(client *http.Client) *PostSubscriptionsParams { - var () return &PostSubscriptionsParams{ HTTPClient: client, } } -/*PostSubscriptionsParams contains all the parameters to send to the API endpoint -for the post subscriptions operation typically these are written to a http.Request +/* PostSubscriptionsParams contains all the parameters to send to the API endpoint + for the post subscriptions operation. + + Typically these are written to a http.Request. */ type PostSubscriptionsParams struct { - /*SubscriptionRequest - A request with an array of Subscription Objects + /* SubscriptionRequest. + A request with an array of Subscription Objects */ SubscriptionRequest *sf_gate_models.SubscriptionRequest @@ -77,6 +76,21 @@ type PostSubscriptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post subscriptions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSubscriptionsParams) WithDefaults() *PostSubscriptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post subscriptions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostSubscriptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post subscriptions params func (o *PostSubscriptionsParams) WithTimeout(timeout time.Duration) *PostSubscriptionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostSubscriptionsParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.SubscriptionRequest != nil { if err := r.SetBodyParam(o.SubscriptionRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_responses.go b/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_responses.go index 0c77258..821230e 100644 --- a/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_responses.go +++ b/api/sf-gate/sf_gate_client/subscriptions/post_subscriptions_responses.go @@ -57,9 +57,8 @@ func (o *PostSubscriptionsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostSubscriptionsOK() *PostSubscriptionsOK { return &PostSubscriptionsOK{} } -/*PostSubscriptionsOK handles this case with default header values. +/* PostSubscriptionsOK describes a response with status code 200, with default header values. An array of Subscription Objects */ @@ -79,7 +78,6 @@ type PostSubscriptionsOK struct { func (o *PostSubscriptionsOK) Error() string { return fmt.Sprintf("[POST /subscriptions][%d] postSubscriptionsOK %+v", 200, o.Payload) } - func (o *PostSubscriptionsOK) GetPayload() *sf_gate_models.SubscriptionResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostSubscriptionsUnauthorized() *PostSubscriptionsUnauthorized { return &PostSubscriptionsUnauthorized{} } -/*PostSubscriptionsUnauthorized handles this case with default header values. +/* PostSubscriptionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostSubscriptionsUnauthorized struct { func (o *PostSubscriptionsUnauthorized) Error() string { return fmt.Sprintf("[POST /subscriptions][%d] postSubscriptionsUnauthorized %+v", 401, o.Payload) } - func (o *PostSubscriptionsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostSubscriptionsForbidden() *PostSubscriptionsForbidden { return &PostSubscriptionsForbidden{} } -/*PostSubscriptionsForbidden handles this case with default header values. +/* PostSubscriptionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostSubscriptionsForbidden struct { func (o *PostSubscriptionsForbidden) Error() string { return fmt.Sprintf("[POST /subscriptions][%d] postSubscriptionsForbidden %+v", 403, o.Payload) } - func (o *PostSubscriptionsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostSubscriptionsNotFound() *PostSubscriptionsNotFound { return &PostSubscriptionsNotFound{} } -/*PostSubscriptionsNotFound handles this case with default header values. +/* PostSubscriptionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostSubscriptionsNotFound struct { func (o *PostSubscriptionsNotFound) Error() string { return fmt.Sprintf("[POST /subscriptions][%d] postSubscriptionsNotFound %+v", 404, o.Payload) } - func (o *PostSubscriptionsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostSubscriptionsInternalServerError() *PostSubscriptionsInternalServerE return &PostSubscriptionsInternalServerError{} } -/*PostSubscriptionsInternalServerError handles this case with default header values. +/* PostSubscriptionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostSubscriptionsInternalServerError struct { func (o *PostSubscriptionsInternalServerError) Error() string { return fmt.Sprintf("[POST /subscriptions][%d] postSubscriptionsInternalServerError %+v", 500, o.Payload) } - func (o *PostSubscriptionsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_parameters.go b/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_parameters.go index fdc2884..8217ba2 100644 --- a/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_parameters.go +++ b/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutSubscriptionsParams creates a new PutSubscriptionsParams object -// with the default values initialized. +// NewPutSubscriptionsParams creates a new PutSubscriptionsParams 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 NewPutSubscriptionsParams() *PutSubscriptionsParams { - var () return &PutSubscriptionsParams{ - timeout: cr.DefaultTimeout, } } // NewPutSubscriptionsParamsWithTimeout creates a new PutSubscriptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutSubscriptionsParamsWithTimeout(timeout time.Duration) *PutSubscriptionsParams { - var () return &PutSubscriptionsParams{ - timeout: timeout, } } // NewPutSubscriptionsParamsWithContext creates a new PutSubscriptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutSubscriptionsParamsWithContext(ctx context.Context) *PutSubscriptionsParams { - var () return &PutSubscriptionsParams{ - Context: ctx, } } // NewPutSubscriptionsParamsWithHTTPClient creates a new PutSubscriptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutSubscriptionsParamsWithHTTPClient(client *http.Client) *PutSubscriptionsParams { - var () return &PutSubscriptionsParams{ HTTPClient: client, } } -/*PutSubscriptionsParams contains all the parameters to send to the API endpoint -for the put subscriptions operation typically these are written to a http.Request +/* PutSubscriptionsParams contains all the parameters to send to the API endpoint + for the put subscriptions operation. + + Typically these are written to a http.Request. */ type PutSubscriptionsParams struct { - /*SubscriptionRequest - A request with an array of Subscription Objects + /* SubscriptionRequest. + A request with an array of Subscription Objects */ SubscriptionRequest *sf_gate_models.SubscriptionRequest @@ -77,6 +76,21 @@ type PutSubscriptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put subscriptions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSubscriptionsParams) WithDefaults() *PutSubscriptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put subscriptions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutSubscriptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put subscriptions params func (o *PutSubscriptionsParams) WithTimeout(timeout time.Duration) *PutSubscriptionsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutSubscriptionsParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.SubscriptionRequest != nil { if err := r.SetBodyParam(o.SubscriptionRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_responses.go b/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_responses.go index 0902194..8cb15c5 100644 --- a/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_responses.go +++ b/api/sf-gate/sf_gate_client/subscriptions/put_subscriptions_responses.go @@ -57,9 +57,8 @@ func (o *PutSubscriptionsReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutSubscriptionsOK() *PutSubscriptionsOK { return &PutSubscriptionsOK{} } -/*PutSubscriptionsOK handles this case with default header values. +/* PutSubscriptionsOK describes a response with status code 200, with default header values. An array of Subscription Objects */ @@ -79,7 +78,6 @@ type PutSubscriptionsOK struct { func (o *PutSubscriptionsOK) Error() string { return fmt.Sprintf("[PUT /subscriptions][%d] putSubscriptionsOK %+v", 200, o.Payload) } - func (o *PutSubscriptionsOK) GetPayload() *sf_gate_models.SubscriptionResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutSubscriptionsUnauthorized() *PutSubscriptionsUnauthorized { return &PutSubscriptionsUnauthorized{} } -/*PutSubscriptionsUnauthorized handles this case with default header values. +/* PutSubscriptionsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutSubscriptionsUnauthorized struct { func (o *PutSubscriptionsUnauthorized) Error() string { return fmt.Sprintf("[PUT /subscriptions][%d] putSubscriptionsUnauthorized %+v", 401, o.Payload) } - func (o *PutSubscriptionsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutSubscriptionsForbidden() *PutSubscriptionsForbidden { return &PutSubscriptionsForbidden{} } -/*PutSubscriptionsForbidden handles this case with default header values. +/* PutSubscriptionsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutSubscriptionsForbidden struct { func (o *PutSubscriptionsForbidden) Error() string { return fmt.Sprintf("[PUT /subscriptions][%d] putSubscriptionsForbidden %+v", 403, o.Payload) } - func (o *PutSubscriptionsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutSubscriptionsNotFound() *PutSubscriptionsNotFound { return &PutSubscriptionsNotFound{} } -/*PutSubscriptionsNotFound handles this case with default header values. +/* PutSubscriptionsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutSubscriptionsNotFound struct { func (o *PutSubscriptionsNotFound) Error() string { return fmt.Sprintf("[PUT /subscriptions][%d] putSubscriptionsNotFound %+v", 404, o.Payload) } - func (o *PutSubscriptionsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutSubscriptionsInternalServerError() *PutSubscriptionsInternalServerErr return &PutSubscriptionsInternalServerError{} } -/*PutSubscriptionsInternalServerError handles this case with default header values. +/* PutSubscriptionsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutSubscriptionsInternalServerError struct { func (o *PutSubscriptionsInternalServerError) Error() string { return fmt.Sprintf("[PUT /subscriptions][%d] putSubscriptionsInternalServerError %+v", 500, o.Payload) } - func (o *PutSubscriptionsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/subscriptions/subscriptions_client.go b/api/sf-gate/sf_gate_client/subscriptions/subscriptions_client.go index ee4852c..fe3229e 100644 --- a/api/sf-gate/sf_gate_client/subscriptions/subscriptions_client.go +++ b/api/sf-gate/sf_gate_client/subscriptions/subscriptions_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetSubscriptions(params *GetSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubscriptionsOK, error) + GetSubscriptions(params *GetSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSubscriptionsOK, error) - PostSubscriptions(params *PostSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubscriptionsOK, error) + PostSubscriptions(params *PostSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSubscriptionsOK, error) - PutSubscriptions(params *PutSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubscriptionsOK, error) + PutSubscriptions(params *PutSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSubscriptionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of available Subscriptions */ -func (a *Client) GetSubscriptions(params *GetSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetSubscriptionsOK, error) { +func (a *Client) GetSubscriptions(params *GetSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSubscriptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetSubscriptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getSubscriptions", Method: "GET", PathPattern: "/subscriptions", @@ -63,7 +65,12 @@ func (a *Client) GetSubscriptions(params *GetSubscriptionsParams, authInfo runti 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 } @@ -82,13 +89,12 @@ func (a *Client) GetSubscriptions(params *GetSubscriptionsParams, authInfo runti Create new Sumissions */ -func (a *Client) PostSubscriptions(params *PostSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubscriptionsOK, error) { +func (a *Client) PostSubscriptions(params *PostSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostSubscriptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostSubscriptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postSubscriptions", Method: "POST", PathPattern: "/subscriptions", @@ -100,7 +106,12 @@ func (a *Client) PostSubscriptions(params *PostSubscriptionsParams, authInfo run 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 } @@ -119,13 +130,12 @@ func (a *Client) PostSubscriptions(params *PostSubscriptionsParams, authInfo run Update all the fields in a Subscription record identified by Taxnexus Id */ -func (a *Client) PutSubscriptions(params *PutSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubscriptionsOK, error) { +func (a *Client) PutSubscriptions(params *PutSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutSubscriptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutSubscriptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putSubscriptions", Method: "PUT", PathPattern: "/subscriptions", @@ -137,7 +147,12 @@ func (a *Client) PutSubscriptions(params *PutSubscriptionsParams, authInfo runti 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 } diff --git a/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_parameters.go b/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_parameters.go index de94970..562ae9a 100644 --- a/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_parameters.go +++ b/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_parameters.go @@ -21,93 +21,104 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTaxTypeAccountsParams creates a new GetTaxTypeAccountsParams object -// with the default values initialized. +// NewGetTaxTypeAccountsParams creates a new GetTaxTypeAccountsParams 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 NewGetTaxTypeAccountsParams() *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxTypeAccountsParamsWithTimeout creates a new GetTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxTypeAccountsParamsWithTimeout(timeout time.Duration) *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ - timeout: timeout, } } // NewGetTaxTypeAccountsParamsWithContext creates a new GetTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxTypeAccountsParamsWithContext(ctx context.Context) *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ - Context: ctx, } } // NewGetTaxTypeAccountsParamsWithHTTPClient creates a new GetTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxTypeAccountsParamsWithHTTPClient(client *http.Client) *GetTaxTypeAccountsParams { - var () return &GetTaxTypeAccountsParams{ HTTPClient: client, } } -/*GetTaxTypeAccountsParams contains all the parameters to send to the API endpoint -for the get tax type accounts operation typically these are written to a http.Request +/* GetTaxTypeAccountsParams contains all the parameters to send to the API endpoint + for the get tax type accounts operation. + + Typically these are written to a http.Request. */ type GetTaxTypeAccountsParams struct { - /*AccountID - Taxnexus Id of the Account to be used a record retrieval + /* AccountID. + Taxnexus Id of the Account to be used a record retrieval */ AccountID *string - /*Active - Retrieve only active records? + /* Active. + + Retrieve only active records? */ Active *bool - /*Country - The Country abbreviation (2 char) + /* Country. + + The Country abbreviation (2 char) */ Country *string - /*County - The County Name + /* County. + + The County Name */ County *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*Place - The City name (must be accompanied by State) + /* Place. + + The City name (must be accompanied by State) */ Place *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string - /*TaxtypeaccountID - Taxnexus Id of the Tax Type Account to be retrieved + /* TaxtypeaccountID. + + Taxnexus Id of the Tax Type Account to be retrieved */ TaxtypeaccountID *string @@ -116,6 +127,21 @@ type GetTaxTypeAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypeAccountsParams) WithDefaults() *GetTaxTypeAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypeAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax type accounts params func (o *GetTaxTypeAccountsParams) WithTimeout(timeout time.Duration) *GetTaxTypeAccountsParams { o.SetTimeout(timeout) @@ -260,144 +286,153 @@ func (o *GetTaxTypeAccountsParams) WriteToRequest(r runtime.ClientRequest, reg s // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Active != nil { // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.Country != nil { // query param country var qrCountry string + if o.Country != nil { qrCountry = *o.Country } qCountry := qrCountry if qCountry != "" { + if err := r.SetQueryParam("country", qCountry); err != nil { return err } } - } if o.County != nil { // query param county var qrCounty string + if o.County != nil { qrCounty = *o.County } qCounty := qrCounty if qCounty != "" { + if err := r.SetQueryParam("county", qCounty); 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 o.Place != nil { // query param place var qrPlace string + if o.Place != nil { qrPlace = *o.Place } qPlace := qrPlace if qPlace != "" { + if err := r.SetQueryParam("place", qPlace); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if o.TaxtypeaccountID != nil { // query param taxtypeaccountId var qrTaxtypeaccountID string + if o.TaxtypeaccountID != nil { qrTaxtypeaccountID = *o.TaxtypeaccountID } qTaxtypeaccountID := qrTaxtypeaccountID if qTaxtypeaccountID != "" { + if err := r.SetQueryParam("taxtypeaccountId", qTaxtypeaccountID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_responses.go b/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_responses.go index 06e3d53..49c9d35 100644 --- a/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_responses.go +++ b/api/sf-gate/sf_gate_client/tax_type_accounts/get_tax_type_accounts_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxTypeAccountsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetTaxTypeAccountsOK() *GetTaxTypeAccountsOK { return &GetTaxTypeAccountsOK{} } -/*GetTaxTypeAccountsOK handles this case with default header values. +/* GetTaxTypeAccountsOK describes a response with status code 200, with default header values. An array of TaxTypeAccount objects */ @@ -85,7 +84,6 @@ type GetTaxTypeAccountsOK struct { func (o *GetTaxTypeAccountsOK) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsOK %+v", 200, o.Payload) } - func (o *GetTaxTypeAccountsOK) GetPayload() *sf_gate_models.TaxTypeAccountResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetTaxTypeAccountsUnauthorized() *GetTaxTypeAccountsUnauthorized { return &GetTaxTypeAccountsUnauthorized{} } -/*GetTaxTypeAccountsUnauthorized handles this case with default header values. +/* GetTaxTypeAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetTaxTypeAccountsUnauthorized struct { func (o *GetTaxTypeAccountsUnauthorized) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxTypeAccountsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetTaxTypeAccountsForbidden() *GetTaxTypeAccountsForbidden { return &GetTaxTypeAccountsForbidden{} } -/*GetTaxTypeAccountsForbidden handles this case with default header values. +/* GetTaxTypeAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetTaxTypeAccountsForbidden struct { func (o *GetTaxTypeAccountsForbidden) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsForbidden %+v", 403, o.Payload) } - func (o *GetTaxTypeAccountsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetTaxTypeAccountsNotFound() *GetTaxTypeAccountsNotFound { return &GetTaxTypeAccountsNotFound{} } -/*GetTaxTypeAccountsNotFound handles this case with default header values. +/* GetTaxTypeAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetTaxTypeAccountsNotFound struct { func (o *GetTaxTypeAccountsNotFound) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsNotFound %+v", 404, o.Payload) } - func (o *GetTaxTypeAccountsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetTaxTypeAccountsUnprocessableEntity() *GetTaxTypeAccountsUnprocessable return &GetTaxTypeAccountsUnprocessableEntity{} } -/*GetTaxTypeAccountsUnprocessableEntity handles this case with default header values. +/* GetTaxTypeAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetTaxTypeAccountsUnprocessableEntity struct { func (o *GetTaxTypeAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxTypeAccountsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetTaxTypeAccountsInternalServerError() *GetTaxTypeAccountsInternalServe return &GetTaxTypeAccountsInternalServerError{} } -/*GetTaxTypeAccountsInternalServerError handles this case with default header values. +/* GetTaxTypeAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetTaxTypeAccountsInternalServerError struct { func (o *GetTaxTypeAccountsInternalServerError) Error() string { return fmt.Sprintf("[GET /taxtypeaccounts][%d] getTaxTypeAccountsInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxTypeAccountsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_parameters.go b/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_parameters.go index 15210ee..ef6f653 100644 --- a/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_parameters.go +++ b/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPostTaxTypeAccountsParams creates a new PostTaxTypeAccountsParams object -// with the default values initialized. +// NewPostTaxTypeAccountsParams creates a new PostTaxTypeAccountsParams 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 NewPostTaxTypeAccountsParams() *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPostTaxTypeAccountsParamsWithTimeout creates a new PostTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTaxTypeAccountsParamsWithTimeout(timeout time.Duration) *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ - timeout: timeout, } } // NewPostTaxTypeAccountsParamsWithContext creates a new PostTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTaxTypeAccountsParamsWithContext(ctx context.Context) *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ - Context: ctx, } } // NewPostTaxTypeAccountsParamsWithHTTPClient creates a new PostTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTaxTypeAccountsParamsWithHTTPClient(client *http.Client) *PostTaxTypeAccountsParams { - var () return &PostTaxTypeAccountsParams{ HTTPClient: client, } } -/*PostTaxTypeAccountsParams contains all the parameters to send to the API endpoint -for the post tax type accounts operation typically these are written to a http.Request +/* PostTaxTypeAccountsParams contains all the parameters to send to the API endpoint + for the post tax type accounts operation. + + Typically these are written to a http.Request. */ type PostTaxTypeAccountsParams struct { - /*Taxtypeaccount - The new Tax Type Account + /* Taxtypeaccount. + The new Tax Type Account */ Taxtypeaccount *sf_gate_models.TaxTypeAccountRequest @@ -77,6 +76,21 @@ type PostTaxTypeAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxTypeAccountsParams) WithDefaults() *PostTaxTypeAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTaxTypeAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post tax type accounts params func (o *PostTaxTypeAccountsParams) WithTimeout(timeout time.Duration) *PostTaxTypeAccountsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostTaxTypeAccountsParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.Taxtypeaccount != nil { if err := r.SetBodyParam(o.Taxtypeaccount); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_responses.go b/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_responses.go index fd95782..5b2d9f9 100644 --- a/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_responses.go +++ b/api/sf-gate/sf_gate_client/tax_type_accounts/post_tax_type_accounts_responses.go @@ -57,9 +57,8 @@ func (o *PostTaxTypeAccountsReader) ReadResponse(response runtime.ClientResponse return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPostTaxTypeAccountsOK() *PostTaxTypeAccountsOK { return &PostTaxTypeAccountsOK{} } -/*PostTaxTypeAccountsOK handles this case with default header values. +/* PostTaxTypeAccountsOK describes a response with status code 200, with default header values. An array of TaxTypeAccount objects */ @@ -79,7 +78,6 @@ type PostTaxTypeAccountsOK struct { func (o *PostTaxTypeAccountsOK) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsOK %+v", 200, o.Payload) } - func (o *PostTaxTypeAccountsOK) GetPayload() *sf_gate_models.TaxTypeAccountResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPostTaxTypeAccountsUnauthorized() *PostTaxTypeAccountsUnauthorized { return &PostTaxTypeAccountsUnauthorized{} } -/*PostTaxTypeAccountsUnauthorized handles this case with default header values. +/* PostTaxTypeAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PostTaxTypeAccountsUnauthorized struct { func (o *PostTaxTypeAccountsUnauthorized) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsUnauthorized %+v", 401, o.Payload) } - func (o *PostTaxTypeAccountsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPostTaxTypeAccountsForbidden() *PostTaxTypeAccountsForbidden { return &PostTaxTypeAccountsForbidden{} } -/*PostTaxTypeAccountsForbidden handles this case with default header values. +/* PostTaxTypeAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PostTaxTypeAccountsForbidden struct { func (o *PostTaxTypeAccountsForbidden) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsForbidden %+v", 403, o.Payload) } - func (o *PostTaxTypeAccountsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPostTaxTypeAccountsNotFound() *PostTaxTypeAccountsNotFound { return &PostTaxTypeAccountsNotFound{} } -/*PostTaxTypeAccountsNotFound handles this case with default header values. +/* PostTaxTypeAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PostTaxTypeAccountsNotFound struct { func (o *PostTaxTypeAccountsNotFound) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsNotFound %+v", 404, o.Payload) } - func (o *PostTaxTypeAccountsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPostTaxTypeAccountsInternalServerError() *PostTaxTypeAccountsInternalSer return &PostTaxTypeAccountsInternalServerError{} } -/*PostTaxTypeAccountsInternalServerError handles this case with default header values. +/* PostTaxTypeAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PostTaxTypeAccountsInternalServerError struct { func (o *PostTaxTypeAccountsInternalServerError) Error() string { return fmt.Sprintf("[POST /taxtypeaccounts][%d] postTaxTypeAccountsInternalServerError %+v", 500, o.Payload) } - func (o *PostTaxTypeAccountsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_parameters.go b/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_parameters.go index bf07d64..a77357b 100644 --- a/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_parameters.go +++ b/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_parameters.go @@ -22,51 +22,50 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutTaxTypeAccountsParams creates a new PutTaxTypeAccountsParams object -// with the default values initialized. +// NewPutTaxTypeAccountsParams creates a new PutTaxTypeAccountsParams 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 NewPutTaxTypeAccountsParams() *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPutTaxTypeAccountsParamsWithTimeout creates a new PutTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutTaxTypeAccountsParamsWithTimeout(timeout time.Duration) *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ - timeout: timeout, } } // NewPutTaxTypeAccountsParamsWithContext creates a new PutTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutTaxTypeAccountsParamsWithContext(ctx context.Context) *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ - Context: ctx, } } // NewPutTaxTypeAccountsParamsWithHTTPClient creates a new PutTaxTypeAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutTaxTypeAccountsParamsWithHTTPClient(client *http.Client) *PutTaxTypeAccountsParams { - var () return &PutTaxTypeAccountsParams{ HTTPClient: client, } } -/*PutTaxTypeAccountsParams contains all the parameters to send to the API endpoint -for the put tax type accounts operation typically these are written to a http.Request +/* PutTaxTypeAccountsParams contains all the parameters to send to the API endpoint + for the put tax type accounts operation. + + Typically these are written to a http.Request. */ type PutTaxTypeAccountsParams struct { - /*Taxtypeaccount*/ + // Taxtypeaccount. Taxtypeaccount *sf_gate_models.TaxTypeAccountRequest timeout time.Duration @@ -74,6 +73,21 @@ type PutTaxTypeAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTaxTypeAccountsParams) WithDefaults() *PutTaxTypeAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put tax type accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTaxTypeAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put tax type accounts params func (o *PutTaxTypeAccountsParams) WithTimeout(timeout time.Duration) *PutTaxTypeAccountsParams { o.SetTimeout(timeout) @@ -125,7 +139,6 @@ func (o *PutTaxTypeAccountsParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if o.Taxtypeaccount != nil { if err := r.SetBodyParam(o.Taxtypeaccount); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_responses.go b/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_responses.go index d7ecd39..27644ba 100644 --- a/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_responses.go +++ b/api/sf-gate/sf_gate_client/tax_type_accounts/put_tax_type_accounts_responses.go @@ -57,9 +57,8 @@ func (o *PutTaxTypeAccountsReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -68,7 +67,7 @@ func NewPutTaxTypeAccountsOK() *PutTaxTypeAccountsOK { return &PutTaxTypeAccountsOK{} } -/*PutTaxTypeAccountsOK handles this case with default header values. +/* PutTaxTypeAccountsOK describes a response with status code 200, with default header values. An array of TaxTypeAccount objects */ @@ -79,7 +78,6 @@ type PutTaxTypeAccountsOK struct { func (o *PutTaxTypeAccountsOK) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsOK %+v", 200, o.Payload) } - func (o *PutTaxTypeAccountsOK) GetPayload() *sf_gate_models.TaxTypeAccountResponse { return o.Payload } @@ -101,7 +99,7 @@ func NewPutTaxTypeAccountsUnauthorized() *PutTaxTypeAccountsUnauthorized { return &PutTaxTypeAccountsUnauthorized{} } -/*PutTaxTypeAccountsUnauthorized handles this case with default header values. +/* PutTaxTypeAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -112,7 +110,6 @@ type PutTaxTypeAccountsUnauthorized struct { func (o *PutTaxTypeAccountsUnauthorized) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsUnauthorized %+v", 401, o.Payload) } - func (o *PutTaxTypeAccountsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -134,7 +131,7 @@ func NewPutTaxTypeAccountsForbidden() *PutTaxTypeAccountsForbidden { return &PutTaxTypeAccountsForbidden{} } -/*PutTaxTypeAccountsForbidden handles this case with default header values. +/* PutTaxTypeAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -145,7 +142,6 @@ type PutTaxTypeAccountsForbidden struct { func (o *PutTaxTypeAccountsForbidden) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsForbidden %+v", 403, o.Payload) } - func (o *PutTaxTypeAccountsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -167,7 +163,7 @@ func NewPutTaxTypeAccountsNotFound() *PutTaxTypeAccountsNotFound { return &PutTaxTypeAccountsNotFound{} } -/*PutTaxTypeAccountsNotFound handles this case with default header values. +/* PutTaxTypeAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -178,7 +174,6 @@ type PutTaxTypeAccountsNotFound struct { func (o *PutTaxTypeAccountsNotFound) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsNotFound %+v", 404, o.Payload) } - func (o *PutTaxTypeAccountsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -200,7 +195,7 @@ func NewPutTaxTypeAccountsInternalServerError() *PutTaxTypeAccountsInternalServe return &PutTaxTypeAccountsInternalServerError{} } -/*PutTaxTypeAccountsInternalServerError handles this case with default header values. +/* PutTaxTypeAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -211,7 +206,6 @@ type PutTaxTypeAccountsInternalServerError struct { func (o *PutTaxTypeAccountsInternalServerError) Error() string { return fmt.Sprintf("[PUT /taxtypeaccounts][%d] putTaxTypeAccountsInternalServerError %+v", 500, o.Payload) } - func (o *PutTaxTypeAccountsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/tax_type_accounts/tax_type_accounts_client.go b/api/sf-gate/sf_gate_client/tax_type_accounts/tax_type_accounts_client.go index 483f133..38fc69e 100644 --- a/api/sf-gate/sf_gate_client/tax_type_accounts/tax_type_accounts_client.go +++ b/api/sf-gate/sf_gate_client/tax_type_accounts/tax_type_accounts_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypeAccountsOK, error) + GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypeAccountsOK, error) - PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxTypeAccountsOK, error) + PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxTypeAccountsOK, error) - PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTaxTypeAccountsOK, error) + PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTaxTypeAccountsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Return a list of Tax Type Accounts */ -func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypeAccountsOK, error) { +func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypeAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxTypeAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxTypeAccounts", Method: "GET", PathPattern: "/taxtypeaccounts", @@ -63,7 +65,12 @@ func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo r 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 } @@ -82,13 +89,12 @@ func (a *Client) GetTaxTypeAccounts(params *GetTaxTypeAccountsParams, authInfo r Create a new Tax Type Account */ -func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostTaxTypeAccountsOK, error) { +func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostTaxTypeAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTaxTypeAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postTaxTypeAccounts", Method: "POST", PathPattern: "/taxtypeaccounts", @@ -100,7 +106,12 @@ func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo 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 } @@ -119,13 +130,12 @@ func (a *Client) PostTaxTypeAccounts(params *PostTaxTypeAccountsParams, authInfo Update a TaxTypeAccount */ -func (a *Client) PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTaxTypeAccountsOK, error) { +func (a *Client) PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTaxTypeAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutTaxTypeAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putTaxTypeAccounts", Method: "PUT", PathPattern: "/taxtypeaccounts", @@ -137,7 +147,12 @@ func (a *Client) PutTaxTypeAccounts(params *PutTaxTypeAccountsParams, authInfo r 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 } diff --git a/api/sf-gate/sf_gate_client/tax_types/get_tax_types_parameters.go b/api/sf-gate/sf_gate_client/tax_types/get_tax_types_parameters.go index 4f81dec..6de9a05 100644 --- a/api/sf-gate/sf_gate_client/tax_types/get_tax_types_parameters.go +++ b/api/sf-gate/sf_gate_client/tax_types/get_tax_types_parameters.go @@ -21,93 +21,104 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTaxTypesParams creates a new GetTaxTypesParams object -// with the default values initialized. +// NewGetTaxTypesParams creates a new GetTaxTypesParams 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 NewGetTaxTypesParams() *GetTaxTypesParams { - var () return &GetTaxTypesParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxTypesParamsWithTimeout creates a new GetTaxTypesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxTypesParamsWithTimeout(timeout time.Duration) *GetTaxTypesParams { - var () return &GetTaxTypesParams{ - timeout: timeout, } } // NewGetTaxTypesParamsWithContext creates a new GetTaxTypesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxTypesParamsWithContext(ctx context.Context) *GetTaxTypesParams { - var () return &GetTaxTypesParams{ - Context: ctx, } } // NewGetTaxTypesParamsWithHTTPClient creates a new GetTaxTypesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxTypesParamsWithHTTPClient(client *http.Client) *GetTaxTypesParams { - var () return &GetTaxTypesParams{ HTTPClient: client, } } -/*GetTaxTypesParams contains all the parameters to send to the API endpoint -for the get tax types operation typically these are written to a http.Request +/* GetTaxTypesParams contains all the parameters to send to the API endpoint + for the get tax types operation. + + Typically these are written to a http.Request. */ type GetTaxTypesParams struct { - /*Active - Retrieve only active records? + /* Active. + Retrieve only active records? */ Active *bool - /*Address - Postal Address URL encoded; partial addresses allowed + /* Address. + + Postal Address URL encoded; partial addresses allowed */ Address *string - /*Country - The Country abbreviation (2 char) + /* Country. + + The Country abbreviation (2 char) */ Country *string - /*County - The County Name + /* County. + + The County Name */ County *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*Place - The City name (must be accompanied by State) + /* Place. + + The City name (must be accompanied by State) */ Place *string - /*State - The State or Province abbreviation (2 char) + /* State. + + The State or Province abbreviation (2 char) */ State *string - /*TaxtypeID - Taxnexus Id of the Tax Type to be retrieved + /* TaxtypeID. + + Taxnexus Id of the Tax Type to be retrieved */ TaxtypeID *string @@ -116,6 +127,21 @@ type GetTaxTypesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tax types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesParams) WithDefaults() *GetTaxTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tax types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxTypesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tax types params func (o *GetTaxTypesParams) WithTimeout(timeout time.Duration) *GetTaxTypesParams { o.SetTimeout(timeout) @@ -260,144 +286,153 @@ func (o *GetTaxTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.Address != nil { // query param address var qrAddress string + if o.Address != nil { qrAddress = *o.Address } qAddress := qrAddress if qAddress != "" { + if err := r.SetQueryParam("address", qAddress); err != nil { return err } } - } if o.Country != nil { // query param country var qrCountry string + if o.Country != nil { qrCountry = *o.Country } qCountry := qrCountry if qCountry != "" { + if err := r.SetQueryParam("country", qCountry); err != nil { return err } } - } if o.County != nil { // query param county var qrCounty string + if o.County != nil { qrCounty = *o.County } qCounty := qrCounty if qCounty != "" { + if err := r.SetQueryParam("county", qCounty); 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 o.Place != nil { // query param place var qrPlace string + if o.Place != nil { qrPlace = *o.Place } qPlace := qrPlace if qPlace != "" { + if err := r.SetQueryParam("place", qPlace); err != nil { return err } } - } if o.State != nil { // query param state var qrState string + if o.State != nil { qrState = *o.State } qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } } - } if o.TaxtypeID != nil { // query param taxtypeId var qrTaxtypeID string + if o.TaxtypeID != nil { qrTaxtypeID = *o.TaxtypeID } qTaxtypeID := qrTaxtypeID if qTaxtypeID != "" { + if err := r.SetQueryParam("taxtypeId", qTaxtypeID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/tax_types/get_tax_types_responses.go b/api/sf-gate/sf_gate_client/tax_types/get_tax_types_responses.go index 3dcdf71..9beab91 100644 --- a/api/sf-gate/sf_gate_client/tax_types/get_tax_types_responses.go +++ b/api/sf-gate/sf_gate_client/tax_types/get_tax_types_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxTypesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetTaxTypesOK() *GetTaxTypesOK { return &GetTaxTypesOK{} } -/*GetTaxTypesOK handles this case with default header values. +/* GetTaxTypesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Tax Type objects */ @@ -85,7 +84,6 @@ type GetTaxTypesOK struct { func (o *GetTaxTypesOK) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesOK %+v", 200, o.Payload) } - func (o *GetTaxTypesOK) GetPayload() *sf_gate_models.TaxTypeResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetTaxTypesUnauthorized() *GetTaxTypesUnauthorized { return &GetTaxTypesUnauthorized{} } -/*GetTaxTypesUnauthorized handles this case with default header values. +/* GetTaxTypesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetTaxTypesUnauthorized struct { func (o *GetTaxTypesUnauthorized) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxTypesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetTaxTypesForbidden() *GetTaxTypesForbidden { return &GetTaxTypesForbidden{} } -/*GetTaxTypesForbidden handles this case with default header values. +/* GetTaxTypesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetTaxTypesForbidden struct { func (o *GetTaxTypesForbidden) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesForbidden %+v", 403, o.Payload) } - func (o *GetTaxTypesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetTaxTypesNotFound() *GetTaxTypesNotFound { return &GetTaxTypesNotFound{} } -/*GetTaxTypesNotFound handles this case with default header values. +/* GetTaxTypesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetTaxTypesNotFound struct { func (o *GetTaxTypesNotFound) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesNotFound %+v", 404, o.Payload) } - func (o *GetTaxTypesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetTaxTypesUnprocessableEntity() *GetTaxTypesUnprocessableEntity { return &GetTaxTypesUnprocessableEntity{} } -/*GetTaxTypesUnprocessableEntity handles this case with default header values. +/* GetTaxTypesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetTaxTypesUnprocessableEntity struct { func (o *GetTaxTypesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxTypesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetTaxTypesInternalServerError() *GetTaxTypesInternalServerError { return &GetTaxTypesInternalServerError{} } -/*GetTaxTypesInternalServerError handles this case with default header values. +/* GetTaxTypesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetTaxTypesInternalServerError struct { func (o *GetTaxTypesInternalServerError) Error() string { return fmt.Sprintf("[GET /taxtypes][%d] getTaxTypesInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxTypesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/tax_types/tax_types_client.go b/api/sf-gate/sf_gate_client/tax_types/tax_types_client.go index fe0b2b2..d74b500 100644 --- a/api/sf-gate/sf_gate_client/tax_types/tax_types_client.go +++ b/api/sf-gate/sf_gate_client/tax_types/tax_types_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypesOK, error) + GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a complete list of all the tax types handled by Taxnexus; use the lat long parameters to retrieve a Situs lookup */ -func (a *Client) GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxTypesOK, error) { +func (a *Client) GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxTypesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxTypesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxTypes", Method: "GET", PathPattern: "/taxtypes", @@ -59,7 +61,12 @@ func (a *Client) GetTaxTypes(params *GetTaxTypesParams, authInfo runtime.ClientA 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 } diff --git a/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_parameters.go b/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_parameters.go index dce4b12..1b2e53e 100644 --- a/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_parameters.go +++ b/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTaxnexusCodesParams creates a new GetTaxnexusCodesParams object -// with the default values initialized. +// NewGetTaxnexusCodesParams creates a new GetTaxnexusCodesParams 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 NewGetTaxnexusCodesParams() *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ - timeout: cr.DefaultTimeout, } } // NewGetTaxnexusCodesParamsWithTimeout creates a new GetTaxnexusCodesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTaxnexusCodesParamsWithTimeout(timeout time.Duration) *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ - timeout: timeout, } } // NewGetTaxnexusCodesParamsWithContext creates a new GetTaxnexusCodesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTaxnexusCodesParamsWithContext(ctx context.Context) *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ - Context: ctx, } } // NewGetTaxnexusCodesParamsWithHTTPClient creates a new GetTaxnexusCodesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTaxnexusCodesParamsWithHTTPClient(client *http.Client) *GetTaxnexusCodesParams { - var () return &GetTaxnexusCodesParams{ HTTPClient: client, } } -/*GetTaxnexusCodesParams contains all the parameters to send to the API endpoint -for the get taxnexus codes operation typically these are written to a http.Request +/* GetTaxnexusCodesParams contains all the parameters to send to the API endpoint + for the get taxnexus codes operation. + + Typically these are written to a http.Request. */ type GetTaxnexusCodesParams struct { - /*Active - Retrieve only active records? + /* Active. + Retrieve only active records? */ Active *bool - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TaxnexuscodeID - Taxnexus Id of the Taxnexus Code to be retrieved + /* TaxnexuscodeID. + + Taxnexus Id of the Taxnexus Code to be retrieved */ TaxnexuscodeID *string @@ -91,6 +97,21 @@ type GetTaxnexusCodesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get taxnexus codes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesParams) WithDefaults() *GetTaxnexusCodesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get taxnexus codes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTaxnexusCodesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get taxnexus codes params func (o *GetTaxnexusCodesParams) WithTimeout(timeout time.Duration) *GetTaxnexusCodesParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetTaxnexusCodesParams) WriteToRequest(r runtime.ClientRequest, reg str // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.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 o.TaxnexuscodeID != nil { // query param taxnexuscodeId var qrTaxnexuscodeID string + if o.TaxnexuscodeID != nil { qrTaxnexuscodeID = *o.TaxnexuscodeID } qTaxnexuscodeID := qrTaxnexuscodeID if qTaxnexuscodeID != "" { + if err := r.SetQueryParam("taxnexuscodeId", qTaxnexuscodeID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_responses.go b/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_responses.go index 2e0448d..6a6c15c 100644 --- a/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_responses.go +++ b/api/sf-gate/sf_gate_client/taxnexus_codes/get_taxnexus_codes_responses.go @@ -63,9 +63,8 @@ func (o *GetTaxnexusCodesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetTaxnexusCodesOK() *GetTaxnexusCodesOK { return &GetTaxnexusCodesOK{} } -/*GetTaxnexusCodesOK handles this case with default header values. +/* GetTaxnexusCodesOK describes a response with status code 200, with default header values. Taxnexus Response with an array of Taxnexus Code objects */ @@ -85,7 +84,6 @@ type GetTaxnexusCodesOK struct { func (o *GetTaxnexusCodesOK) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesOK %+v", 200, o.Payload) } - func (o *GetTaxnexusCodesOK) GetPayload() *sf_gate_models.TaxnexusCodeResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetTaxnexusCodesUnauthorized() *GetTaxnexusCodesUnauthorized { return &GetTaxnexusCodesUnauthorized{} } -/*GetTaxnexusCodesUnauthorized handles this case with default header values. +/* GetTaxnexusCodesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetTaxnexusCodesUnauthorized struct { func (o *GetTaxnexusCodesUnauthorized) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesUnauthorized %+v", 401, o.Payload) } - func (o *GetTaxnexusCodesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetTaxnexusCodesForbidden() *GetTaxnexusCodesForbidden { return &GetTaxnexusCodesForbidden{} } -/*GetTaxnexusCodesForbidden handles this case with default header values. +/* GetTaxnexusCodesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetTaxnexusCodesForbidden struct { func (o *GetTaxnexusCodesForbidden) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesForbidden %+v", 403, o.Payload) } - func (o *GetTaxnexusCodesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetTaxnexusCodesNotFound() *GetTaxnexusCodesNotFound { return &GetTaxnexusCodesNotFound{} } -/*GetTaxnexusCodesNotFound handles this case with default header values. +/* GetTaxnexusCodesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetTaxnexusCodesNotFound struct { func (o *GetTaxnexusCodesNotFound) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesNotFound %+v", 404, o.Payload) } - func (o *GetTaxnexusCodesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetTaxnexusCodesUnprocessableEntity() *GetTaxnexusCodesUnprocessableEnti return &GetTaxnexusCodesUnprocessableEntity{} } -/*GetTaxnexusCodesUnprocessableEntity handles this case with default header values. +/* GetTaxnexusCodesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetTaxnexusCodesUnprocessableEntity struct { func (o *GetTaxnexusCodesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTaxnexusCodesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetTaxnexusCodesInternalServerError() *GetTaxnexusCodesInternalServerErr return &GetTaxnexusCodesInternalServerError{} } -/*GetTaxnexusCodesInternalServerError handles this case with default header values. +/* GetTaxnexusCodesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetTaxnexusCodesInternalServerError struct { func (o *GetTaxnexusCodesInternalServerError) Error() string { return fmt.Sprintf("[GET /taxnexuscodes][%d] getTaxnexusCodesInternalServerError %+v", 500, o.Payload) } - func (o *GetTaxnexusCodesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/taxnexus_codes/taxnexus_codes_client.go b/api/sf-gate/sf_gate_client/taxnexus_codes/taxnexus_codes_client.go index 9ed17f8..4c8ae7f 100644 --- a/api/sf-gate/sf_gate_client/taxnexus_codes/taxnexus_codes_client.go +++ b/api/sf-gate/sf_gate_client/taxnexus_codes/taxnexus_codes_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxnexusCodesOK, error) + GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxnexusCodesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of TaxnexusCodes */ -func (a *Client) GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTaxnexusCodesOK, error) { +func (a *Client) GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTaxnexusCodesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTaxnexusCodesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTaxnexusCodes", Method: "GET", PathPattern: "/taxnexuscodes", @@ -59,7 +61,12 @@ func (a *Client) GetTaxnexusCodes(params *GetTaxnexusCodesParams, authInfo runti 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 } diff --git a/api/sf-gate/sf_gate_client/templates/get_templates_parameters.go b/api/sf-gate/sf_gate_client/templates/get_templates_parameters.go index b0a45d5..7af3ba1 100644 --- a/api/sf-gate/sf_gate_client/templates/get_templates_parameters.go +++ b/api/sf-gate/sf_gate_client/templates/get_templates_parameters.go @@ -21,63 +21,68 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTemplatesParams creates a new GetTemplatesParams object -// with the default values initialized. +// NewGetTemplatesParams creates a new GetTemplatesParams 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 NewGetTemplatesParams() *GetTemplatesParams { - var () return &GetTemplatesParams{ - timeout: cr.DefaultTimeout, } } // NewGetTemplatesParamsWithTimeout creates a new GetTemplatesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTemplatesParamsWithTimeout(timeout time.Duration) *GetTemplatesParams { - var () return &GetTemplatesParams{ - timeout: timeout, } } // NewGetTemplatesParamsWithContext creates a new GetTemplatesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTemplatesParamsWithContext(ctx context.Context) *GetTemplatesParams { - var () return &GetTemplatesParams{ - Context: ctx, } } // NewGetTemplatesParamsWithHTTPClient creates a new GetTemplatesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTemplatesParamsWithHTTPClient(client *http.Client) *GetTemplatesParams { - var () return &GetTemplatesParams{ HTTPClient: client, } } -/*GetTemplatesParams contains all the parameters to send to the API endpoint -for the get templates operation typically these are written to a http.Request +/* GetTemplatesParams contains all the parameters to send to the API endpoint + for the get templates operation. + + Typically these are written to a http.Request. */ type GetTemplatesParams struct { - /*Limit - How many objects to return at one time + /* Limit. + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TemplateID - Taxnexus Record Id of a Template + /* TemplateID. + + Taxnexus Record Id of a Template */ TemplateID *string @@ -86,6 +91,21 @@ type GetTemplatesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplatesParams) WithDefaults() *GetTemplatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTemplatesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get templates params func (o *GetTemplatesParams) WithTimeout(timeout time.Duration) *GetTemplatesParams { o.SetTimeout(timeout) @@ -164,48 +184,51 @@ func (o *GetTemplatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. // 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 o.TemplateID != nil { // query param templateId var qrTemplateID string + if o.TemplateID != nil { qrTemplateID = *o.TemplateID } qTemplateID := qrTemplateID if qTemplateID != "" { + if err := r.SetQueryParam("templateId", qTemplateID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/templates/get_templates_responses.go b/api/sf-gate/sf_gate_client/templates/get_templates_responses.go index f33fc8d..46b88c3 100644 --- a/api/sf-gate/sf_gate_client/templates/get_templates_responses.go +++ b/api/sf-gate/sf_gate_client/templates/get_templates_responses.go @@ -63,9 +63,8 @@ func (o *GetTemplatesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetTemplatesOK() *GetTemplatesOK { return &GetTemplatesOK{} } -/*GetTemplatesOK handles this case with default header values. +/* GetTemplatesOK describes a response with status code 200, with default header values. Taxnexus Response with Template objects */ @@ -85,7 +84,6 @@ type GetTemplatesOK struct { func (o *GetTemplatesOK) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesOK %+v", 200, o.Payload) } - func (o *GetTemplatesOK) GetPayload() *sf_gate_models.TemplateResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetTemplatesUnauthorized() *GetTemplatesUnauthorized { return &GetTemplatesUnauthorized{} } -/*GetTemplatesUnauthorized handles this case with default header values. +/* GetTemplatesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetTemplatesUnauthorized struct { func (o *GetTemplatesUnauthorized) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesUnauthorized %+v", 401, o.Payload) } - func (o *GetTemplatesUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetTemplatesForbidden() *GetTemplatesForbidden { return &GetTemplatesForbidden{} } -/*GetTemplatesForbidden handles this case with default header values. +/* GetTemplatesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetTemplatesForbidden struct { func (o *GetTemplatesForbidden) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesForbidden %+v", 403, o.Payload) } - func (o *GetTemplatesForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetTemplatesNotFound() *GetTemplatesNotFound { return &GetTemplatesNotFound{} } -/*GetTemplatesNotFound handles this case with default header values. +/* GetTemplatesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetTemplatesNotFound struct { func (o *GetTemplatesNotFound) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesNotFound %+v", 404, o.Payload) } - func (o *GetTemplatesNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetTemplatesUnprocessableEntity() *GetTemplatesUnprocessableEntity { return &GetTemplatesUnprocessableEntity{} } -/*GetTemplatesUnprocessableEntity handles this case with default header values. +/* GetTemplatesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetTemplatesUnprocessableEntity struct { func (o *GetTemplatesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTemplatesUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetTemplatesInternalServerError() *GetTemplatesInternalServerError { return &GetTemplatesInternalServerError{} } -/*GetTemplatesInternalServerError handles this case with default header values. +/* GetTemplatesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetTemplatesInternalServerError struct { func (o *GetTemplatesInternalServerError) Error() string { return fmt.Sprintf("[GET /templates][%d] getTemplatesInternalServerError %+v", 500, o.Payload) } - func (o *GetTemplatesInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/templates/templates_client.go b/api/sf-gate/sf_gate_client/templates/templates_client.go index 42a994a..4abd982 100644 --- a/api/sf-gate/sf_gate_client/templates/templates_client.go +++ b/api/sf-gate/sf_gate_client/templates/templates_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplatesOK, error) + GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplatesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Returns the PDF rendering template, or a link to where to get the template */ -func (a *Client) GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetTemplatesOK, error) { +func (a *Client) GetTemplates(params *GetTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTemplatesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTemplatesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTemplates", Method: "GET", PathPattern: "/templates", @@ -59,7 +61,12 @@ func (a *Client) GetTemplates(params *GetTemplatesParams, authInfo runtime.Clien 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 } diff --git a/api/sf-gate/sf_gate_client/tenants/get_tenants_parameters.go b/api/sf-gate/sf_gate_client/tenants/get_tenants_parameters.go index cdaccae..bd53fda 100644 --- a/api/sf-gate/sf_gate_client/tenants/get_tenants_parameters.go +++ b/api/sf-gate/sf_gate_client/tenants/get_tenants_parameters.go @@ -21,68 +21,74 @@ import ( "github.com/go-openapi/swag" ) -// NewGetTenantsParams creates a new GetTenantsParams object -// with the default values initialized. +// NewGetTenantsParams creates a new GetTenantsParams 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 NewGetTenantsParams() *GetTenantsParams { - var () return &GetTenantsParams{ - timeout: cr.DefaultTimeout, } } // NewGetTenantsParamsWithTimeout creates a new GetTenantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTenantsParamsWithTimeout(timeout time.Duration) *GetTenantsParams { - var () return &GetTenantsParams{ - timeout: timeout, } } // NewGetTenantsParamsWithContext creates a new GetTenantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTenantsParamsWithContext(ctx context.Context) *GetTenantsParams { - var () return &GetTenantsParams{ - Context: ctx, } } // NewGetTenantsParamsWithHTTPClient creates a new GetTenantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTenantsParamsWithHTTPClient(client *http.Client) *GetTenantsParams { - var () return &GetTenantsParams{ HTTPClient: client, } } -/*GetTenantsParams contains all the parameters to send to the API endpoint -for the get tenants operation typically these are written to a http.Request +/* GetTenantsParams contains all the parameters to send to the API endpoint + for the get tenants operation. + + Typically these are written to a http.Request. */ type GetTenantsParams struct { - /*CompanyID - Taxnexus Id of the Company to be retrieved + /* CompanyID. + Taxnexus Id of the Company to be retrieved */ CompanyID *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*TenantID - Taxnexus Record Id of a Tenant + /* TenantID. + + Taxnexus Record Id of a Tenant */ TenantID *string @@ -91,6 +97,21 @@ type GetTenantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantsParams) WithDefaults() *GetTenantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTenantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get tenants params func (o *GetTenantsParams) WithTimeout(timeout time.Duration) *GetTenantsParams { o.SetTimeout(timeout) @@ -180,64 +201,68 @@ func (o *GetTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re // query param companyId var qrCompanyID string + if o.CompanyID != nil { qrCompanyID = *o.CompanyID } qCompanyID := qrCompanyID if qCompanyID != "" { + if err := r.SetQueryParam("companyId", qCompanyID); err != nil { return err } } - } if 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 o.TenantID != nil { // query param tenantId var qrTenantID string + if o.TenantID != nil { qrTenantID = *o.TenantID } qTenantID := qrTenantID if qTenantID != "" { + if err := r.SetQueryParam("tenantId", qTenantID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/tenants/get_tenants_responses.go b/api/sf-gate/sf_gate_client/tenants/get_tenants_responses.go index 8324f05..75d5aa1 100644 --- a/api/sf-gate/sf_gate_client/tenants/get_tenants_responses.go +++ b/api/sf-gate/sf_gate_client/tenants/get_tenants_responses.go @@ -63,9 +63,8 @@ func (o *GetTenantsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetTenantsOK() *GetTenantsOK { return &GetTenantsOK{} } -/*GetTenantsOK handles this case with default header values. +/* GetTenantsOK describes a response with status code 200, with default header values. Taxnexus Response with Tenant objects */ @@ -85,7 +84,6 @@ type GetTenantsOK struct { func (o *GetTenantsOK) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsOK %+v", 200, o.Payload) } - func (o *GetTenantsOK) GetPayload() *sf_gate_models.TenantResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetTenantsUnauthorized() *GetTenantsUnauthorized { return &GetTenantsUnauthorized{} } -/*GetTenantsUnauthorized handles this case with default header values. +/* GetTenantsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetTenantsUnauthorized struct { func (o *GetTenantsUnauthorized) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsUnauthorized %+v", 401, o.Payload) } - func (o *GetTenantsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetTenantsForbidden() *GetTenantsForbidden { return &GetTenantsForbidden{} } -/*GetTenantsForbidden handles this case with default header values. +/* GetTenantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetTenantsForbidden struct { func (o *GetTenantsForbidden) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsForbidden %+v", 403, o.Payload) } - func (o *GetTenantsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetTenantsNotFound() *GetTenantsNotFound { return &GetTenantsNotFound{} } -/*GetTenantsNotFound handles this case with default header values. +/* GetTenantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetTenantsNotFound struct { func (o *GetTenantsNotFound) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsNotFound %+v", 404, o.Payload) } - func (o *GetTenantsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetTenantsUnprocessableEntity() *GetTenantsUnprocessableEntity { return &GetTenantsUnprocessableEntity{} } -/*GetTenantsUnprocessableEntity handles this case with default header values. +/* GetTenantsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetTenantsUnprocessableEntity struct { func (o *GetTenantsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetTenantsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetTenantsInternalServerError() *GetTenantsInternalServerError { return &GetTenantsInternalServerError{} } -/*GetTenantsInternalServerError handles this case with default header values. +/* GetTenantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetTenantsInternalServerError struct { func (o *GetTenantsInternalServerError) Error() string { return fmt.Sprintf("[GET /tenants][%d] getTenantsInternalServerError %+v", 500, o.Payload) } - func (o *GetTenantsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/tenants/put_tenants_parameters.go b/api/sf-gate/sf_gate_client/tenants/put_tenants_parameters.go index 33fbbe5..7e05e68 100644 --- a/api/sf-gate/sf_gate_client/tenants/put_tenants_parameters.go +++ b/api/sf-gate/sf_gate_client/tenants/put_tenants_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewPutTenantsParams creates a new PutTenantsParams object -// with the default values initialized. +// NewPutTenantsParams creates a new PutTenantsParams 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 NewPutTenantsParams() *PutTenantsParams { - var () return &PutTenantsParams{ - timeout: cr.DefaultTimeout, } } // NewPutTenantsParamsWithTimeout creates a new PutTenantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutTenantsParamsWithTimeout(timeout time.Duration) *PutTenantsParams { - var () return &PutTenantsParams{ - timeout: timeout, } } // NewPutTenantsParamsWithContext creates a new PutTenantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutTenantsParamsWithContext(ctx context.Context) *PutTenantsParams { - var () return &PutTenantsParams{ - Context: ctx, } } // NewPutTenantsParamsWithHTTPClient creates a new PutTenantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutTenantsParamsWithHTTPClient(client *http.Client) *PutTenantsParams { - var () return &PutTenantsParams{ HTTPClient: client, } } -/*PutTenantsParams contains all the parameters to send to the API endpoint -for the put tenants operation typically these are written to a http.Request +/* PutTenantsParams contains all the parameters to send to the API endpoint + for the put tenants operation. + + Typically these are written to a http.Request. */ type PutTenantsParams struct { - /*CTenantRequest - An array of Tenant records + /* CTenantRequest. + An array of Tenant records */ CTenantRequest *sf_gate_models.TenantRequest @@ -77,6 +76,21 @@ type PutTenantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTenantsParams) WithDefaults() *PutTenantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutTenantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put tenants params func (o *PutTenantsParams) WithTimeout(timeout time.Duration) *PutTenantsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PutTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.CTenantRequest != nil { if err := r.SetBodyParam(o.CTenantRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/tenants/put_tenants_responses.go b/api/sf-gate/sf_gate_client/tenants/put_tenants_responses.go index b0d5a6a..10dced5 100644 --- a/api/sf-gate/sf_gate_client/tenants/put_tenants_responses.go +++ b/api/sf-gate/sf_gate_client/tenants/put_tenants_responses.go @@ -63,9 +63,8 @@ func (o *PutTenantsReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPutTenantsOK() *PutTenantsOK { return &PutTenantsOK{} } -/*PutTenantsOK handles this case with default header values. +/* PutTenantsOK describes a response with status code 200, with default header values. Taxnexus Response with Tenant objects */ @@ -85,7 +84,6 @@ type PutTenantsOK struct { func (o *PutTenantsOK) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsOK %+v", 200, o.Payload) } - func (o *PutTenantsOK) GetPayload() *sf_gate_models.TenantResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPutTenantsUnauthorized() *PutTenantsUnauthorized { return &PutTenantsUnauthorized{} } -/*PutTenantsUnauthorized handles this case with default header values. +/* PutTenantsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PutTenantsUnauthorized struct { func (o *PutTenantsUnauthorized) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsUnauthorized %+v", 401, o.Payload) } - func (o *PutTenantsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPutTenantsForbidden() *PutTenantsForbidden { return &PutTenantsForbidden{} } -/*PutTenantsForbidden handles this case with default header values. +/* PutTenantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PutTenantsForbidden struct { func (o *PutTenantsForbidden) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsForbidden %+v", 403, o.Payload) } - func (o *PutTenantsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPutTenantsNotFound() *PutTenantsNotFound { return &PutTenantsNotFound{} } -/*PutTenantsNotFound handles this case with default header values. +/* PutTenantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PutTenantsNotFound struct { func (o *PutTenantsNotFound) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsNotFound %+v", 404, o.Payload) } - func (o *PutTenantsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPutTenantsUnprocessableEntity() *PutTenantsUnprocessableEntity { return &PutTenantsUnprocessableEntity{} } -/*PutTenantsUnprocessableEntity handles this case with default header values. +/* PutTenantsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PutTenantsUnprocessableEntity struct { func (o *PutTenantsUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PutTenantsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPutTenantsInternalServerError() *PutTenantsInternalServerError { return &PutTenantsInternalServerError{} } -/*PutTenantsInternalServerError handles this case with default header values. +/* PutTenantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PutTenantsInternalServerError struct { func (o *PutTenantsInternalServerError) Error() string { return fmt.Sprintf("[PUT /tenants][%d] putTenantsInternalServerError %+v", 500, o.Payload) } - func (o *PutTenantsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/tenants/tenants_client.go b/api/sf-gate/sf_gate_client/tenants/tenants_client.go index 81e1c29..09a4992 100644 --- a/api/sf-gate/sf_gate_client/tenants/tenants_client.go +++ b/api/sf-gate/sf_gate_client/tenants/tenants_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - Tenants(params *TenantsParams, authInfo runtime.ClientAuthInfoWriter) (*TenantsOK, error) + Tenants(params *TenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantsOK, error) - GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantsOK, error) + GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantsOK, error) - PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTenantsOK, error) + PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTenantsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -45,13 +48,12 @@ type ClientService interface { Create Tenants in Taxnexus */ -func (a *Client) Tenants(params *TenantsParams, authInfo runtime.ClientAuthInfoWriter) (*TenantsOK, error) { +func (a *Client) Tenants(params *TenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewTenantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "Tenants", Method: "POST", PathPattern: "/tenants", @@ -63,7 +65,12 @@ func (a *Client) Tenants(params *TenantsParams, authInfo runtime.ClientAuthInfoW 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 } @@ -82,13 +89,12 @@ func (a *Client) Tenants(params *TenantsParams, authInfo runtime.ClientAuthInfoW Return a list of Tenant records from the datastore */ -func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTenantsOK, error) { +func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTenantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTenantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getTenants", Method: "GET", PathPattern: "/tenants", @@ -100,7 +106,12 @@ func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAut 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 } @@ -119,13 +130,12 @@ func (a *Client) GetTenants(params *GetTenantsParams, authInfo runtime.ClientAut Update Tenant in Taxnexus */ -func (a *Client) PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutTenantsOK, error) { +func (a *Client) PutTenants(params *PutTenantsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutTenantsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutTenantsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "putTenants", Method: "PUT", PathPattern: "/tenants", @@ -137,7 +147,12 @@ func (a *Client) PutTenants(params *PutTenantsParams, authInfo runtime.ClientAut 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 } diff --git a/api/sf-gate/sf_gate_client/tenants/tenants_parameters.go b/api/sf-gate/sf_gate_client/tenants/tenants_parameters.go index 11128c1..7cdee59 100644 --- a/api/sf-gate/sf_gate_client/tenants/tenants_parameters.go +++ b/api/sf-gate/sf_gate_client/tenants/tenants_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/sf-gate/sf_gate_models" ) -// NewTenantsParams creates a new TenantsParams object -// with the default values initialized. +// NewTenantsParams creates a new TenantsParams 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 NewTenantsParams() *TenantsParams { - var () return &TenantsParams{ - timeout: cr.DefaultTimeout, } } // NewTenantsParamsWithTimeout creates a new TenantsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewTenantsParamsWithTimeout(timeout time.Duration) *TenantsParams { - var () return &TenantsParams{ - timeout: timeout, } } // NewTenantsParamsWithContext creates a new TenantsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewTenantsParamsWithContext(ctx context.Context) *TenantsParams { - var () return &TenantsParams{ - Context: ctx, } } // NewTenantsParamsWithHTTPClient creates a new TenantsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewTenantsParamsWithHTTPClient(client *http.Client) *TenantsParams { - var () return &TenantsParams{ HTTPClient: client, } } -/*TenantsParams contains all the parameters to send to the API endpoint -for the tenants operation typically these are written to a http.Request +/* TenantsParams contains all the parameters to send to the API endpoint + for the tenants operation. + + Typically these are written to a http.Request. */ type TenantsParams struct { - /*CTenantRequest - An array of Tenant records + /* CTenantRequest. + An array of Tenant records */ CTenantRequest *sf_gate_models.TenantRequest @@ -77,6 +76,21 @@ type TenantsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantsParams) WithDefaults() *TenantsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenants params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the tenants params func (o *TenantsParams) WithTimeout(timeout time.Duration) *TenantsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *TenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regis return err } var res []error - if o.CTenantRequest != nil { if err := r.SetBodyParam(o.CTenantRequest); err != nil { return err diff --git a/api/sf-gate/sf_gate_client/tenants/tenants_responses.go b/api/sf-gate/sf_gate_client/tenants/tenants_responses.go index 50006f8..d6e6bc9 100644 --- a/api/sf-gate/sf_gate_client/tenants/tenants_responses.go +++ b/api/sf-gate/sf_gate_client/tenants/tenants_responses.go @@ -63,9 +63,8 @@ func (o *TenantsReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewTenantsOK() *TenantsOK { return &TenantsOK{} } -/*TenantsOK handles this case with default header values. +/* TenantsOK describes a response with status code 200, with default header values. Taxnexus Response with Tenant objects */ @@ -85,7 +84,6 @@ type TenantsOK struct { func (o *TenantsOK) Error() string { return fmt.Sprintf("[POST /tenants][%d] tenantsOK %+v", 200, o.Payload) } - func (o *TenantsOK) GetPayload() *sf_gate_models.TenantResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewTenantsUnauthorized() *TenantsUnauthorized { return &TenantsUnauthorized{} } -/*TenantsUnauthorized handles this case with default header values. +/* TenantsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type TenantsUnauthorized struct { func (o *TenantsUnauthorized) Error() string { return fmt.Sprintf("[POST /tenants][%d] tenantsUnauthorized %+v", 401, o.Payload) } - func (o *TenantsUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewTenantsForbidden() *TenantsForbidden { return &TenantsForbidden{} } -/*TenantsForbidden handles this case with default header values. +/* TenantsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type TenantsForbidden struct { func (o *TenantsForbidden) Error() string { return fmt.Sprintf("[POST /tenants][%d] tenantsForbidden %+v", 403, o.Payload) } - func (o *TenantsForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewTenantsNotFound() *TenantsNotFound { return &TenantsNotFound{} } -/*TenantsNotFound handles this case with default header values. +/* TenantsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type TenantsNotFound struct { func (o *TenantsNotFound) Error() string { return fmt.Sprintf("[POST /tenants][%d] tenantsNotFound %+v", 404, o.Payload) } - func (o *TenantsNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewTenantsUnprocessableEntity() *TenantsUnprocessableEntity { return &TenantsUnprocessableEntity{} } -/*TenantsUnprocessableEntity handles this case with default header values. +/* TenantsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type TenantsUnprocessableEntity struct { func (o *TenantsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /tenants][%d] tenantsUnprocessableEntity %+v", 422, o.Payload) } - func (o *TenantsUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewTenantsInternalServerError() *TenantsInternalServerError { return &TenantsInternalServerError{} } -/*TenantsInternalServerError handles this case with default header values. +/* TenantsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type TenantsInternalServerError struct { func (o *TenantsInternalServerError) Error() string { return fmt.Sprintf("[POST /tenants][%d] tenantsInternalServerError %+v", 500, o.Payload) } - func (o *TenantsInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/users/get_users_parameters.go b/api/sf-gate/sf_gate_client/users/get_users_parameters.go index b5548c9..2f6e6ea 100644 --- a/api/sf-gate/sf_gate_client/users/get_users_parameters.go +++ b/api/sf-gate/sf_gate_client/users/get_users_parameters.go @@ -21,73 +21,80 @@ import ( "github.com/go-openapi/swag" ) -// NewGetUsersParams creates a new GetUsersParams object -// with the default values initialized. +// NewGetUsersParams creates a new GetUsersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetUsersParams() *GetUsersParams { - var () return &GetUsersParams{ - timeout: cr.DefaultTimeout, } } // NewGetUsersParamsWithTimeout creates a new GetUsersParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams { - var () return &GetUsersParams{ - timeout: timeout, } } // NewGetUsersParamsWithContext creates a new GetUsersParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams { - var () return &GetUsersParams{ - Context: ctx, } } // NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams { - var () return &GetUsersParams{ HTTPClient: client, } } -/*GetUsersParams contains all the parameters to send to the API endpoint -for the get users operation typically these are written to a http.Request +/* GetUsersParams contains all the parameters to send to the API endpoint + for the get users operation. + + Typically these are written to a http.Request. */ type GetUsersParams struct { - /*Active - Retrieve only active records? + /* Active. + Retrieve only active records? */ Active *bool - /*Apikey - Taxnexus Id of the User to be retrieved + /* Apikey. + + Taxnexus Id of the User to be retrieved */ Apikey *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip? (default 0) + /* Offset. + + How many objects to skip? (default 0) + + Format: int64 */ Offset *int64 - /*UserID - Taxnexus Id of the User to be retrieved + /* UserID. + + Taxnexus Id of the User to be retrieved */ UserID *string @@ -96,6 +103,21 @@ type GetUsersParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) WithDefaults() *GetUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsersParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get users params func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams { o.SetTimeout(timeout) @@ -196,80 +218,85 @@ func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi // query param active var qrActive bool + if o.Active != nil { qrActive = *o.Active } qActive := swag.FormatBool(qrActive) if qActive != "" { + if err := r.SetQueryParam("active", qActive); err != nil { return err } } - } if o.Apikey != nil { // query param apikey var qrApikey string + if o.Apikey != nil { qrApikey = *o.Apikey } qApikey := qrApikey if qApikey != "" { + if err := r.SetQueryParam("apikey", qApikey); err != nil { return err } } - } if 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 o.UserID != nil { // query param userId var qrUserID string + if o.UserID != nil { qrUserID = *o.UserID } qUserID := qrUserID if qUserID != "" { + if err := r.SetQueryParam("userId", qUserID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/sf-gate/sf_gate_client/users/get_users_responses.go b/api/sf-gate/sf_gate_client/users/get_users_responses.go index 29f9542..8591c9c 100644 --- a/api/sf-gate/sf_gate_client/users/get_users_responses.go +++ b/api/sf-gate/sf_gate_client/users/get_users_responses.go @@ -63,9 +63,8 @@ func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetUsersOK() *GetUsersOK { return &GetUsersOK{} } -/*GetUsersOK handles this case with default header values. +/* GetUsersOK describes a response with status code 200, with default header values. Taxnexus Response with User objects */ @@ -85,7 +84,6 @@ type GetUsersOK struct { func (o *GetUsersOK) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload) } - func (o *GetUsersOK) GetPayload() *sf_gate_models.UserResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetUsersUnauthorized() *GetUsersUnauthorized { return &GetUsersUnauthorized{} } -/*GetUsersUnauthorized handles this case with default header values. +/* GetUsersUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetUsersUnauthorized struct { func (o *GetUsersUnauthorized) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersUnauthorized %+v", 401, o.Payload) } - func (o *GetUsersUnauthorized) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetUsersForbidden() *GetUsersForbidden { return &GetUsersForbidden{} } -/*GetUsersForbidden handles this case with default header values. +/* GetUsersForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetUsersForbidden struct { func (o *GetUsersForbidden) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersForbidden %+v", 403, o.Payload) } - func (o *GetUsersForbidden) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetUsersNotFound() *GetUsersNotFound { return &GetUsersNotFound{} } -/*GetUsersNotFound handles this case with default header values. +/* GetUsersNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetUsersNotFound struct { func (o *GetUsersNotFound) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersNotFound %+v", 404, o.Payload) } - func (o *GetUsersNotFound) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetUsersUnprocessableEntity() *GetUsersUnprocessableEntity { return &GetUsersUnprocessableEntity{} } -/*GetUsersUnprocessableEntity handles this case with default header values. +/* GetUsersUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetUsersUnprocessableEntity struct { func (o *GetUsersUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetUsersUnprocessableEntity) GetPayload() *sf_gate_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetUsersInternalServerError() *GetUsersInternalServerError { return &GetUsersInternalServerError{} } -/*GetUsersInternalServerError handles this case with default header values. +/* GetUsersInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetUsersInternalServerError struct { func (o *GetUsersInternalServerError) Error() string { return fmt.Sprintf("[GET /users][%d] getUsersInternalServerError %+v", 500, o.Payload) } - func (o *GetUsersInternalServerError) GetPayload() *sf_gate_models.Error { return o.Payload } diff --git a/api/sf-gate/sf_gate_client/users/users_client.go b/api/sf-gate/sf_gate_client/users/users_client.go index e6e4ac2..1b47bae 100644 --- a/api/sf-gate/sf_gate_client/users/users_client.go +++ b/api/sf-gate/sf_gate_client/users/users_client.go @@ -29,9 +29,12 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersOK, error) + GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of User records from the datastore */ -func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersOK, error) { +func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsersOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUsersParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getUsers", Method: "GET", PathPattern: "/users", @@ -59,7 +61,12 @@ func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/sf-gate/sf_gate_models/account.go b/api/sf-gate/sf_gate_models/account.go index 37dccd7..4568c2f 100644 --- a/api/sf-gate/sf_gate_models/account.go +++ b/api/sf-gate/sf_gate_models/account.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -312,7 +314,6 @@ func (m *Account) Validate(formats strfmt.Registry) error { } func (m *Account) validateBillingaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Billingaddress) { // not required return nil } @@ -330,7 +331,6 @@ func (m *Account) validateBillingaddress(formats strfmt.Registry) error { } func (m *Account) validateBusinessaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Businessaddress) { // not required return nil } @@ -348,7 +348,6 @@ func (m *Account) validateBusinessaddress(formats strfmt.Registry) error { } func (m *Account) validateDefaultaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Defaultaddress) { // not required return nil } @@ -366,7 +365,6 @@ func (m *Account) validateDefaultaddress(formats strfmt.Registry) error { } func (m *Account) validateShippingaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Shippingaddress) { // not required return nil } @@ -383,6 +381,88 @@ func (m *Account) validateShippingaddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account based on the context it is used +func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBusinessaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDefaultaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Account) contextValidateBillingaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Billingaddress != nil { + if err := m.Billingaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingaddress") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateBusinessaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Businessaddress != nil { + if err := m.Businessaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("businessaddress") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateDefaultaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Defaultaddress != nil { + if err := m.Defaultaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("defaultaddress") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateShippingaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Shippingaddress != nil { + if err := m.Shippingaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shippingaddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Account) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/account_request.go b/api/sf-gate/sf_gate_models/account_request.go index 5fac246..df368b1 100644 --- a/api/sf-gate/sf_gate_models/account_request.go +++ b/api/sf-gate/sf_gate_models/account_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountRequest) Validate(formats strfmt.Registry) error { } func (m *AccountRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountRequest) validateData(formats strfmt.Registry) error { } func (m *AccountRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account request based on the context it is used +func (m *AccountRequest) 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 *AccountRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/account_response.go b/api/sf-gate/sf_gate_models/account_response.go index 5af07ab..e2e4319 100644 --- a/api/sf-gate/sf_gate_models/account_response.go +++ b/api/sf-gate/sf_gate_models/account_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountResponse) Validate(formats strfmt.Registry) error { } func (m *AccountResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountResponse) validateData(formats strfmt.Registry) error { } func (m *AccountResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account response based on the context it is used +func (m *AccountResponse) 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 *AccountResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/accounting_rule.go b/api/sf-gate/sf_gate_models/accounting_rule.go index f211354..94dadb2 100644 --- a/api/sf-gate/sf_gate_models/accounting_rule.go +++ b/api/sf-gate/sf_gate_models/accounting_rule.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -85,6 +87,11 @@ func (m *AccountingRule) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this accounting rule based on context it is used +func (m *AccountingRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AccountingRule) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/accounting_rule_request.go b/api/sf-gate/sf_gate_models/accounting_rule_request.go index aa265bc..2ef1308 100644 --- a/api/sf-gate/sf_gate_models/accounting_rule_request.go +++ b/api/sf-gate/sf_gate_models/accounting_rule_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountingRuleRequest) Validate(formats strfmt.Registry) error { } func (m *AccountingRuleRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountingRuleRequest) validateData(formats strfmt.Registry) error { } func (m *AccountingRuleRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountingRuleRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting rule request based on the context it is used +func (m *AccountingRuleRequest) 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 *AccountingRuleRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountingRuleRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRuleRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/accounting_rule_response.go b/api/sf-gate/sf_gate_models/accounting_rule_response.go index 2ab27f7..b69ba64 100644 --- a/api/sf-gate/sf_gate_models/accounting_rule_response.go +++ b/api/sf-gate/sf_gate_models/accounting_rule_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountingRuleResponse) Validate(formats strfmt.Registry) error { } func (m *AccountingRuleResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountingRuleResponse) validateData(formats strfmt.Registry) error { } func (m *AccountingRuleResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountingRuleResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting rule response based on the context it is used +func (m *AccountingRuleResponse) 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 *AccountingRuleResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountingRuleResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRuleResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/accounting_ruleset.go b/api/sf-gate/sf_gate_models/accounting_ruleset.go index 3831e78..0083dd1 100644 --- a/api/sf-gate/sf_gate_models/accounting_ruleset.go +++ b/api/sf-gate/sf_gate_models/accounting_ruleset.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -71,7 +72,6 @@ func (m *AccountingRuleset) Validate(formats strfmt.Registry) error { } func (m *AccountingRuleset) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -95,6 +95,38 @@ func (m *AccountingRuleset) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting ruleset based on the context it is used +func (m *AccountingRuleset) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AccountingRuleset) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRuleset) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/accounting_ruleset_item.go b/api/sf-gate/sf_gate_models/accounting_ruleset_item.go index 905c984..18a5556 100644 --- a/api/sf-gate/sf_gate_models/accounting_ruleset_item.go +++ b/api/sf-gate/sf_gate_models/accounting_ruleset_item.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *AccountingRulesetItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this accounting ruleset item based on context it is used +func (m *AccountingRulesetItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AccountingRulesetItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/accounting_ruleset_request.go b/api/sf-gate/sf_gate_models/accounting_ruleset_request.go index 98b6807..aece912 100644 --- a/api/sf-gate/sf_gate_models/accounting_ruleset_request.go +++ b/api/sf-gate/sf_gate_models/accounting_ruleset_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountingRulesetRequest) Validate(formats strfmt.Registry) error { } func (m *AccountingRulesetRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountingRulesetRequest) validateData(formats strfmt.Registry) error { } func (m *AccountingRulesetRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountingRulesetRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this accounting ruleset request based on the context it is used +func (m *AccountingRulesetRequest) 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 *AccountingRulesetRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountingRulesetRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRulesetRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/accounting_ruleset_response.go b/api/sf-gate/sf_gate_models/accounting_ruleset_response.go index 0fbd018..1fd8a00 100644 --- a/api/sf-gate/sf_gate_models/accounting_ruleset_response.go +++ b/api/sf-gate/sf_gate_models/accounting_ruleset_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountingRulesetResponse) Validate(formats strfmt.Registry) error { } func (m *AccountingRulesetResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountingRulesetResponse) validateData(formats strfmt.Registry) error } func (m *AccountingRulesetResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountingRulesetResponse) validateMeta(formats strfmt.Registry) error return nil } +// ContextValidate validate this accounting ruleset response based on the context it is used +func (m *AccountingRulesetResponse) 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 *AccountingRulesetResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountingRulesetResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountingRulesetResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/address.go b/api/sf-gate/sf_gate_models/address.go index 05dfc56..6b34996 100644 --- a/api/sf-gate/sf_gate_models/address.go +++ b/api/sf-gate/sf_gate_models/address.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -81,6 +83,11 @@ func (m *Address) validateStatecode(formats strfmt.Registry) error { return nil } +// ContextValidate validates this address based on context it is used +func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Address) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/authority.go b/api/sf-gate/sf_gate_models/authority.go index ae45596..4e0ca25 100644 --- a/api/sf-gate/sf_gate_models/authority.go +++ b/api/sf-gate/sf_gate_models/authority.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -112,6 +114,11 @@ func (m *Authority) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this authority based on context it is used +func (m *Authority) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Authority) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/authority_request.go b/api/sf-gate/sf_gate_models/authority_request.go index f4eb02b..1b723b1 100644 --- a/api/sf-gate/sf_gate_models/authority_request.go +++ b/api/sf-gate/sf_gate_models/authority_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AuthorityRequest) Validate(formats strfmt.Registry) error { } func (m *AuthorityRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AuthorityRequest) validateData(formats strfmt.Registry) error { } func (m *AuthorityRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AuthorityRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this authority request based on the context it is used +func (m *AuthorityRequest) 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 *AuthorityRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AuthorityRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AuthorityRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/authority_response.go b/api/sf-gate/sf_gate_models/authority_response.go index 0f882eb..381ec2f 100644 --- a/api/sf-gate/sf_gate_models/authority_response.go +++ b/api/sf-gate/sf_gate_models/authority_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AuthorityResponse) Validate(formats strfmt.Registry) error { } func (m *AuthorityResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AuthorityResponse) validateData(formats strfmt.Registry) error { } func (m *AuthorityResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AuthorityResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this authority response based on the context it is used +func (m *AuthorityResponse) 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 *AuthorityResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AuthorityResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AuthorityResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/backend.go b/api/sf-gate/sf_gate_models/backend.go index da261a1..c5f7335 100644 --- a/api/sf-gate/sf_gate_models/backend.go +++ b/api/sf-gate/sf_gate_models/backend.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -139,6 +141,11 @@ func (m *Backend) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this backend based on context it is used +func (m *Backend) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Backend) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/backend_request.go b/api/sf-gate/sf_gate_models/backend_request.go index e2648b7..e427eb7 100644 --- a/api/sf-gate/sf_gate_models/backend_request.go +++ b/api/sf-gate/sf_gate_models/backend_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *BackendRequest) Validate(formats strfmt.Registry) error { } func (m *BackendRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *BackendRequest) validateData(formats strfmt.Registry) error { } func (m *BackendRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *BackendRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this backend request based on the context it is used +func (m *BackendRequest) 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 *BackendRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *BackendRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *BackendRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/backend_response.go b/api/sf-gate/sf_gate_models/backend_response.go index 4063dce..cef0969 100644 --- a/api/sf-gate/sf_gate_models/backend_response.go +++ b/api/sf-gate/sf_gate_models/backend_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *BackendResponse) Validate(formats strfmt.Registry) error { } func (m *BackendResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *BackendResponse) validateData(formats strfmt.Registry) error { } func (m *BackendResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *BackendResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this backend response based on the context it is used +func (m *BackendResponse) 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 *BackendResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *BackendResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *BackendResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/cash_receipt.go b/api/sf-gate/sf_gate_models/cash_receipt.go index 63b4a1e..5f18a74 100644 --- a/api/sf-gate/sf_gate_models/cash_receipt.go +++ b/api/sf-gate/sf_gate_models/cash_receipt.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -163,6 +165,11 @@ func (m *CashReceipt) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cash receipt based on context it is used +func (m *CashReceipt) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CashReceipt) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/cash_receipt_request.go b/api/sf-gate/sf_gate_models/cash_receipt_request.go index 8329cb9..c2a2c55 100644 --- a/api/sf-gate/sf_gate_models/cash_receipt_request.go +++ b/api/sf-gate/sf_gate_models/cash_receipt_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CashReceiptRequest) Validate(formats strfmt.Registry) error { } func (m *CashReceiptRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CashReceiptRequest) validateData(formats strfmt.Registry) error { } func (m *CashReceiptRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CashReceiptRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cash receipt request based on the context it is used +func (m *CashReceiptRequest) 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 *CashReceiptRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CashReceiptRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CashReceiptRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/cash_receipt_response.go b/api/sf-gate/sf_gate_models/cash_receipt_response.go index 55d40b6..6e2158d 100644 --- a/api/sf-gate/sf_gate_models/cash_receipt_response.go +++ b/api/sf-gate/sf_gate_models/cash_receipt_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CashReceiptResponse) Validate(formats strfmt.Registry) error { } func (m *CashReceiptResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CashReceiptResponse) validateData(formats strfmt.Registry) error { } func (m *CashReceiptResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CashReceiptResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cash receipt response based on the context it is used +func (m *CashReceiptResponse) 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 *CashReceiptResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CashReceiptResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CashReceiptResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/cluster.go b/api/sf-gate/sf_gate_models/cluster.go index 9442176..059d336 100644 --- a/api/sf-gate/sf_gate_models/cluster.go +++ b/api/sf-gate/sf_gate_models/cluster.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -76,6 +78,11 @@ func (m *Cluster) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cluster based on context it is used +func (m *Cluster) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Cluster) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/cluster_request.go b/api/sf-gate/sf_gate_models/cluster_request.go index 7c742d3..bc768a7 100644 --- a/api/sf-gate/sf_gate_models/cluster_request.go +++ b/api/sf-gate/sf_gate_models/cluster_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -93,6 +94,56 @@ func (m *ClusterRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cluster request based on the context it is used +func (m *ClusterRequest) 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 *ClusterRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ClusterRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/cluster_response.go b/api/sf-gate/sf_gate_models/cluster_response.go index 0f51a27..387b795 100644 --- a/api/sf-gate/sf_gate_models/cluster_response.go +++ b/api/sf-gate/sf_gate_models/cluster_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ClusterResponse) Validate(formats strfmt.Registry) error { } func (m *ClusterResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ClusterResponse) validateData(formats strfmt.Registry) error { } func (m *ClusterResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ClusterResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cluster response based on the context it is used +func (m *ClusterResponse) 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 *ClusterResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ClusterResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/company.go b/api/sf-gate/sf_gate_models/company.go index a95bd06..37d98b1 100644 --- a/api/sf-gate/sf_gate_models/company.go +++ b/api/sf-gate/sf_gate_models/company.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -160,7 +162,6 @@ func (m *Company) Validate(formats strfmt.Registry) error { } func (m *Company) validateBillingaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Billingaddress) { // not required return nil } @@ -178,7 +179,6 @@ func (m *Company) validateBillingaddress(formats strfmt.Registry) error { } func (m *Company) validateDefaultaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Defaultaddress) { // not required return nil } @@ -195,6 +195,52 @@ func (m *Company) validateDefaultaddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this company based on the context it is used +func (m *Company) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDefaultaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Company) contextValidateBillingaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Billingaddress != nil { + if err := m.Billingaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingaddress") + } + return err + } + } + + return nil +} + +func (m *Company) contextValidateDefaultaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Defaultaddress != nil { + if err := m.Defaultaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("defaultaddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Company) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/company_response.go b/api/sf-gate/sf_gate_models/company_response.go index dd4b1dd..8f077aa 100644 --- a/api/sf-gate/sf_gate_models/company_response.go +++ b/api/sf-gate/sf_gate_models/company_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CompanyResponse) Validate(formats strfmt.Registry) error { } func (m *CompanyResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CompanyResponse) validateData(formats strfmt.Registry) error { } func (m *CompanyResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CompanyResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this company response based on the context it is used +func (m *CompanyResponse) 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 *CompanyResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CompanyResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CompanyResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/contact.go b/api/sf-gate/sf_gate_models/contact.go index 73bbbb1..2a0156d 100644 --- a/api/sf-gate/sf_gate_models/contact.go +++ b/api/sf-gate/sf_gate_models/contact.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -175,7 +177,6 @@ func (m *Contact) Validate(formats strfmt.Registry) error { } func (m *Contact) validateMailingaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Mailingaddress) { // not required return nil } @@ -193,7 +194,6 @@ func (m *Contact) validateMailingaddress(formats strfmt.Registry) error { } func (m *Contact) validateOtheraddress(formats strfmt.Registry) error { - if swag.IsZero(m.Otheraddress) { // not required return nil } @@ -210,6 +210,52 @@ func (m *Contact) validateOtheraddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contact based on the context it is used +func (m *Contact) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMailingaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOtheraddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Contact) contextValidateMailingaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Mailingaddress != nil { + if err := m.Mailingaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mailingaddress") + } + return err + } + } + + return nil +} + +func (m *Contact) contextValidateOtheraddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Otheraddress != nil { + if err := m.Otheraddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("otheraddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Contact) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/contact_request.go b/api/sf-gate/sf_gate_models/contact_request.go index f67b29d..5fab8c2 100644 --- a/api/sf-gate/sf_gate_models/contact_request.go +++ b/api/sf-gate/sf_gate_models/contact_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -93,6 +94,56 @@ func (m *ContactRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contact request based on the context it is used +func (m *ContactRequest) 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 *ContactRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ContactRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ContactRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/contact_response.go b/api/sf-gate/sf_gate_models/contact_response.go index e41f3e0..1262063 100644 --- a/api/sf-gate/sf_gate_models/contact_response.go +++ b/api/sf-gate/sf_gate_models/contact_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ContactResponse) Validate(formats strfmt.Registry) error { } func (m *ContactResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ContactResponse) validateData(formats strfmt.Registry) error { } func (m *ContactResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ContactResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contact response based on the context it is used +func (m *ContactResponse) 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 *ContactResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ContactResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ContactResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/contract_basic.go b/api/sf-gate/sf_gate_models/contract_basic.go index 1c9b1c8..cdb8353 100644 --- a/api/sf-gate/sf_gate_models/contract_basic.go +++ b/api/sf-gate/sf_gate_models/contract_basic.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -67,6 +69,11 @@ func (m *ContractBasic) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this contract basic based on context it is used +func (m *ContractBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ContractBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/country.go b/api/sf-gate/sf_gate_models/country.go index 89784cb..c65589d 100644 --- a/api/sf-gate/sf_gate_models/country.go +++ b/api/sf-gate/sf_gate_models/country.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -116,7 +117,6 @@ func (m *Country) Validate(formats strfmt.Registry) error { } func (m *Country) validateTaxinstances(formats strfmt.Registry) error { - if swag.IsZero(m.Taxinstances) { // not required return nil } @@ -140,6 +140,38 @@ func (m *Country) validateTaxinstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this country based on the context it is used +func (m *Country) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxinstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Country) contextValidateTaxinstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxinstances); i++ { + + if m.Taxinstances[i] != nil { + if err := m.Taxinstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxinstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Country) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/country_response.go b/api/sf-gate/sf_gate_models/country_response.go index 33cac47..8d21c86 100644 --- a/api/sf-gate/sf_gate_models/country_response.go +++ b/api/sf-gate/sf_gate_models/country_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CountryResponse) Validate(formats strfmt.Registry) error { } func (m *CountryResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CountryResponse) validateData(formats strfmt.Registry) error { } func (m *CountryResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CountryResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this country response based on the context it is used +func (m *CountryResponse) 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 *CountryResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CountryResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CountryResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/county.go b/api/sf-gate/sf_gate_models/county.go index 53508fa..e9096ae 100644 --- a/api/sf-gate/sf_gate_models/county.go +++ b/api/sf-gate/sf_gate_models/county.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -152,7 +153,6 @@ func (m *County) Validate(formats strfmt.Registry) error { } func (m *County) validateTaxinstances(formats strfmt.Registry) error { - if swag.IsZero(m.Taxinstances) { // not required return nil } @@ -176,6 +176,38 @@ func (m *County) validateTaxinstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this county based on the context it is used +func (m *County) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxinstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *County) contextValidateTaxinstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxinstances); i++ { + + if m.Taxinstances[i] != nil { + if err := m.Taxinstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxinstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *County) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/county_response.go b/api/sf-gate/sf_gate_models/county_response.go index 265a3e3..0bd4327 100644 --- a/api/sf-gate/sf_gate_models/county_response.go +++ b/api/sf-gate/sf_gate_models/county_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *CountyResponse) Validate(formats strfmt.Registry) error { } func (m *CountyResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *CountyResponse) validateData(formats strfmt.Registry) error { } func (m *CountyResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *CountyResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this county response based on the context it is used +func (m *CountyResponse) 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 *CountyResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CountyResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CountyResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/credit_card.go b/api/sf-gate/sf_gate_models/credit_card.go index eb946de..f536aa0 100644 --- a/api/sf-gate/sf_gate_models/credit_card.go +++ b/api/sf-gate/sf_gate_models/credit_card.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -70,6 +72,11 @@ func (m *CreditCard) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this credit card based on context it is used +func (m *CreditCard) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CreditCard) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/database.go b/api/sf-gate/sf_gate_models/database.go index 9c3c6ba..64ee44e 100644 --- a/api/sf-gate/sf_gate_models/database.go +++ b/api/sf-gate/sf_gate_models/database.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -64,6 +66,11 @@ func (m *Database) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this database based on context it is used +func (m *Database) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Database) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/database_request.go b/api/sf-gate/sf_gate_models/database_request.go index a522736..6031580 100644 --- a/api/sf-gate/sf_gate_models/database_request.go +++ b/api/sf-gate/sf_gate_models/database_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DatabaseRequest) Validate(formats strfmt.Registry) error { } func (m *DatabaseRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DatabaseRequest) validateData(formats strfmt.Registry) error { } func (m *DatabaseRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DatabaseRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this database request based on the context it is used +func (m *DatabaseRequest) 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 *DatabaseRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DatabaseRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DatabaseRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/database_response.go b/api/sf-gate/sf_gate_models/database_response.go index b7ed7e6..473aab0 100644 --- a/api/sf-gate/sf_gate_models/database_response.go +++ b/api/sf-gate/sf_gate_models/database_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DatabaseResponse) Validate(formats strfmt.Registry) error { } func (m *DatabaseResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DatabaseResponse) validateData(formats strfmt.Registry) error { } func (m *DatabaseResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DatabaseResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this database response based on the context it is used +func (m *DatabaseResponse) 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 *DatabaseResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DatabaseResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DatabaseResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/domain.go b/api/sf-gate/sf_gate_models/domain.go index fe6c963..8a4b571 100644 --- a/api/sf-gate/sf_gate_models/domain.go +++ b/api/sf-gate/sf_gate_models/domain.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *Domain) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this domain based on context it is used +func (m *Domain) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Domain) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/domain_response.go b/api/sf-gate/sf_gate_models/domain_response.go index 207c597..1963c9c 100644 --- a/api/sf-gate/sf_gate_models/domain_response.go +++ b/api/sf-gate/sf_gate_models/domain_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DomainResponse) Validate(formats strfmt.Registry) error { } func (m *DomainResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DomainResponse) validateData(formats strfmt.Registry) error { } func (m *DomainResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DomainResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this domain response based on the context it is used +func (m *DomainResponse) 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 *DomainResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DomainResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DomainResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/error.go b/api/sf-gate/sf_gate_models/error.go index c3f47ae..c896889 100644 --- a/api/sf-gate/sf_gate_models/error.go +++ b/api/sf-gate/sf_gate_models/error.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing.go b/api/sf-gate/sf_gate_models/filing.go index bb10299..a37573e 100644 --- a/api/sf-gate/sf_gate_models/filing.go +++ b/api/sf-gate/sf_gate_models/filing.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -157,6 +159,11 @@ func (m *Filing) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this filing based on context it is used +func (m *Filing) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Filing) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing_due_date.go b/api/sf-gate/sf_gate_models/filing_due_date.go index d9b47d2..c42b783 100644 --- a/api/sf-gate/sf_gate_models/filing_due_date.go +++ b/api/sf-gate/sf_gate_models/filing_due_date.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *FilingDueDate) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this filing due date based on context it is used +func (m *FilingDueDate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *FilingDueDate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing_request.go b/api/sf-gate/sf_gate_models/filing_request.go index 5576d81..71c7b04 100644 --- a/api/sf-gate/sf_gate_models/filing_request.go +++ b/api/sf-gate/sf_gate_models/filing_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *FilingRequest) Validate(formats strfmt.Registry) error { } func (m *FilingRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *FilingRequest) validateData(formats strfmt.Registry) error { } func (m *FilingRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *FilingRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing request based on the context it is used +func (m *FilingRequest) 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 *FilingRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing_response.go b/api/sf-gate/sf_gate_models/filing_response.go index 1169e13..4f76278 100644 --- a/api/sf-gate/sf_gate_models/filing_response.go +++ b/api/sf-gate/sf_gate_models/filing_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *FilingResponse) Validate(formats strfmt.Registry) error { } func (m *FilingResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *FilingResponse) validateData(formats strfmt.Registry) error { } func (m *FilingResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *FilingResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing response based on the context it is used +func (m *FilingResponse) 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 *FilingResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing_type.go b/api/sf-gate/sf_gate_models/filing_type.go index ece1951..8ee1e97 100644 --- a/api/sf-gate/sf_gate_models/filing_type.go +++ b/api/sf-gate/sf_gate_models/filing_type.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -117,7 +118,6 @@ func (m *FilingType) Validate(formats strfmt.Registry) error { } func (m *FilingType) validateDuedates(formats strfmt.Registry) error { - if swag.IsZero(m.Duedates) { // not required return nil } @@ -142,7 +142,6 @@ func (m *FilingType) validateDuedates(formats strfmt.Registry) error { } func (m *FilingType) validateInstances(formats strfmt.Registry) error { - if swag.IsZero(m.Instances) { // not required return nil } @@ -166,6 +165,60 @@ func (m *FilingType) validateInstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing type based on the context it is used +func (m *FilingType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDuedates(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilingType) contextValidateDuedates(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Duedates); i++ { + + if m.Duedates[i] != nil { + if err := m.Duedates[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("duedates" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingType) contextValidateInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Instances); i++ { + + if m.Instances[i] != nil { + if err := m.Instances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing_type_instance.go b/api/sf-gate/sf_gate_models/filing_type_instance.go index fee25ac..21c49d9 100644 --- a/api/sf-gate/sf_gate_models/filing_type_instance.go +++ b/api/sf-gate/sf_gate_models/filing_type_instance.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -43,6 +45,11 @@ func (m *FilingTypeInstance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this filing type instance based on context it is used +func (m *FilingTypeInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *FilingTypeInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing_type_request.go b/api/sf-gate/sf_gate_models/filing_type_request.go index a9ad105..3aba22a 100644 --- a/api/sf-gate/sf_gate_models/filing_type_request.go +++ b/api/sf-gate/sf_gate_models/filing_type_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -93,6 +94,56 @@ func (m *FilingTypeRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing type request based on the context it is used +func (m *FilingTypeRequest) 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 *FilingTypeRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingTypeRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingTypeRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/filing_type_response.go b/api/sf-gate/sf_gate_models/filing_type_response.go index 837d9c2..9f2669e 100644 --- a/api/sf-gate/sf_gate_models/filing_type_response.go +++ b/api/sf-gate/sf_gate_models/filing_type_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *FilingTypeResponse) Validate(formats strfmt.Registry) error { } func (m *FilingTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *FilingTypeResponse) validateData(formats strfmt.Registry) error { } func (m *FilingTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *FilingTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this filing type response based on the context it is used +func (m *FilingTypeResponse) 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 *FilingTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilingTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FilingTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/geo_license_type_instance.go b/api/sf-gate/sf_gate_models/geo_license_type_instance.go index cbdfe6a..0c921a4 100644 --- a/api/sf-gate/sf_gate_models/geo_license_type_instance.go +++ b/api/sf-gate/sf_gate_models/geo_license_type_instance.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *GeoLicenseTypeInstance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this geo license type instance based on context it is used +func (m *GeoLicenseTypeInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GeoLicenseTypeInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/gl_account.go b/api/sf-gate/sf_gate_models/gl_account.go index 2d5c490..48fd26a 100644 --- a/api/sf-gate/sf_gate_models/gl_account.go +++ b/api/sf-gate/sf_gate_models/gl_account.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -76,6 +78,11 @@ func (m *GlAccount) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this gl account based on context it is used +func (m *GlAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GlAccount) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/gl_account_request.go b/api/sf-gate/sf_gate_models/gl_account_request.go index b26bb3f..cb48629 100644 --- a/api/sf-gate/sf_gate_models/gl_account_request.go +++ b/api/sf-gate/sf_gate_models/gl_account_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *GlAccountRequest) Validate(formats strfmt.Registry) error { } func (m *GlAccountRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *GlAccountRequest) validateData(formats strfmt.Registry) error { } func (m *GlAccountRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *GlAccountRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl account request based on the context it is used +func (m *GlAccountRequest) 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 *GlAccountRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *GlAccountRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GlAccountRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/gl_account_response.go b/api/sf-gate/sf_gate_models/gl_account_response.go index 1f8f5fb..5fc7967 100644 --- a/api/sf-gate/sf_gate_models/gl_account_response.go +++ b/api/sf-gate/sf_gate_models/gl_account_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *GlAccountResponse) Validate(formats strfmt.Registry) error { } func (m *GlAccountResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *GlAccountResponse) validateData(formats strfmt.Registry) error { } func (m *GlAccountResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *GlAccountResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl account response based on the context it is used +func (m *GlAccountResponse) 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 *GlAccountResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *GlAccountResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GlAccountResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/gl_balance.go b/api/sf-gate/sf_gate_models/gl_balance.go index b1be96b..f1370b2 100644 --- a/api/sf-gate/sf_gate_models/gl_balance.go +++ b/api/sf-gate/sf_gate_models/gl_balance.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -82,6 +84,11 @@ func (m *GlBalance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this gl balance based on context it is used +func (m *GlBalance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *GlBalance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/gl_balance_response.go b/api/sf-gate/sf_gate_models/gl_balance_response.go index d7491f4..4fda2d6 100644 --- a/api/sf-gate/sf_gate_models/gl_balance_response.go +++ b/api/sf-gate/sf_gate_models/gl_balance_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *GlBalanceResponse) Validate(formats strfmt.Registry) error { } func (m *GlBalanceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *GlBalanceResponse) validateData(formats strfmt.Registry) error { } func (m *GlBalanceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *GlBalanceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this gl balance response based on the context it is used +func (m *GlBalanceResponse) 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 *GlBalanceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *GlBalanceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GlBalanceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/ids.go b/api/sf-gate/sf_gate_models/ids.go index 8c99904..8422c02 100644 --- a/api/sf-gate/sf_gate_models/ids.go +++ b/api/sf-gate/sf_gate_models/ids.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" ) @@ -22,3 +24,8 @@ type Ids []string func (m Ids) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this ids based on context it is used +func (m Ids) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/api/sf-gate/sf_gate_models/ids_request.go b/api/sf-gate/sf_gate_models/ids_request.go index 3101aa0..94a75d8 100644 --- a/api/sf-gate/sf_gate_models/ids_request.go +++ b/api/sf-gate/sf_gate_models/ids_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *IdsRequest) Validate(formats strfmt.Registry) error { } func (m *IdsRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -68,7 +68,6 @@ func (m *IdsRequest) validateData(formats strfmt.Registry) error { } func (m *IdsRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -85,6 +84,54 @@ func (m *IdsRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this ids request based on the context it is used +func (m *IdsRequest) 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 *IdsRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *IdsRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IdsRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/ingest.go b/api/sf-gate/sf_gate_models/ingest.go index dea45c7..1cadb29 100644 --- a/api/sf-gate/sf_gate_models/ingest.go +++ b/api/sf-gate/sf_gate_models/ingest.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -186,7 +187,6 @@ func (m *Ingest) validateAccountid(formats strfmt.Registry) error { } func (m *Ingest) validateFormatted(formats strfmt.Registry) error { - if swag.IsZero(m.Formatted) { // not required return nil } @@ -226,8 +226,8 @@ const ( // IngestIngesttypeSuretax captures enum value "suretax" IngestIngesttypeSuretax string = "suretax" - // IngestIngesttypeTaxnexusAPI captures enum value "taxnexus-api" - IngestIngesttypeTaxnexusAPI string = "taxnexus-api" + // IngestIngesttypeTaxnexusDashAPI captures enum value "taxnexus-api" + IngestIngesttypeTaxnexusDashAPI string = "taxnexus-api" ) // prop value enum @@ -239,7 +239,6 @@ func (m *Ingest) validateIngesttypeEnum(path, location string, value string) err } func (m *Ingest) validateIngesttype(formats strfmt.Registry) error { - if swag.IsZero(m.Ingesttype) { // not required return nil } @@ -269,8 +268,8 @@ const ( // IngestObjecttypeAccount captures enum value "account" IngestObjecttypeAccount string = "account" - // IngestObjecttypeCashReceipt captures enum value "cash-receipt" - IngestObjecttypeCashReceipt string = "cash-receipt" + // IngestObjecttypeCashDashReceipt captures enum value "cash-receipt" + IngestObjecttypeCashDashReceipt string = "cash-receipt" // IngestObjecttypeContact captures enum value "contact" IngestObjecttypeContact string = "contact" @@ -367,7 +366,6 @@ func (m *Ingest) validateStatusEnum(path, location string, value string) error { } func (m *Ingest) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -380,6 +378,34 @@ func (m *Ingest) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validate this ingest based on the context it is used +func (m *Ingest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFormatted(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Ingest) contextValidateFormatted(ctx context.Context, formats strfmt.Registry) error { + + if m.Formatted != nil { + if err := m.Formatted.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("formatted") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Ingest) MarshalBinary() ([]byte, error) { if m == nil { @@ -430,6 +456,11 @@ func (m *IngestFormatted) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this ingest formatted based on context it is used +func (m *IngestFormatted) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *IngestFormatted) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/ingest_request.go b/api/sf-gate/sf_gate_models/ingest_request.go index 2fcfb4b..503571c 100644 --- a/api/sf-gate/sf_gate_models/ingest_request.go +++ b/api/sf-gate/sf_gate_models/ingest_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -93,6 +94,56 @@ func (m *IngestRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this ingest request based on the context it is used +func (m *IngestRequest) 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 *IngestRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IngestRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IngestRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/ingest_response.go b/api/sf-gate/sf_gate_models/ingest_response.go index 026969c..90886cb 100644 --- a/api/sf-gate/sf_gate_models/ingest_response.go +++ b/api/sf-gate/sf_gate_models/ingest_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *IngestResponse) Validate(formats strfmt.Registry) error { } func (m *IngestResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *IngestResponse) validateData(formats strfmt.Registry) error { } func (m *IngestResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *IngestResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this ingest response based on the context it is used +func (m *IngestResponse) 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 *IngestResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IngestResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IngestResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/invalid_error.go b/api/sf-gate/sf_gate_models/invalid_error.go index cf8f05c..4a2fd60 100644 --- a/api/sf-gate/sf_gate_models/invalid_error.go +++ b/api/sf-gate/sf_gate_models/invalid_error.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/invoice.go b/api/sf-gate/sf_gate_models/invoice.go index c12315e..ad3757b 100644 --- a/api/sf-gate/sf_gate_models/invoice.go +++ b/api/sf-gate/sf_gate_models/invoice.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -325,7 +326,6 @@ func (m *Invoice) Validate(formats strfmt.Registry) error { } func (m *Invoice) validateCoordinate(formats strfmt.Registry) error { - if swag.IsZero(m.Coordinate) { // not required return nil } @@ -343,7 +343,6 @@ func (m *Invoice) validateCoordinate(formats strfmt.Registry) error { } func (m *Invoice) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -368,7 +367,6 @@ func (m *Invoice) validateItems(formats strfmt.Registry) error { } func (m *Invoice) validateTaxitems(formats strfmt.Registry) error { - if swag.IsZero(m.Taxitems) { // not required return nil } @@ -392,6 +390,78 @@ func (m *Invoice) validateTaxitems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice based on the context it is used +func (m *Invoice) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCoordinate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxitems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Invoice) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error { + + if m.Coordinate != nil { + if err := m.Coordinate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("coordinate") + } + return err + } + } + + return nil +} + +func (m *Invoice) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Invoice) contextValidateTaxitems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxitems); i++ { + + if m.Taxitems[i] != nil { + if err := m.Taxitems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxitems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Invoice) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/invoice_basic.go b/api/sf-gate/sf_gate_models/invoice_basic.go index 3789dc9..f4fbe99 100644 --- a/api/sf-gate/sf_gate_models/invoice_basic.go +++ b/api/sf-gate/sf_gate_models/invoice_basic.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" @@ -94,7 +95,6 @@ func (m *InvoiceBasic) Validate(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateCoordinate(formats strfmt.Registry) error { - if swag.IsZero(m.Coordinate) { // not required return nil } @@ -112,7 +112,6 @@ func (m *InvoiceBasic) validateCoordinate(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -199,7 +198,6 @@ func (m *InvoiceBasic) validateStatusEnum(path, location string, value string) e } func (m *InvoiceBasic) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -212,6 +210,56 @@ func (m *InvoiceBasic) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice basic based on the context it is used +func (m *InvoiceBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCoordinate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InvoiceBasic) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error { + + if m.Coordinate != nil { + if err := m.Coordinate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("coordinate") + } + return err + } + } + + return nil +} + +func (m *InvoiceBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/invoice_item.go b/api/sf-gate/sf_gate_models/invoice_item.go index f274b9d..7c5f8e2 100644 --- a/api/sf-gate/sf_gate_models/invoice_item.go +++ b/api/sf-gate/sf_gate_models/invoice_item.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -121,6 +123,11 @@ func (m *InvoiceItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this invoice item based on context it is used +func (m *InvoiceItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *InvoiceItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/invoice_request.go b/api/sf-gate/sf_gate_models/invoice_request.go index 01a56cd..50d7d5c 100644 --- a/api/sf-gate/sf_gate_models/invoice_request.go +++ b/api/sf-gate/sf_gate_models/invoice_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *InvoiceRequest) Validate(formats strfmt.Registry) error { } func (m *InvoiceRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *InvoiceRequest) validateData(formats strfmt.Registry) error { } func (m *InvoiceRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *InvoiceRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice request based on the context it is used +func (m *InvoiceRequest) 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 *InvoiceRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/invoice_response.go b/api/sf-gate/sf_gate_models/invoice_response.go index 7c00411..61c90b0 100644 --- a/api/sf-gate/sf_gate_models/invoice_response.go +++ b/api/sf-gate/sf_gate_models/invoice_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *InvoiceResponse) Validate(formats strfmt.Registry) error { } func (m *InvoiceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *InvoiceResponse) validateData(formats strfmt.Registry) error { } func (m *InvoiceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *InvoiceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice response based on the context it is used +func (m *InvoiceResponse) 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 *InvoiceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/item_basic.go b/api/sf-gate/sf_gate_models/item_basic.go index f51fd4b..1113fd0 100644 --- a/api/sf-gate/sf_gate_models/item_basic.go +++ b/api/sf-gate/sf_gate_models/item_basic.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -194,7 +195,6 @@ func (m *ItemBasic) validateUnitsEnum(path, location string, value string) error } func (m *ItemBasic) validateUnits(formats strfmt.Registry) error { - if swag.IsZero(m.Units) { // not required return nil } @@ -207,6 +207,11 @@ func (m *ItemBasic) validateUnits(formats strfmt.Registry) error { return nil } +// ContextValidate validates this item basic based on context it is used +func (m *ItemBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ItemBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/job.go b/api/sf-gate/sf_gate_models/job.go index 570348d..1729cf8 100644 --- a/api/sf-gate/sf_gate_models/job.go +++ b/api/sf-gate/sf_gate_models/job.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" @@ -227,7 +228,6 @@ func (m *Job) validateDurationEnum(path, location string, value string) error { } func (m *Job) validateDuration(formats strfmt.Registry) error { - if swag.IsZero(m.Duration) { // not required return nil } @@ -291,7 +291,6 @@ func (m *Job) validateIntervalEnum(path, location string, value string) error { } func (m *Job) validateInterval(formats strfmt.Registry) error { - if swag.IsZero(m.Interval) { // not required return nil } @@ -340,7 +339,6 @@ func (m *Job) validateObjecttypeEnum(path, location string, value string) error } func (m *Job) validateObjecttype(formats strfmt.Registry) error { - if swag.IsZero(m.Objecttype) { // not required return nil } @@ -386,7 +384,6 @@ func (m *Job) validateSagatypeEnum(path, location string, value string) error { } func (m *Job) validateSagatype(formats strfmt.Registry) error { - if swag.IsZero(m.Sagatype) { // not required return nil } @@ -435,7 +432,6 @@ func (m *Job) validateSourceEnum(path, location string, value string) error { } func (m *Job) validateSource(formats strfmt.Registry) error { - if swag.IsZero(m.Source) { // not required return nil } @@ -487,7 +483,6 @@ func (m *Job) validateStatusEnum(path, location string, value string) error { } func (m *Job) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } @@ -536,7 +531,6 @@ func (m *Job) validateTargetEnum(path, location string, value string) error { } func (m *Job) validateTarget(formats strfmt.Registry) error { - if swag.IsZero(m.Target) { // not required return nil } @@ -585,7 +579,6 @@ func (m *Job) validateTypeEnum(path, location string, value string) error { } func (m *Job) validateType(formats strfmt.Registry) error { - if swag.IsZero(m.Type) { // not required return nil } @@ -598,6 +591,11 @@ func (m *Job) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validates this job based on context it is used +func (m *Job) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Job) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/job_request.go b/api/sf-gate/sf_gate_models/job_request.go index bd1c217..7b8244b 100644 --- a/api/sf-gate/sf_gate_models/job_request.go +++ b/api/sf-gate/sf_gate_models/job_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -93,6 +94,56 @@ func (m *JobRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this job request based on the context it is used +func (m *JobRequest) 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 *JobRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *JobRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *JobRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/job_response.go b/api/sf-gate/sf_gate_models/job_response.go index 3dd1fc0..21db4f6 100644 --- a/api/sf-gate/sf_gate_models/job_response.go +++ b/api/sf-gate/sf_gate_models/job_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *JobResponse) Validate(formats strfmt.Registry) error { } func (m *JobResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *JobResponse) validateData(formats strfmt.Registry) error { } func (m *JobResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *JobResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this job response based on the context it is used +func (m *JobResponse) 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 *JobResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *JobResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *JobResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/license.go b/api/sf-gate/sf_gate_models/license.go index c51baf5..0c575df 100644 --- a/api/sf-gate/sf_gate_models/license.go +++ b/api/sf-gate/sf_gate_models/license.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -76,6 +78,11 @@ func (m *License) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this license based on context it is used +func (m *License) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *License) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/license_request.go b/api/sf-gate/sf_gate_models/license_request.go index b42b9ca..572b8d4 100644 --- a/api/sf-gate/sf_gate_models/license_request.go +++ b/api/sf-gate/sf_gate_models/license_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LicenseRequest) Validate(formats strfmt.Registry) error { } func (m *LicenseRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LicenseRequest) validateData(formats strfmt.Registry) error { } func (m *LicenseRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LicenseRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license request based on the context it is used +func (m *LicenseRequest) 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 *LicenseRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LicenseRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/license_response.go b/api/sf-gate/sf_gate_models/license_response.go index c31f4d0..38d5b6c 100644 --- a/api/sf-gate/sf_gate_models/license_response.go +++ b/api/sf-gate/sf_gate_models/license_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LicenseResponse) Validate(formats strfmt.Registry) error { } func (m *LicenseResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LicenseResponse) validateData(formats strfmt.Registry) error { } func (m *LicenseResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LicenseResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license response based on the context it is used +func (m *LicenseResponse) 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 *LicenseResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LicenseResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/license_type.go b/api/sf-gate/sf_gate_models/license_type.go index dcfb357..db5427b 100644 --- a/api/sf-gate/sf_gate_models/license_type.go +++ b/api/sf-gate/sf_gate_models/license_type.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -95,7 +96,6 @@ func (m *LicenseType) Validate(formats strfmt.Registry) error { } func (m *LicenseType) validateJurisdictions(formats strfmt.Registry) error { - if swag.IsZero(m.Jurisdictions) { // not required return nil } @@ -119,6 +119,38 @@ func (m *LicenseType) validateJurisdictions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license type based on the context it is used +func (m *LicenseType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateJurisdictions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LicenseType) contextValidateJurisdictions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Jurisdictions); i++ { + + if m.Jurisdictions[i] != nil { + if err := m.Jurisdictions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jurisdictions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/license_type_response.go b/api/sf-gate/sf_gate_models/license_type_response.go index 5d40214..6f71cbd 100644 --- a/api/sf-gate/sf_gate_models/license_type_response.go +++ b/api/sf-gate/sf_gate_models/license_type_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *LicenseTypeResponse) Validate(formats strfmt.Registry) error { } func (m *LicenseTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *LicenseTypeResponse) validateData(formats strfmt.Registry) error { } func (m *LicenseTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *LicenseTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this license type response based on the context it is used +func (m *LicenseTypeResponse) 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 *LicenseTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *LicenseTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LicenseTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/message.go b/api/sf-gate/sf_gate_models/message.go index 965517e..7f3a734 100644 --- a/api/sf-gate/sf_gate_models/message.go +++ b/api/sf-gate/sf_gate_models/message.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Message) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this message based on context it is used +func (m *Message) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Message) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/notebook.go b/api/sf-gate/sf_gate_models/notebook.go index 5e21cf6..3e4274d 100644 --- a/api/sf-gate/sf_gate_models/notebook.go +++ b/api/sf-gate/sf_gate_models/notebook.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -89,7 +90,6 @@ func (m *Notebook) Validate(formats strfmt.Registry) error { } func (m *Notebook) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -113,6 +113,38 @@ func (m *Notebook) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this notebook based on the context it is used +func (m *Notebook) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Notebook) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Notebook) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/notebook_item.go b/api/sf-gate/sf_gate_models/notebook_item.go index 0d0d0eb..3c1adfd 100644 --- a/api/sf-gate/sf_gate_models/notebook_item.go +++ b/api/sf-gate/sf_gate_models/notebook_item.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *NotebookItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this notebook item based on context it is used +func (m *NotebookItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NotebookItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/notebook_request.go b/api/sf-gate/sf_gate_models/notebook_request.go index c6918d8..9af1b3e 100644 --- a/api/sf-gate/sf_gate_models/notebook_request.go +++ b/api/sf-gate/sf_gate_models/notebook_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *NotebookRequest) Validate(formats strfmt.Registry) error { } func (m *NotebookRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *NotebookRequest) validateData(formats strfmt.Registry) error { } func (m *NotebookRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *NotebookRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this notebook request based on the context it is used +func (m *NotebookRequest) 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 *NotebookRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NotebookRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *NotebookRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/notebook_response.go b/api/sf-gate/sf_gate_models/notebook_response.go index cdd814a..2e806fb 100644 --- a/api/sf-gate/sf_gate_models/notebook_response.go +++ b/api/sf-gate/sf_gate_models/notebook_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *NotebookResponse) Validate(formats strfmt.Registry) error { } func (m *NotebookResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *NotebookResponse) validateData(formats strfmt.Registry) error { } func (m *NotebookResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *NotebookResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this notebook response based on the context it is used +func (m *NotebookResponse) 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 *NotebookResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NotebookResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *NotebookResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/order.go b/api/sf-gate/sf_gate_models/order.go index dec5a94..09cac07 100644 --- a/api/sf-gate/sf_gate_models/order.go +++ b/api/sf-gate/sf_gate_models/order.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -247,7 +248,6 @@ func (m *Order) Validate(formats strfmt.Registry) error { } func (m *Order) validateBillingaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Billingaddress) { // not required return nil } @@ -265,7 +265,6 @@ func (m *Order) validateBillingaddress(formats strfmt.Registry) error { } func (m *Order) validateContract(formats strfmt.Registry) error { - if swag.IsZero(m.Contract) { // not required return nil } @@ -283,7 +282,6 @@ func (m *Order) validateContract(formats strfmt.Registry) error { } func (m *Order) validateCoordinate(formats strfmt.Registry) error { - if swag.IsZero(m.Coordinate) { // not required return nil } @@ -301,7 +299,6 @@ func (m *Order) validateCoordinate(formats strfmt.Registry) error { } func (m *Order) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -326,7 +323,6 @@ func (m *Order) validateItems(formats strfmt.Registry) error { } func (m *Order) validateShippingaddress(formats strfmt.Registry) error { - if swag.IsZero(m.Shippingaddress) { // not required return nil } @@ -344,7 +340,6 @@ func (m *Order) validateShippingaddress(formats strfmt.Registry) error { } func (m *Order) validateTaxitems(formats strfmt.Registry) error { - if swag.IsZero(m.Taxitems) { // not required return nil } @@ -368,6 +363,132 @@ func (m *Order) validateTaxitems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this order based on the context it is used +func (m *Order) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContract(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCoordinate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingaddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxitems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Order) contextValidateBillingaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Billingaddress != nil { + if err := m.Billingaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingaddress") + } + return err + } + } + + return nil +} + +func (m *Order) contextValidateContract(ctx context.Context, formats strfmt.Registry) error { + + if m.Contract != nil { + if err := m.Contract.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contract") + } + return err + } + } + + return nil +} + +func (m *Order) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error { + + if m.Coordinate != nil { + if err := m.Coordinate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("coordinate") + } + return err + } + } + + return nil +} + +func (m *Order) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Order) contextValidateShippingaddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Shippingaddress != nil { + if err := m.Shippingaddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("shippingaddress") + } + return err + } + } + + return nil +} + +func (m *Order) contextValidateTaxitems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxitems); i++ { + + if m.Taxitems[i] != nil { + if err := m.Taxitems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxitems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Order) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/order_basic.go b/api/sf-gate/sf_gate_models/order_basic.go index 0de201c..f6571c2 100644 --- a/api/sf-gate/sf_gate_models/order_basic.go +++ b/api/sf-gate/sf_gate_models/order_basic.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -82,7 +84,6 @@ func (m *OrderBasic) Validate(formats strfmt.Registry) error { } func (m *OrderBasic) validateCoordinate(formats strfmt.Registry) error { - if swag.IsZero(m.Coordinate) { // not required return nil } @@ -100,7 +101,6 @@ func (m *OrderBasic) validateCoordinate(formats strfmt.Registry) error { } func (m *OrderBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -117,6 +117,52 @@ func (m *OrderBasic) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this order basic based on the context it is used +func (m *OrderBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCoordinate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OrderBasic) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error { + + if m.Coordinate != nil { + if err := m.Coordinate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("coordinate") + } + return err + } + } + + return nil +} + +func (m *OrderBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + if m.Items != nil { + if err := m.Items.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OrderBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/order_basic_request.go b/api/sf-gate/sf_gate_models/order_basic_request.go index 30c191b..98fd98c 100644 --- a/api/sf-gate/sf_gate_models/order_basic_request.go +++ b/api/sf-gate/sf_gate_models/order_basic_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *OrderBasicRequest) Validate(formats strfmt.Registry) error { } func (m *OrderBasicRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *OrderBasicRequest) validateData(formats strfmt.Registry) error { } func (m *OrderBasicRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *OrderBasicRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this order basic request based on the context it is used +func (m *OrderBasicRequest) 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 *OrderBasicRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *OrderBasicRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OrderBasicRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/order_item.go b/api/sf-gate/sf_gate_models/order_item.go index 108e7dd..a5fdc44 100644 --- a/api/sf-gate/sf_gate_models/order_item.go +++ b/api/sf-gate/sf_gate_models/order_item.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -148,6 +150,11 @@ func (m *OrderItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this order item based on context it is used +func (m *OrderItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *OrderItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/order_response.go b/api/sf-gate/sf_gate_models/order_response.go index db23e3f..18ad616 100644 --- a/api/sf-gate/sf_gate_models/order_response.go +++ b/api/sf-gate/sf_gate_models/order_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *OrderResponse) Validate(formats strfmt.Registry) error { } func (m *OrderResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *OrderResponse) validateData(formats strfmt.Registry) error { } func (m *OrderResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *OrderResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this order response based on the context it is used +func (m *OrderResponse) 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 *OrderResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *OrderResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OrderResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/pagination.go b/api/sf-gate/sf_gate_models/pagination.go index c46aa2f..f2f1faf 100644 --- a/api/sf-gate/sf_gate_models/pagination.go +++ b/api/sf-gate/sf_gate_models/pagination.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/period.go b/api/sf-gate/sf_gate_models/period.go index 421eb3b..31ee3d5 100644 --- a/api/sf-gate/sf_gate_models/period.go +++ b/api/sf-gate/sf_gate_models/period.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -67,6 +69,11 @@ func (m *Period) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this period based on context it is used +func (m *Period) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Period) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/period_request.go b/api/sf-gate/sf_gate_models/period_request.go index 215ca93..7f6a010 100644 --- a/api/sf-gate/sf_gate_models/period_request.go +++ b/api/sf-gate/sf_gate_models/period_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PeriodRequest) Validate(formats strfmt.Registry) error { } func (m *PeriodRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PeriodRequest) validateData(formats strfmt.Registry) error { } func (m *PeriodRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PeriodRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this period request based on the context it is used +func (m *PeriodRequest) 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 *PeriodRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PeriodRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PeriodRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/period_response.go b/api/sf-gate/sf_gate_models/period_response.go index 0a76c27..efb5f28 100644 --- a/api/sf-gate/sf_gate_models/period_response.go +++ b/api/sf-gate/sf_gate_models/period_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PeriodResponse) Validate(formats strfmt.Registry) error { } func (m *PeriodResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PeriodResponse) validateData(formats strfmt.Registry) error { } func (m *PeriodResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PeriodResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this period response based on the context it is used +func (m *PeriodResponse) 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 *PeriodResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PeriodResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PeriodResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/place.go b/api/sf-gate/sf_gate_models/place.go index cadc6d7..e9ea2d0 100644 --- a/api/sf-gate/sf_gate_models/place.go +++ b/api/sf-gate/sf_gate_models/place.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -161,7 +162,6 @@ func (m *Place) Validate(formats strfmt.Registry) error { } func (m *Place) validateTaxinstances(formats strfmt.Registry) error { - if swag.IsZero(m.Taxinstances) { // not required return nil } @@ -185,6 +185,38 @@ func (m *Place) validateTaxinstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this place based on the context it is used +func (m *Place) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxinstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Place) contextValidateTaxinstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxinstances); i++ { + + if m.Taxinstances[i] != nil { + if err := m.Taxinstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxinstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Place) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/place_response.go b/api/sf-gate/sf_gate_models/place_response.go index 12816ec..783a6ef 100644 --- a/api/sf-gate/sf_gate_models/place_response.go +++ b/api/sf-gate/sf_gate_models/place_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PlaceResponse) Validate(formats strfmt.Registry) error { } func (m *PlaceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PlaceResponse) validateData(formats strfmt.Registry) error { } func (m *PlaceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PlaceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this place response based on the context it is used +func (m *PlaceResponse) 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 *PlaceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlaceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PlaceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/pricebook.go b/api/sf-gate/sf_gate_models/pricebook.go index bbe9a4a..1f773f4 100644 --- a/api/sf-gate/sf_gate_models/pricebook.go +++ b/api/sf-gate/sf_gate_models/pricebook.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -43,6 +45,11 @@ func (m *Pricebook) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pricebook based on context it is used +func (m *Pricebook) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pricebook) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/pricebook_entry.go b/api/sf-gate/sf_gate_models/pricebook_entry.go index cd23239..b5d0f97 100644 --- a/api/sf-gate/sf_gate_models/pricebook_entry.go +++ b/api/sf-gate/sf_gate_models/pricebook_entry.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -67,7 +69,6 @@ func (m *PricebookEntry) Validate(formats strfmt.Registry) error { } func (m *PricebookEntry) validatePricebook(formats strfmt.Registry) error { - if swag.IsZero(m.Pricebook) { // not required return nil } @@ -85,7 +86,6 @@ func (m *PricebookEntry) validatePricebook(formats strfmt.Registry) error { } func (m *PricebookEntry) validateProcuct(formats strfmt.Registry) error { - if swag.IsZero(m.Procuct) { // not required return nil } @@ -102,6 +102,52 @@ func (m *PricebookEntry) validateProcuct(formats strfmt.Registry) error { return nil } +// ContextValidate validate this pricebook entry based on the context it is used +func (m *PricebookEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePricebook(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProcuct(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PricebookEntry) contextValidatePricebook(ctx context.Context, formats strfmt.Registry) error { + + if m.Pricebook != nil { + if err := m.Pricebook.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pricebook") + } + return err + } + } + + return nil +} + +func (m *PricebookEntry) contextValidateProcuct(ctx context.Context, formats strfmt.Registry) error { + + if m.Procuct != nil { + if err := m.Procuct.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("procuct") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PricebookEntry) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/product.go b/api/sf-gate/sf_gate_models/product.go index d66b97d..ab3ed4d 100644 --- a/api/sf-gate/sf_gate_models/product.go +++ b/api/sf-gate/sf_gate_models/product.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -142,6 +144,11 @@ func (m *Product) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this product based on context it is used +func (m *Product) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Product) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/product_request.go b/api/sf-gate/sf_gate_models/product_request.go index 29bba0f..0ea2f18 100644 --- a/api/sf-gate/sf_gate_models/product_request.go +++ b/api/sf-gate/sf_gate_models/product_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ProductRequest) Validate(formats strfmt.Registry) error { } func (m *ProductRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ProductRequest) validateData(formats strfmt.Registry) error { } func (m *ProductRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ProductRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this product request based on the context it is used +func (m *ProductRequest) 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 *ProductRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/product_response.go b/api/sf-gate/sf_gate_models/product_response.go index d6462e1..1956ff9 100644 --- a/api/sf-gate/sf_gate_models/product_response.go +++ b/api/sf-gate/sf_gate_models/product_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ProductResponse) Validate(formats strfmt.Registry) error { } func (m *ProductResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ProductResponse) validateData(formats strfmt.Registry) error { } func (m *ProductResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ProductResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this product response based on the context it is used +func (m *ProductResponse) 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 *ProductResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProductResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ProductResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/purchase_order.go b/api/sf-gate/sf_gate_models/purchase_order.go index ef7ea78..88c06db 100644 --- a/api/sf-gate/sf_gate_models/purchase_order.go +++ b/api/sf-gate/sf_gate_models/purchase_order.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -168,7 +169,6 @@ func (m *PurchaseOrder) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -193,7 +193,6 @@ func (m *PurchaseOrder) validateItems(formats strfmt.Registry) error { } func (m *PurchaseOrder) validateTaxitems(formats strfmt.Registry) error { - if swag.IsZero(m.Taxitems) { // not required return nil } @@ -217,6 +216,60 @@ func (m *PurchaseOrder) validateTaxitems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order based on the context it is used +func (m *PurchaseOrder) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxitems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrder) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrder) contextValidateTaxitems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxitems); i++ { + + if m.Taxitems[i] != nil { + if err := m.Taxitems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxitems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrder) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/purchase_order_basic.go b/api/sf-gate/sf_gate_models/purchase_order_basic.go index b20d580..f71fa50 100644 --- a/api/sf-gate/sf_gate_models/purchase_order_basic.go +++ b/api/sf-gate/sf_gate_models/purchase_order_basic.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -78,7 +79,6 @@ func (m *PurchaseOrderBasic) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderBasic) validateCoordinate(formats strfmt.Registry) error { - if swag.IsZero(m.Coordinate) { // not required return nil } @@ -96,7 +96,6 @@ func (m *PurchaseOrderBasic) validateCoordinate(formats strfmt.Registry) error { } func (m *PurchaseOrderBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -120,6 +119,56 @@ func (m *PurchaseOrderBasic) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order basic based on the context it is used +func (m *PurchaseOrderBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCoordinate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderBasic) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error { + + if m.Coordinate != nil { + if err := m.Coordinate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("coordinate") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrderBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/purchase_order_item.go b/api/sf-gate/sf_gate_models/purchase_order_item.go index 472dde0..068cdbb 100644 --- a/api/sf-gate/sf_gate_models/purchase_order_item.go +++ b/api/sf-gate/sf_gate_models/purchase_order_item.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -112,6 +114,11 @@ func (m *PurchaseOrderItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this purchase order item based on context it is used +func (m *PurchaseOrderItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/purchase_order_request.go b/api/sf-gate/sf_gate_models/purchase_order_request.go index 760f6ae..4deb472 100644 --- a/api/sf-gate/sf_gate_models/purchase_order_request.go +++ b/api/sf-gate/sf_gate_models/purchase_order_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PurchaseOrderRequest) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PurchaseOrderRequest) validateData(formats strfmt.Registry) error { } func (m *PurchaseOrderRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PurchaseOrderRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order request based on the context it is used +func (m *PurchaseOrderRequest) 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 *PurchaseOrderRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/purchase_order_response.go b/api/sf-gate/sf_gate_models/purchase_order_response.go index 52a9fc8..b74bdb7 100644 --- a/api/sf-gate/sf_gate_models/purchase_order_response.go +++ b/api/sf-gate/sf_gate_models/purchase_order_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PurchaseOrderResponse) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PurchaseOrderResponse) validateData(formats strfmt.Registry) error { } func (m *PurchaseOrderResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PurchaseOrderResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order response based on the context it is used +func (m *PurchaseOrderResponse) 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 *PurchaseOrderResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/quote.go b/api/sf-gate/sf_gate_models/quote.go index 451b9f8..84433d5 100644 --- a/api/sf-gate/sf_gate_models/quote.go +++ b/api/sf-gate/sf_gate_models/quote.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -204,7 +205,6 @@ func (m *Quote) Validate(formats strfmt.Registry) error { } func (m *Quote) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -229,7 +229,6 @@ func (m *Quote) validateItems(formats strfmt.Registry) error { } func (m *Quote) validateTaxitems(formats strfmt.Registry) error { - if swag.IsZero(m.Taxitems) { // not required return nil } @@ -253,6 +252,60 @@ func (m *Quote) validateTaxitems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this quote based on the context it is used +func (m *Quote) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxitems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Quote) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Quote) contextValidateTaxitems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxitems); i++ { + + if m.Taxitems[i] != nil { + if err := m.Taxitems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxitems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Quote) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/quote_basic.go b/api/sf-gate/sf_gate_models/quote_basic.go index bdf7acb..ba3293a 100644 --- a/api/sf-gate/sf_gate_models/quote_basic.go +++ b/api/sf-gate/sf_gate_models/quote_basic.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -84,7 +85,6 @@ func (m *QuoteBasic) Validate(formats strfmt.Registry) error { } func (m *QuoteBasic) validateCoordinate(formats strfmt.Registry) error { - if swag.IsZero(m.Coordinate) { // not required return nil } @@ -102,7 +102,6 @@ func (m *QuoteBasic) validateCoordinate(formats strfmt.Registry) error { } func (m *QuoteBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -126,6 +125,56 @@ func (m *QuoteBasic) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this quote basic based on the context it is used +func (m *QuoteBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCoordinate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *QuoteBasic) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error { + + if m.Coordinate != nil { + if err := m.Coordinate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("coordinate") + } + return err + } + } + + return nil +} + +func (m *QuoteBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *QuoteBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/quote_item.go b/api/sf-gate/sf_gate_models/quote_item.go index de869cd..868f25a 100644 --- a/api/sf-gate/sf_gate_models/quote_item.go +++ b/api/sf-gate/sf_gate_models/quote_item.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -91,6 +93,11 @@ func (m *QuoteItem) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this quote item based on context it is used +func (m *QuoteItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *QuoteItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/quote_item_basic.go b/api/sf-gate/sf_gate_models/quote_item_basic.go index 03a5af0..1c1fe54 100644 --- a/api/sf-gate/sf_gate_models/quote_item_basic.go +++ b/api/sf-gate/sf_gate_models/quote_item_basic.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -61,6 +63,11 @@ func (m *QuoteItemBasic) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this quote item basic based on context it is used +func (m *QuoteItemBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *QuoteItemBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/quote_response.go b/api/sf-gate/sf_gate_models/quote_response.go index 0b2e0a2..3bf3f90 100644 --- a/api/sf-gate/sf_gate_models/quote_response.go +++ b/api/sf-gate/sf_gate_models/quote_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *QuoteResponse) Validate(formats strfmt.Registry) error { } func (m *QuoteResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *QuoteResponse) validateData(formats strfmt.Registry) error { } func (m *QuoteResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *QuoteResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this quote response based on the context it is used +func (m *QuoteResponse) 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 *QuoteResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *QuoteResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *QuoteResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/request_meta.go b/api/sf-gate/sf_gate_models/request_meta.go index d5790f2..663213e 100644 --- a/api/sf-gate/sf_gate_models/request_meta.go +++ b/api/sf-gate/sf_gate_models/request_meta.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/response_meta.go b/api/sf-gate/sf_gate_models/response_meta.go index 693627c..d8adba0 100644 --- a/api/sf-gate/sf_gate_models/response_meta.go +++ b/api/sf-gate/sf_gate_models/response_meta.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -78,7 +80,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -95,6 +96,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/role.go b/api/sf-gate/sf_gate_models/role.go index 8e4c7a8..af10b6e 100644 --- a/api/sf-gate/sf_gate_models/role.go +++ b/api/sf-gate/sf_gate_models/role.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -52,6 +54,11 @@ func (m *Role) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this role based on context it is used +func (m *Role) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Role) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/role_request.go b/api/sf-gate/sf_gate_models/role_request.go index 0d7e15c..3163b90 100644 --- a/api/sf-gate/sf_gate_models/role_request.go +++ b/api/sf-gate/sf_gate_models/role_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *RoleRequest) Validate(formats strfmt.Registry) error { } func (m *RoleRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *RoleRequest) validateData(formats strfmt.Registry) error { } func (m *RoleRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *RoleRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this role request based on the context it is used +func (m *RoleRequest) 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 *RoleRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RoleRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *RoleRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/role_response.go b/api/sf-gate/sf_gate_models/role_response.go index 6ca18ab..20d8546 100644 --- a/api/sf-gate/sf_gate_models/role_response.go +++ b/api/sf-gate/sf_gate_models/role_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *RoleResponse) Validate(formats strfmt.Registry) error { } func (m *RoleResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *RoleResponse) validateData(formats strfmt.Registry) error { } func (m *RoleResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *RoleResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this role response based on the context it is used +func (m *RoleResponse) 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 *RoleResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RoleResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *RoleResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/service.go b/api/sf-gate/sf_gate_models/service.go index 3e1a292..e5d6c91 100644 --- a/api/sf-gate/sf_gate_models/service.go +++ b/api/sf-gate/sf_gate_models/service.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -94,6 +96,11 @@ func (m *Service) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service based on context it is used +func (m *Service) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Service) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/service_request.go b/api/sf-gate/sf_gate_models/service_request.go index 7618570..041bd25 100644 --- a/api/sf-gate/sf_gate_models/service_request.go +++ b/api/sf-gate/sf_gate_models/service_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -93,6 +94,56 @@ func (m *ServiceRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this service request based on the context it is used +func (m *ServiceRequest) 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 *ServiceRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ServiceRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/service_response.go b/api/sf-gate/sf_gate_models/service_response.go index b48ded6..d5543f9 100644 --- a/api/sf-gate/sf_gate_models/service_response.go +++ b/api/sf-gate/sf_gate_models/service_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *ServiceResponse) Validate(formats strfmt.Registry) error { } func (m *ServiceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *ServiceResponse) validateData(formats strfmt.Registry) error { } func (m *ServiceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *ServiceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this service response based on the context it is used +func (m *ServiceResponse) 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 *ServiceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ServiceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/state.go b/api/sf-gate/sf_gate_models/state.go index 4e6e4b5..88bcb4d 100644 --- a/api/sf-gate/sf_gate_models/state.go +++ b/api/sf-gate/sf_gate_models/state.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -146,7 +147,6 @@ func (m *State) Validate(formats strfmt.Registry) error { } func (m *State) validateTaxinstances(formats strfmt.Registry) error { - if swag.IsZero(m.Taxinstances) { // not required return nil } @@ -170,6 +170,38 @@ func (m *State) validateTaxinstances(formats strfmt.Registry) error { return nil } +// ContextValidate validate this state based on the context it is used +func (m *State) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxinstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *State) contextValidateTaxinstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Taxinstances); i++ { + + if m.Taxinstances[i] != nil { + if err := m.Taxinstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxinstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *State) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/state_response.go b/api/sf-gate/sf_gate_models/state_response.go index 0efef67..c90c119 100644 --- a/api/sf-gate/sf_gate_models/state_response.go +++ b/api/sf-gate/sf_gate_models/state_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *StateResponse) Validate(formats strfmt.Registry) error { } func (m *StateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *StateResponse) validateData(formats strfmt.Registry) error { } func (m *StateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *StateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this state response based on the context it is used +func (m *StateResponse) 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 *StateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *StateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/statement.go b/api/sf-gate/sf_gate_models/statement.go index f893fd7..bddd961 100644 --- a/api/sf-gate/sf_gate_models/statement.go +++ b/api/sf-gate/sf_gate_models/statement.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -85,6 +87,11 @@ func (m *Statement) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this statement based on context it is used +func (m *Statement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Statement) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/statement_request.go b/api/sf-gate/sf_gate_models/statement_request.go index 9fcf30d..0175634 100644 --- a/api/sf-gate/sf_gate_models/statement_request.go +++ b/api/sf-gate/sf_gate_models/statement_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *StatementRequest) Validate(formats strfmt.Registry) error { } func (m *StatementRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *StatementRequest) validateData(formats strfmt.Registry) error { } func (m *StatementRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *StatementRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this statement request based on the context it is used +func (m *StatementRequest) 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 *StatementRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatementRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *StatementRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/statement_response.go b/api/sf-gate/sf_gate_models/statement_response.go index 11c9a97..62a31fa 100644 --- a/api/sf-gate/sf_gate_models/statement_response.go +++ b/api/sf-gate/sf_gate_models/statement_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *StatementResponse) Validate(formats strfmt.Registry) error { } func (m *StatementResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *StatementResponse) validateData(formats strfmt.Registry) error { } func (m *StatementResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *StatementResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this statement response based on the context it is used +func (m *StatementResponse) 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 *StatementResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatementResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *StatementResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/submission.go b/api/sf-gate/sf_gate_models/submission.go index b5c5984..def375e 100644 --- a/api/sf-gate/sf_gate_models/submission.go +++ b/api/sf-gate/sf_gate_models/submission.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -103,6 +105,11 @@ func (m *Submission) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this submission based on context it is used +func (m *Submission) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Submission) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/submission_request.go b/api/sf-gate/sf_gate_models/submission_request.go index 5e3fc56..d8df2f7 100644 --- a/api/sf-gate/sf_gate_models/submission_request.go +++ b/api/sf-gate/sf_gate_models/submission_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SubmissionRequest) Validate(formats strfmt.Registry) error { } func (m *SubmissionRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SubmissionRequest) validateData(formats strfmt.Registry) error { } func (m *SubmissionRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SubmissionRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this submission request based on the context it is used +func (m *SubmissionRequest) 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 *SubmissionRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SubmissionRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SubmissionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/submission_response.go b/api/sf-gate/sf_gate_models/submission_response.go index 7c90916..8260472 100644 --- a/api/sf-gate/sf_gate_models/submission_response.go +++ b/api/sf-gate/sf_gate_models/submission_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SubmissionResponse) Validate(formats strfmt.Registry) error { } func (m *SubmissionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SubmissionResponse) validateData(formats strfmt.Registry) error { } func (m *SubmissionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SubmissionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this submission response based on the context it is used +func (m *SubmissionResponse) 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 *SubmissionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SubmissionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SubmissionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/subscription.go b/api/sf-gate/sf_gate_models/subscription.go index 57c192b..9fb7df9 100644 --- a/api/sf-gate/sf_gate_models/subscription.go +++ b/api/sf-gate/sf_gate_models/subscription.go @@ -10,6 +10,8 @@ package sf_gate_models // 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" @@ -156,7 +158,6 @@ func (m *Subscription) Validate(formats strfmt.Registry) error { } func (m *Subscription) validateContract(formats strfmt.Registry) error { - if swag.IsZero(m.Contract) { // not required return nil } @@ -173,6 +174,34 @@ func (m *Subscription) validateContract(formats strfmt.Registry) error { return nil } +// ContextValidate validate this subscription based on the context it is used +func (m *Subscription) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateContract(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Subscription) contextValidateContract(ctx context.Context, formats strfmt.Registry) error { + + if m.Contract != nil { + if err := m.Contract.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contract") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Subscription) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/subscription_request.go b/api/sf-gate/sf_gate_models/subscription_request.go index c66b1d1..a406402 100644 --- a/api/sf-gate/sf_gate_models/subscription_request.go +++ b/api/sf-gate/sf_gate_models/subscription_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SubscriptionRequest) Validate(formats strfmt.Registry) error { } func (m *SubscriptionRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SubscriptionRequest) validateData(formats strfmt.Registry) error { } func (m *SubscriptionRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SubscriptionRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this subscription request based on the context it is used +func (m *SubscriptionRequest) 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 *SubscriptionRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SubscriptionRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SubscriptionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/subscription_response.go b/api/sf-gate/sf_gate_models/subscription_response.go index d34d5c2..997159c 100644 --- a/api/sf-gate/sf_gate_models/subscription_response.go +++ b/api/sf-gate/sf_gate_models/subscription_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *SubscriptionResponse) Validate(formats strfmt.Registry) error { } func (m *SubscriptionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *SubscriptionResponse) validateData(formats strfmt.Registry) error { } func (m *SubscriptionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *SubscriptionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this subscription response based on the context it is used +func (m *SubscriptionResponse) 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 *SubscriptionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SubscriptionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SubscriptionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_instance.go b/api/sf-gate/sf_gate_models/tax_instance.go index 8c4656b..96242d0 100644 --- a/api/sf-gate/sf_gate_models/tax_instance.go +++ b/api/sf-gate/sf_gate_models/tax_instance.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -55,6 +57,11 @@ func (m *TaxInstance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax instance based on context it is used +func (m *TaxInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_invoices_request.go b/api/sf-gate/sf_gate_models/tax_invoices_request.go index 9459658..bcadf7e 100644 --- a/api/sf-gate/sf_gate_models/tax_invoices_request.go +++ b/api/sf-gate/sf_gate_models/tax_invoices_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxInvoicesRequest) Validate(formats strfmt.Registry) error { } func (m *TaxInvoicesRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxInvoicesRequest) validateData(formats strfmt.Registry) error { } func (m *TaxInvoicesRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxInvoicesRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax invoices request based on the context it is used +func (m *TaxInvoicesRequest) 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 *TaxInvoicesRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxInvoicesRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxInvoicesRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_orders_request.go b/api/sf-gate/sf_gate_models/tax_orders_request.go index d7f7d86..7005b5d 100644 --- a/api/sf-gate/sf_gate_models/tax_orders_request.go +++ b/api/sf-gate/sf_gate_models/tax_orders_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxOrdersRequest) Validate(formats strfmt.Registry) error { } func (m *TaxOrdersRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxOrdersRequest) validateData(formats strfmt.Registry) error { } func (m *TaxOrdersRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxOrdersRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax orders request based on the context it is used +func (m *TaxOrdersRequest) 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 *TaxOrdersRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxOrdersRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxOrdersRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_purchase_orders_request.go b/api/sf-gate/sf_gate_models/tax_purchase_orders_request.go index 46a9de5..a246586 100644 --- a/api/sf-gate/sf_gate_models/tax_purchase_orders_request.go +++ b/api/sf-gate/sf_gate_models/tax_purchase_orders_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxPurchaseOrdersRequest) Validate(formats strfmt.Registry) error { } func (m *TaxPurchaseOrdersRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxPurchaseOrdersRequest) validateData(formats strfmt.Registry) error { } func (m *TaxPurchaseOrdersRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxPurchaseOrdersRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax purchase orders request based on the context it is used +func (m *TaxPurchaseOrdersRequest) 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 *TaxPurchaseOrdersRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxPurchaseOrdersRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxPurchaseOrdersRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_quotes_request.go b/api/sf-gate/sf_gate_models/tax_quotes_request.go index 63598b6..7f8b065 100644 --- a/api/sf-gate/sf_gate_models/tax_quotes_request.go +++ b/api/sf-gate/sf_gate_models/tax_quotes_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxQuotesRequest) Validate(formats strfmt.Registry) error { } func (m *TaxQuotesRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxQuotesRequest) validateData(formats strfmt.Registry) error { } func (m *TaxQuotesRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxQuotesRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax quotes request based on the context it is used +func (m *TaxQuotesRequest) 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 *TaxQuotesRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxQuotesRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxQuotesRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_transaction.go b/api/sf-gate/sf_gate_models/tax_transaction.go index ea27293..5144636 100644 --- a/api/sf-gate/sf_gate_models/tax_transaction.go +++ b/api/sf-gate/sf_gate_models/tax_transaction.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -109,6 +111,11 @@ func (m *TaxTransaction) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax transaction based on context it is used +func (m *TaxTransaction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxTransaction) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_transaction_response.go b/api/sf-gate/sf_gate_models/tax_transaction_response.go index 8051d58..0f54875 100644 --- a/api/sf-gate/sf_gate_models/tax_transaction_response.go +++ b/api/sf-gate/sf_gate_models/tax_transaction_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxTransactionResponse) Validate(formats strfmt.Registry) error { } func (m *TaxTransactionResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxTransactionResponse) validateData(formats strfmt.Registry) error { } func (m *TaxTransactionResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxTransactionResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax transaction response based on the context it is used +func (m *TaxTransactionResponse) 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 *TaxTransactionResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxTransactionResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTransactionResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_type.go b/api/sf-gate/sf_gate_models/tax_type.go index 4161abb..f5cdef0 100644 --- a/api/sf-gate/sf_gate_models/tax_type.go +++ b/api/sf-gate/sf_gate_models/tax_type.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -169,6 +171,11 @@ func (m *TaxType) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax type based on context it is used +func (m *TaxType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_type_account.go b/api/sf-gate/sf_gate_models/tax_type_account.go index ec08ace..ca25cd0 100644 --- a/api/sf-gate/sf_gate_models/tax_type_account.go +++ b/api/sf-gate/sf_gate_models/tax_type_account.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -124,6 +126,11 @@ func (m *TaxTypeAccount) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tax type account based on context it is used +func (m *TaxTypeAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeAccount) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_type_account_request.go b/api/sf-gate/sf_gate_models/tax_type_account_request.go index e98e148..39d3807 100644 --- a/api/sf-gate/sf_gate_models/tax_type_account_request.go +++ b/api/sf-gate/sf_gate_models/tax_type_account_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxTypeAccountRequest) Validate(formats strfmt.Registry) error { } func (m *TaxTypeAccountRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxTypeAccountRequest) validateData(formats strfmt.Registry) error { } func (m *TaxTypeAccountRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxTypeAccountRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax type account request based on the context it is used +func (m *TaxTypeAccountRequest) 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 *TaxTypeAccountRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxTypeAccountRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeAccountRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_type_account_response.go b/api/sf-gate/sf_gate_models/tax_type_account_response.go index 9e8c47d..0c87014 100644 --- a/api/sf-gate/sf_gate_models/tax_type_account_response.go +++ b/api/sf-gate/sf_gate_models/tax_type_account_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxTypeAccountResponse) Validate(formats strfmt.Registry) error { } func (m *TaxTypeAccountResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxTypeAccountResponse) validateData(formats strfmt.Registry) error { } func (m *TaxTypeAccountResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxTypeAccountResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax type account response based on the context it is used +func (m *TaxTypeAccountResponse) 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 *TaxTypeAccountResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxTypeAccountResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeAccountResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tax_type_response.go b/api/sf-gate/sf_gate_models/tax_type_response.go index d8420b1..2ad64d7 100644 --- a/api/sf-gate/sf_gate_models/tax_type_response.go +++ b/api/sf-gate/sf_gate_models/tax_type_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxTypeResponse) Validate(formats strfmt.Registry) error { } func (m *TaxTypeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxTypeResponse) validateData(formats strfmt.Registry) error { } func (m *TaxTypeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxTypeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tax type response based on the context it is used +func (m *TaxTypeResponse) 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 *TaxTypeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxTypeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxTypeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/taxnexus_code.go b/api/sf-gate/sf_gate_models/taxnexus_code.go index 8859ac7..3824c1c 100644 --- a/api/sf-gate/sf_gate_models/taxnexus_code.go +++ b/api/sf-gate/sf_gate_models/taxnexus_code.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -88,6 +90,11 @@ func (m *TaxnexusCode) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this taxnexus code based on context it is used +func (m *TaxnexusCode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaxnexusCode) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/taxnexus_code_response.go b/api/sf-gate/sf_gate_models/taxnexus_code_response.go index 4c89865..563222d 100644 --- a/api/sf-gate/sf_gate_models/taxnexus_code_response.go +++ b/api/sf-gate/sf_gate_models/taxnexus_code_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TaxnexusCodeResponse) Validate(formats strfmt.Registry) error { } func (m *TaxnexusCodeResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TaxnexusCodeResponse) validateData(formats strfmt.Registry) error { } func (m *TaxnexusCodeResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TaxnexusCodeResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this taxnexus code response based on the context it is used +func (m *TaxnexusCodeResponse) 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 *TaxnexusCodeResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TaxnexusCodeResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TaxnexusCodeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/template.go b/api/sf-gate/sf_gate_models/template.go index 2d54fa4..924c1ed 100644 --- a/api/sf-gate/sf_gate_models/template.go +++ b/api/sf-gate/sf_gate_models/template.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -74,6 +76,11 @@ func (m *Template) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this template based on context it is used +func (m *Template) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Template) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/template_response.go b/api/sf-gate/sf_gate_models/template_response.go index d0bc99a..b747365 100644 --- a/api/sf-gate/sf_gate_models/template_response.go +++ b/api/sf-gate/sf_gate_models/template_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TemplateResponse) Validate(formats strfmt.Registry) error { } func (m *TemplateResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TemplateResponse) validateData(formats strfmt.Registry) error { } func (m *TemplateResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TemplateResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this template response based on the context it is used +func (m *TemplateResponse) 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 *TemplateResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TemplateResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TemplateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tenant.go b/api/sf-gate/sf_gate_models/tenant.go index 9ac082f..b38eaee 100644 --- a/api/sf-gate/sf_gate_models/tenant.go +++ b/api/sf-gate/sf_gate_models/tenant.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -88,7 +89,6 @@ func (m *Tenant) Validate(formats strfmt.Registry) error { } func (m *Tenant) validateDatabases(formats strfmt.Registry) error { - if swag.IsZero(m.Databases) { // not required return nil } @@ -113,7 +113,6 @@ func (m *Tenant) validateDatabases(formats strfmt.Registry) error { } func (m *Tenant) validateRoles(formats strfmt.Registry) error { - if swag.IsZero(m.Roles) { // not required return nil } @@ -138,7 +137,6 @@ func (m *Tenant) validateRoles(formats strfmt.Registry) error { } func (m *Tenant) validateTenantusers(formats strfmt.Registry) error { - if swag.IsZero(m.Tenantusers) { // not required return nil } @@ -162,6 +160,82 @@ func (m *Tenant) validateTenantusers(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant based on the context it is used +func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDatabases(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRoles(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTenantusers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Tenant) contextValidateDatabases(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Databases); i++ { + + if m.Databases[i] != nil { + if err := m.Databases[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("databases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidateRoles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Roles); i++ { + + if m.Roles[i] != nil { + if err := m.Roles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("roles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidateTenantusers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tenantusers); i++ { + + if m.Tenantusers[i] != nil { + if err := m.Tenantusers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenantusers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Tenant) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tenant_request.go b/api/sf-gate/sf_gate_models/tenant_request.go index a08d146..1b4700f 100644 --- a/api/sf-gate/sf_gate_models/tenant_request.go +++ b/api/sf-gate/sf_gate_models/tenant_request.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TenantRequest) Validate(formats strfmt.Registry) error { } func (m *TenantRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TenantRequest) validateData(formats strfmt.Registry) error { } func (m *TenantRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TenantRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant request based on the context it is used +func (m *TenantRequest) 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 *TenantRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TenantRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TenantRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tenant_response.go b/api/sf-gate/sf_gate_models/tenant_response.go index daa5d75..c976ae9 100644 --- a/api/sf-gate/sf_gate_models/tenant_response.go +++ b/api/sf-gate/sf_gate_models/tenant_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *TenantResponse) Validate(formats strfmt.Registry) error { } func (m *TenantResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *TenantResponse) validateData(formats strfmt.Registry) error { } func (m *TenantResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *TenantResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant response based on the context it is used +func (m *TenantResponse) 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 *TenantResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TenantResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TenantResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/tenant_user.go b/api/sf-gate/sf_gate_models/tenant_user.go index e32b231..7e71082 100644 --- a/api/sf-gate/sf_gate_models/tenant_user.go +++ b/api/sf-gate/sf_gate_models/tenant_user.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *TenantUser) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tenant user based on context it is used +func (m *TenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TenantUser) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/user.go b/api/sf-gate/sf_gate_models/user.go index cd15161..c97f3a1 100644 --- a/api/sf-gate/sf_gate_models/user.go +++ b/api/sf-gate/sf_gate_models/user.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -220,7 +221,6 @@ func (m *User) Validate(formats strfmt.Registry) error { } func (m *User) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required return nil } @@ -238,7 +238,6 @@ func (m *User) validateAddress(formats strfmt.Registry) error { } func (m *User) validateTenantusers(formats strfmt.Registry) error { - if swag.IsZero(m.Tenantusers) { // not required return nil } @@ -263,7 +262,6 @@ func (m *User) validateTenantusers(formats strfmt.Registry) error { } func (m *User) validateUserroles(formats strfmt.Registry) error { - if swag.IsZero(m.Userroles) { // not required return nil } @@ -287,6 +285,78 @@ func (m *User) validateUserroles(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user based on the context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTenantusers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserroles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("address") + } + return err + } + } + + return nil +} + +func (m *User) contextValidateTenantusers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tenantusers); i++ { + + if m.Tenantusers[i] != nil { + if err := m.Tenantusers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenantusers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *User) contextValidateUserroles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Userroles); i++ { + + if m.Userroles[i] != nil { + if err := m.Userroles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userroles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *User) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/user_response.go b/api/sf-gate/sf_gate_models/user_response.go index 6d40b51..8c68ec1 100644 --- a/api/sf-gate/sf_gate_models/user_response.go +++ b/api/sf-gate/sf_gate_models/user_response.go @@ -10,6 +10,7 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *UserResponse) Validate(formats strfmt.Registry) error { } func (m *UserResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *UserResponse) validateData(formats strfmt.Registry) error { } func (m *UserResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *UserResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this user response based on the context it is used +func (m *UserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *UserResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/sf-gate/sf_gate_models/user_role.go b/api/sf-gate/sf_gate_models/user_role.go index 584e8aa..8ff69b3 100644 --- a/api/sf-gate/sf_gate_models/user_role.go +++ b/api/sf-gate/sf_gate_models/user_role.go @@ -10,6 +10,8 @@ package sf_gate_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *UserRole) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user role based on context it is used +func (m *UserRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserRole) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/stash/stash_client/stash_pdf/post_pdfs_parameters.go b/api/stash/stash_client/stash_pdf/post_pdfs_parameters.go index 2cecdc0..2f3228b 100644 --- a/api/stash/stash_client/stash_pdf/post_pdfs_parameters.go +++ b/api/stash/stash_client/stash_pdf/post_pdfs_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/stash/stash_models" ) -// NewPostPdfsParams creates a new PostPdfsParams object -// with the default values initialized. +// NewPostPdfsParams creates a new PostPdfsParams 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 NewPostPdfsParams() *PostPdfsParams { - var () return &PostPdfsParams{ - timeout: cr.DefaultTimeout, } } // NewPostPdfsParamsWithTimeout creates a new PostPdfsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostPdfsParamsWithTimeout(timeout time.Duration) *PostPdfsParams { - var () return &PostPdfsParams{ - timeout: timeout, } } // NewPostPdfsParamsWithContext creates a new PostPdfsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostPdfsParamsWithContext(ctx context.Context) *PostPdfsParams { - var () return &PostPdfsParams{ - Context: ctx, } } // NewPostPdfsParamsWithHTTPClient creates a new PostPdfsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostPdfsParamsWithHTTPClient(client *http.Client) *PostPdfsParams { - var () return &PostPdfsParams{ HTTPClient: client, } } -/*PostPdfsParams contains all the parameters to send to the API endpoint -for the post pdfs operation typically these are written to a http.Request +/* PostPdfsParams contains all the parameters to send to the API endpoint + for the post pdfs operation. + + Typically these are written to a http.Request. */ type PostPdfsParams struct { - /*PDFRequest - An array of new PDF records + /* PDFRequest. + An array of new PDF records */ PDFRequest *stash_models.PDFRequest @@ -77,6 +76,21 @@ type PostPdfsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post pdfs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPdfsParams) WithDefaults() *PostPdfsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post pdfs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostPdfsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post pdfs params func (o *PostPdfsParams) WithTimeout(timeout time.Duration) *PostPdfsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostPdfsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if o.PDFRequest != nil { if err := r.SetBodyParam(o.PDFRequest); err != nil { return err diff --git a/api/stash/stash_client/stash_pdf/post_pdfs_responses.go b/api/stash/stash_client/stash_pdf/post_pdfs_responses.go index 33895e5..c862429 100644 --- a/api/stash/stash_client/stash_pdf/post_pdfs_responses.go +++ b/api/stash/stash_client/stash_pdf/post_pdfs_responses.go @@ -63,9 +63,8 @@ func (o *PostPdfsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostPdfsOK() *PostPdfsOK { return &PostPdfsOK{} } -/*PostPdfsOK handles this case with default header values. +/* PostPdfsOK describes a response with status code 200, with default header values. Rendered documents response */ @@ -85,7 +84,6 @@ type PostPdfsOK struct { func (o *PostPdfsOK) Error() string { return fmt.Sprintf("[POST /pdfs][%d] postPdfsOK %+v", 200, o.Payload) } - func (o *PostPdfsOK) GetPayload() *stash_models.DocumentResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewPostPdfsUnauthorized() *PostPdfsUnauthorized { return &PostPdfsUnauthorized{} } -/*PostPdfsUnauthorized handles this case with default header values. +/* PostPdfsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type PostPdfsUnauthorized struct { func (o *PostPdfsUnauthorized) Error() string { return fmt.Sprintf("[POST /pdfs][%d] postPdfsUnauthorized %+v", 401, o.Payload) } - func (o *PostPdfsUnauthorized) GetPayload() *stash_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewPostPdfsForbidden() *PostPdfsForbidden { return &PostPdfsForbidden{} } -/*PostPdfsForbidden handles this case with default header values. +/* PostPdfsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type PostPdfsForbidden struct { func (o *PostPdfsForbidden) Error() string { return fmt.Sprintf("[POST /pdfs][%d] postPdfsForbidden %+v", 403, o.Payload) } - func (o *PostPdfsForbidden) GetPayload() *stash_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewPostPdfsNotFound() *PostPdfsNotFound { return &PostPdfsNotFound{} } -/*PostPdfsNotFound handles this case with default header values. +/* PostPdfsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type PostPdfsNotFound struct { func (o *PostPdfsNotFound) Error() string { return fmt.Sprintf("[POST /pdfs][%d] postPdfsNotFound %+v", 404, o.Payload) } - func (o *PostPdfsNotFound) GetPayload() *stash_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewPostPdfsUnprocessableEntity() *PostPdfsUnprocessableEntity { return &PostPdfsUnprocessableEntity{} } -/*PostPdfsUnprocessableEntity handles this case with default header values. +/* PostPdfsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type PostPdfsUnprocessableEntity struct { func (o *PostPdfsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pdfs][%d] postPdfsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostPdfsUnprocessableEntity) GetPayload() *stash_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewPostPdfsInternalServerError() *PostPdfsInternalServerError { return &PostPdfsInternalServerError{} } -/*PostPdfsInternalServerError handles this case with default header values. +/* PostPdfsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type PostPdfsInternalServerError struct { func (o *PostPdfsInternalServerError) Error() string { return fmt.Sprintf("[POST /pdfs][%d] postPdfsInternalServerError %+v", 500, o.Payload) } - func (o *PostPdfsInternalServerError) GetPayload() *stash_models.Error { return o.Payload } diff --git a/api/stash/stash_client/stash_pdf/stash_pdf_client.go b/api/stash/stash_client/stash_pdf/stash_pdf_client.go index 3407ec2..9c3ada2 100644 --- a/api/stash/stash_client/stash_pdf/stash_pdf_client.go +++ b/api/stash/stash_client/stash_pdf/stash_pdf_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPdfsOK, error) + PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPdfsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Store new PDFs */ -func (a *Client) PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter) (*PostPdfsOK, error) { +func (a *Client) PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostPdfsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostPdfsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postPdfs", Method: "POST", PathPattern: "/pdfs", @@ -59,7 +61,12 @@ func (a *Client) PostPdfs(params *PostPdfsParams, authInfo runtime.ClientAuthInf 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 } diff --git a/api/stash/stash_models/document.go b/api/stash/stash_models/document.go index 3002a19..acadc31 100644 --- a/api/stash/stash_models/document.go +++ b/api/stash/stash_models/document.go @@ -10,6 +10,8 @@ package stash_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -43,6 +45,11 @@ func (m *Document) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this document based on context it is used +func (m *Document) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Document) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/stash/stash_models/document_response.go b/api/stash/stash_models/document_response.go index 638c59d..f1051e2 100644 --- a/api/stash/stash_models/document_response.go +++ b/api/stash/stash_models/document_response.go @@ -10,6 +10,7 @@ package stash_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *DocumentResponse) Validate(formats strfmt.Registry) error { } func (m *DocumentResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *DocumentResponse) validateData(formats strfmt.Registry) error { } func (m *DocumentResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *DocumentResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this document response based on the context it is used +func (m *DocumentResponse) 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 *DocumentResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DocumentResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DocumentResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/stash/stash_models/error.go b/api/stash/stash_models/error.go index fe8ed08..b6e6ed2 100644 --- a/api/stash/stash_models/error.go +++ b/api/stash/stash_models/error.go @@ -10,6 +10,8 @@ package stash_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/stash/stash_models/new_p_d_f.go b/api/stash/stash_models/new_p_d_f.go index 980fa99..84cd98e 100644 --- a/api/stash/stash_models/new_p_d_f.go +++ b/api/stash/stash_models/new_p_d_f.go @@ -10,6 +10,8 @@ package stash_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -52,6 +54,11 @@ func (m *NewPDF) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this new p d f based on context it is used +func (m *NewPDF) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NewPDF) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/stash/stash_models/p_d_f_request.go b/api/stash/stash_models/p_d_f_request.go index 2fc7b2f..af71367 100644 --- a/api/stash/stash_models/p_d_f_request.go +++ b/api/stash/stash_models/p_d_f_request.go @@ -10,6 +10,7 @@ package stash_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PDFRequest) Validate(formats strfmt.Registry) error { } func (m *PDFRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PDFRequest) validateData(formats strfmt.Registry) error { } func (m *PDFRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PDFRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this p d f request based on the context it is used +func (m *PDFRequest) 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 *PDFRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PDFRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PDFRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/stash/stash_models/request_meta.go b/api/stash/stash_models/request_meta.go index 4645436..52aed90 100644 --- a/api/stash/stash_models/request_meta.go +++ b/api/stash/stash_models/request_meta.go @@ -10,6 +10,8 @@ package stash_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/stash/stash_models/response_meta.go b/api/stash/stash_models/response_meta.go index fc232a3..c48d968 100644 --- a/api/stash/stash_models/response_meta.go +++ b/api/stash/stash_models/response_meta.go @@ -10,6 +10,8 @@ package stash_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -58,6 +60,11 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this response meta based on context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_client/accounts/accounts_client.go b/api/vendor-gw/vendor_gw_client/accounts/accounts_client.go index 7f817a2..b548b23 100644 --- a/api/vendor-gw/vendor_gw_client/accounts/accounts_client.go +++ b/api/vendor-gw/vendor_gw_client/accounts/accounts_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) + GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Get the Stores, Accounts or other entities that correspond to locations */ -func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) { +func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getAccounts", Method: "GET", PathPattern: "/accounts", @@ -59,7 +61,12 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA 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 } diff --git a/api/vendor-gw/vendor_gw_client/accounts/get_accounts_parameters.go b/api/vendor-gw/vendor_gw_client/accounts/get_accounts_parameters.go index 254f4d0..b33c72e 100644 --- a/api/vendor-gw/vendor_gw_client/accounts/get_accounts_parameters.go +++ b/api/vendor-gw/vendor_gw_client/accounts/get_accounts_parameters.go @@ -20,73 +20,76 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetAccountsParams creates a new GetAccountsParams object -// with the default values initialized. +// NewGetAccountsParams creates a new GetAccountsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetAccountsParams() *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountsParamsWithTimeout creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountsParamsWithTimeout(timeout time.Duration) *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: timeout, } } // NewGetAccountsParamsWithContext creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountsParamsWithContext(ctx context.Context) *GetAccountsParams { - var () return &GetAccountsParams{ - Context: ctx, } } // NewGetAccountsParamsWithHTTPClient creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountsParamsWithHTTPClient(client *http.Client) *GetAccountsParams { - var () return &GetAccountsParams{ HTTPClient: client, } } -/*GetAccountsParams contains all the parameters to send to the API endpoint -for the get accounts operation typically these are written to a http.Request +/* GetAccountsParams contains all the parameters to send to the API endpoint + for the get accounts operation. + + Typically these are written to a http.Request. */ type GetAccountsParams struct { - /*License - The Licnese Number for the query + /* License. + The Licnese Number for the query */ License *string - /*Partner - The Partner Key + /* Partner. + + The Partner Key */ Partner *string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The Taxnexus User's Key on the Vendor API + /* User. + + The Taxnexus User's Key on the Vendor API */ User string - /*Vendor - The name of the Vendor Gateway to be used + /* Vendor. + + The name of the Vendor Gateway to be used */ Vendor *string @@ -95,6 +98,21 @@ type GetAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) WithDefaults() *GetAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounts params func (o *GetAccountsParams) WithTimeout(timeout time.Duration) *GetAccountsParams { o.SetTimeout(timeout) @@ -195,38 +213,41 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param license var qrLicense string + if o.License != nil { qrLicense = *o.License } qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); err != nil { return err } } - } if o.Partner != nil { // query param partner var qrPartner string + if o.Partner != nil { qrPartner = *o.Partner } qPartner := qrPartner if qPartner != "" { + if err := r.SetQueryParam("partner", qPartner); err != nil { return err } } - } // query param state qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -236,6 +257,7 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } @@ -245,16 +267,17 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param vendor var qrVendor string + if o.Vendor != nil { qrVendor = *o.Vendor } qVendor := qrVendor if qVendor != "" { + if err := r.SetQueryParam("vendor", qVendor); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/vendor-gw/vendor_gw_client/accounts/get_accounts_responses.go b/api/vendor-gw/vendor_gw_client/accounts/get_accounts_responses.go index 5e18a2c..41da565 100644 --- a/api/vendor-gw/vendor_gw_client/accounts/get_accounts_responses.go +++ b/api/vendor-gw/vendor_gw_client/accounts/get_accounts_responses.go @@ -63,9 +63,8 @@ func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetAccountsOK() *GetAccountsOK { return &GetAccountsOK{} } -/*GetAccountsOK handles this case with default header values. +/* GetAccountsOK describes a response with status code 200, with default header values. An array of AccountBasic objects */ @@ -85,7 +84,6 @@ type GetAccountsOK struct { func (o *GetAccountsOK) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload) } - func (o *GetAccountsOK) GetPayload() *vendor_gw_models.AccountResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetAccountsUnauthorized() *GetAccountsUnauthorized { return &GetAccountsUnauthorized{} } -/*GetAccountsUnauthorized handles this case with default header values. +/* GetAccountsUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetAccountsUnauthorized struct { func (o *GetAccountsUnauthorized) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsUnauthorized %+v", 401, o.Payload) } - func (o *GetAccountsUnauthorized) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetAccountsForbidden() *GetAccountsForbidden { return &GetAccountsForbidden{} } -/*GetAccountsForbidden handles this case with default header values. +/* GetAccountsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetAccountsForbidden struct { func (o *GetAccountsForbidden) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden %+v", 403, o.Payload) } - func (o *GetAccountsForbidden) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetAccountsNotFound() *GetAccountsNotFound { return &GetAccountsNotFound{} } -/*GetAccountsNotFound handles this case with default header values. +/* GetAccountsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetAccountsNotFound struct { func (o *GetAccountsNotFound) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsNotFound %+v", 404, o.Payload) } - func (o *GetAccountsNotFound) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetAccountsUnprocessableEntity() *GetAccountsUnprocessableEntity { return &GetAccountsUnprocessableEntity{} } -/*GetAccountsUnprocessableEntity handles this case with default header values. +/* GetAccountsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetAccountsUnprocessableEntity struct { func (o *GetAccountsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetAccountsUnprocessableEntity) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetAccountsInternalServerError() *GetAccountsInternalServerError { return &GetAccountsInternalServerError{} } -/*GetAccountsInternalServerError handles this case with default header values. +/* GetAccountsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetAccountsInternalServerError struct { func (o *GetAccountsInternalServerError) Error() string { return fmt.Sprintf("[GET /accounts][%d] getAccountsInternalServerError %+v", 500, o.Payload) } - func (o *GetAccountsInternalServerError) GetPayload() *vendor_gw_models.Error { return o.Payload } diff --git a/api/vendor-gw/vendor_gw_client/invoices/get_invoices_parameters.go b/api/vendor-gw/vendor_gw_client/invoices/get_invoices_parameters.go index 88662fe..4ccd0bb 100644 --- a/api/vendor-gw/vendor_gw_client/invoices/get_invoices_parameters.go +++ b/api/vendor-gw/vendor_gw_client/invoices/get_invoices_parameters.go @@ -21,98 +21,110 @@ import ( "github.com/go-openapi/swag" ) -// NewGetInvoicesParams creates a new GetInvoicesParams object -// with the default values initialized. +// NewGetInvoicesParams creates a new GetInvoicesParams 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 NewGetInvoicesParams() *GetInvoicesParams { - var () return &GetInvoicesParams{ - timeout: cr.DefaultTimeout, } } // NewGetInvoicesParamsWithTimeout creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetInvoicesParamsWithTimeout(timeout time.Duration) *GetInvoicesParams { - var () return &GetInvoicesParams{ - timeout: timeout, } } // NewGetInvoicesParamsWithContext creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetInvoicesParamsWithContext(ctx context.Context) *GetInvoicesParams { - var () return &GetInvoicesParams{ - Context: ctx, } } // NewGetInvoicesParamsWithHTTPClient creates a new GetInvoicesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetInvoicesParamsWithHTTPClient(client *http.Client) *GetInvoicesParams { - var () return &GetInvoicesParams{ HTTPClient: client, } } -/*GetInvoicesParams contains all the parameters to send to the API endpoint -for the get invoices operation typically these are written to a http.Request +/* GetInvoicesParams contains all the parameters to send to the API endpoint + for the get invoices operation. + + Typically these are written to a http.Request. */ type GetInvoicesParams struct { - /*EndDate - The last modified end timestamp + /* EndDate. + The last modified end timestamp */ EndDate *string - /*Item - The Item Number + /* Item. + + The Item Number */ Item *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip + /* Offset. + + How many objects to skip + + Format: int64 */ Offset *int64 - /*Partner - The Partner Key + /* Partner. + + The Partner Key */ Partner *string - /*StartDate - The last modified start timestamp + /* StartDate. + + The last modified start timestamp */ StartDate *string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The Taxnexus User's Key on the Vendor API + /* User. + + The Taxnexus User's Key on the Vendor API */ User string - /*Vendor - The name of the Vendor Gateway to be used + /* Vendor. + + The name of the Vendor Gateway to be used */ Vendor *string @@ -121,6 +133,21 @@ type GetInvoicesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInvoicesParams) WithDefaults() *GetInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get invoices params func (o *GetInvoicesParams) WithTimeout(timeout time.Duration) *GetInvoicesParams { o.SetTimeout(timeout) @@ -276,118 +303,126 @@ func (o *GetInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param endDate var qrEndDate string + if o.EndDate != nil { qrEndDate = *o.EndDate } qEndDate := qrEndDate if qEndDate != "" { + if err := r.SetQueryParam("endDate", qEndDate); err != nil { return err } } - } if o.Item != nil { // query param item var qrItem string + if o.Item != nil { qrItem = *o.Item } qItem := qrItem if qItem != "" { + if err := r.SetQueryParam("item", qItem); err != nil { return err } } - } if o.License != nil { // query param license var qrLicense string + if o.License != nil { qrLicense = *o.License } qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); 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 o.Partner != nil { // query param partner var qrPartner string + if o.Partner != nil { qrPartner = *o.Partner } qPartner := qrPartner if qPartner != "" { + if err := r.SetQueryParam("partner", qPartner); err != nil { return err } } - } if o.StartDate != nil { // query param startDate var qrStartDate string + if o.StartDate != nil { qrStartDate = *o.StartDate } qStartDate := qrStartDate if qStartDate != "" { + if err := r.SetQueryParam("startDate", qStartDate); err != nil { return err } } - } // query param state qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -397,6 +432,7 @@ func (o *GetInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } @@ -406,16 +442,17 @@ func (o *GetInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param vendor var qrVendor string + if o.Vendor != nil { qrVendor = *o.Vendor } qVendor := qrVendor if qVendor != "" { + if err := r.SetQueryParam("vendor", qVendor); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/vendor-gw/vendor_gw_client/invoices/get_invoices_responses.go b/api/vendor-gw/vendor_gw_client/invoices/get_invoices_responses.go index f73c47f..8d7fcc4 100644 --- a/api/vendor-gw/vendor_gw_client/invoices/get_invoices_responses.go +++ b/api/vendor-gw/vendor_gw_client/invoices/get_invoices_responses.go @@ -63,9 +63,8 @@ func (o *GetInvoicesReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetInvoicesOK() *GetInvoicesOK { return &GetInvoicesOK{} } -/*GetInvoicesOK handles this case with default header values. +/* GetInvoicesOK describes a response with status code 200, with default header values. A list of Invoices for this User was retrieved successfully */ @@ -85,7 +84,6 @@ type GetInvoicesOK struct { func (o *GetInvoicesOK) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesOK %+v", 200, o.Payload) } - func (o *GetInvoicesOK) GetPayload() *vendor_gw_models.InvoiceResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetInvoicesUnauthorized() *GetInvoicesUnauthorized { return &GetInvoicesUnauthorized{} } -/*GetInvoicesUnauthorized handles this case with default header values. +/* GetInvoicesUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetInvoicesUnauthorized struct { func (o *GetInvoicesUnauthorized) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnauthorized %+v", 401, o.Payload) } - func (o *GetInvoicesUnauthorized) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetInvoicesForbidden() *GetInvoicesForbidden { return &GetInvoicesForbidden{} } -/*GetInvoicesForbidden handles this case with default header values. +/* GetInvoicesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetInvoicesForbidden struct { func (o *GetInvoicesForbidden) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesForbidden %+v", 403, o.Payload) } - func (o *GetInvoicesForbidden) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetInvoicesNotFound() *GetInvoicesNotFound { return &GetInvoicesNotFound{} } -/*GetInvoicesNotFound handles this case with default header values. +/* GetInvoicesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetInvoicesNotFound struct { func (o *GetInvoicesNotFound) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesNotFound %+v", 404, o.Payload) } - func (o *GetInvoicesNotFound) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetInvoicesUnprocessableEntity() *GetInvoicesUnprocessableEntity { return &GetInvoicesUnprocessableEntity{} } -/*GetInvoicesUnprocessableEntity handles this case with default header values. +/* GetInvoicesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetInvoicesUnprocessableEntity struct { func (o *GetInvoicesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetInvoicesUnprocessableEntity) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetInvoicesInternalServerError() *GetInvoicesInternalServerError { return &GetInvoicesInternalServerError{} } -/*GetInvoicesInternalServerError handles this case with default header values. +/* GetInvoicesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetInvoicesInternalServerError struct { func (o *GetInvoicesInternalServerError) Error() string { return fmt.Sprintf("[GET /invoices][%d] getInvoicesInternalServerError %+v", 500, o.Payload) } - func (o *GetInvoicesInternalServerError) GetPayload() *vendor_gw_models.Error { return o.Payload } diff --git a/api/vendor-gw/vendor_gw_client/invoices/invoices_client.go b/api/vendor-gw/vendor_gw_client/invoices/invoices_client.go index 0589616..057e764 100644 --- a/api/vendor-gw/vendor_gw_client/invoices/invoices_client.go +++ b/api/vendor-gw/vendor_gw_client/invoices/invoices_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoicesOK, error) + GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvoicesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of available Taxnexus Invoices */ -func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoicesOK, error) { +func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInvoicesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetInvoicesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getInvoices", Method: "GET", PathPattern: "/invoices", @@ -59,7 +61,12 @@ func (a *Client) GetInvoices(params *GetInvoicesParams, authInfo runtime.ClientA 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 } diff --git a/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_parameters.go b/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_parameters.go index 962b8c2..bdc5a8c 100644 --- a/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_parameters.go +++ b/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_parameters.go @@ -21,98 +21,110 @@ import ( "github.com/go-openapi/swag" ) -// NewGetPosParams creates a new GetPosParams object -// with the default values initialized. +// NewGetPosParams creates a new GetPosParams 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 NewGetPosParams() *GetPosParams { - var () return &GetPosParams{ - timeout: cr.DefaultTimeout, } } // NewGetPosParamsWithTimeout creates a new GetPosParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPosParamsWithTimeout(timeout time.Duration) *GetPosParams { - var () return &GetPosParams{ - timeout: timeout, } } // NewGetPosParamsWithContext creates a new GetPosParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPosParamsWithContext(ctx context.Context) *GetPosParams { - var () return &GetPosParams{ - Context: ctx, } } // NewGetPosParamsWithHTTPClient creates a new GetPosParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPosParamsWithHTTPClient(client *http.Client) *GetPosParams { - var () return &GetPosParams{ HTTPClient: client, } } -/*GetPosParams contains all the parameters to send to the API endpoint -for the get pos operation typically these are written to a http.Request +/* GetPosParams contains all the parameters to send to the API endpoint + for the get pos operation. + + Typically these are written to a http.Request. */ type GetPosParams struct { - /*EndDate - The last modified end timestamp + /* EndDate. + The last modified end timestamp */ EndDate *string - /*License - The Licnese Number for the query + /* License. + + The Licnese Number for the query */ License *string - /*Limit - How many objects to return at one time + /* Limit. + + How many objects to return at one time + + Format: int64 */ Limit *int64 - /*Offset - How many objects to skip + /* Offset. + + How many objects to skip + + Format: int64 */ Offset *int64 - /*Partner - The Partner Key + /* Partner. + + The Partner Key */ Partner *string - /*PoID - The ID Purchase Order to be retrieved + /* PoID. + + The ID Purchase Order to be retrieved */ PoID *string - /*StartDate - The last modified start timestamp + /* StartDate. + + The last modified start timestamp */ StartDate *string - /*State - The 2-character State Code + /* State. + + The 2-character State Code */ State string - /*User - The Taxnexus User's Key on the Vendor API + /* User. + + The Taxnexus User's Key on the Vendor API */ User string - /*Vendor - The name of the Vendor Gateway to be used + /* Vendor. + + The name of the Vendor Gateway to be used */ Vendor *string @@ -121,6 +133,21 @@ type GetPosParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPosParams) WithDefaults() *GetPosParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get pos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPosParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get pos params func (o *GetPosParams) WithTimeout(timeout time.Duration) *GetPosParams { o.SetTimeout(timeout) @@ -276,118 +303,126 @@ func (o *GetPosParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist // query param endDate var qrEndDate string + if o.EndDate != nil { qrEndDate = *o.EndDate } qEndDate := qrEndDate if qEndDate != "" { + if err := r.SetQueryParam("endDate", qEndDate); err != nil { return err } } - } if o.License != nil { // query param license var qrLicense string + if o.License != nil { qrLicense = *o.License } qLicense := qrLicense if qLicense != "" { + if err := r.SetQueryParam("license", qLicense); 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 o.Partner != nil { // query param partner var qrPartner string + if o.Partner != nil { qrPartner = *o.Partner } qPartner := qrPartner if qPartner != "" { + if err := r.SetQueryParam("partner", qPartner); err != nil { return err } } - } if o.PoID != nil { // query param poId var qrPoID string + if o.PoID != nil { qrPoID = *o.PoID } qPoID := qrPoID if qPoID != "" { + if err := r.SetQueryParam("poId", qPoID); err != nil { return err } } - } if o.StartDate != nil { // query param startDate var qrStartDate string + if o.StartDate != nil { qrStartDate = *o.StartDate } qStartDate := qrStartDate if qStartDate != "" { + if err := r.SetQueryParam("startDate", qStartDate); err != nil { return err } } - } // query param state qrState := o.State qState := qrState if qState != "" { + if err := r.SetQueryParam("state", qState); err != nil { return err } @@ -397,6 +432,7 @@ func (o *GetPosParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist qrUser := o.User qUser := qrUser if qUser != "" { + if err := r.SetQueryParam("user", qUser); err != nil { return err } @@ -406,16 +442,17 @@ func (o *GetPosParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist // query param vendor var qrVendor string + if o.Vendor != nil { qrVendor = *o.Vendor } qVendor := qrVendor if qVendor != "" { + if err := r.SetQueryParam("vendor", qVendor); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_responses.go b/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_responses.go index e3bfc48..1f0469d 100644 --- a/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_responses.go +++ b/api/vendor-gw/vendor_gw_client/purchase_orders/get_pos_responses.go @@ -63,9 +63,8 @@ func (o *GetPosReader) ReadResponse(response runtime.ClientResponse, consumer ru return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetPosOK() *GetPosOK { return &GetPosOK{} } -/*GetPosOK handles this case with default header values. +/* GetPosOK describes a response with status code 200, with default header values. An array of Purchase Order objects */ @@ -85,7 +84,6 @@ type GetPosOK struct { func (o *GetPosOK) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosOK %+v", 200, o.Payload) } - func (o *GetPosOK) GetPayload() *vendor_gw_models.PurchaseOrderResponse { return o.Payload } @@ -107,7 +105,7 @@ func NewGetPosUnauthorized() *GetPosUnauthorized { return &GetPosUnauthorized{} } -/*GetPosUnauthorized handles this case with default header values. +/* GetPosUnauthorized describes a response with status code 401, with default header values. Access unauthorized, invalid API-KEY was used */ @@ -118,7 +116,6 @@ type GetPosUnauthorized struct { func (o *GetPosUnauthorized) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosUnauthorized %+v", 401, o.Payload) } - func (o *GetPosUnauthorized) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -140,7 +137,7 @@ func NewGetPosForbidden() *GetPosForbidden { return &GetPosForbidden{} } -/*GetPosForbidden handles this case with default header values. +/* GetPosForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -151,7 +148,6 @@ type GetPosForbidden struct { func (o *GetPosForbidden) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosForbidden %+v", 403, o.Payload) } - func (o *GetPosForbidden) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -173,7 +169,7 @@ func NewGetPosNotFound() *GetPosNotFound { return &GetPosNotFound{} } -/*GetPosNotFound handles this case with default header values. +/* GetPosNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -184,7 +180,6 @@ type GetPosNotFound struct { func (o *GetPosNotFound) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosNotFound %+v", 404, o.Payload) } - func (o *GetPosNotFound) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -206,7 +201,7 @@ func NewGetPosUnprocessableEntity() *GetPosUnprocessableEntity { return &GetPosUnprocessableEntity{} } -/*GetPosUnprocessableEntity handles this case with default header values. +/* GetPosUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -217,7 +212,6 @@ type GetPosUnprocessableEntity struct { func (o *GetPosUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetPosUnprocessableEntity) GetPayload() *vendor_gw_models.Error { return o.Payload } @@ -239,7 +233,7 @@ func NewGetPosInternalServerError() *GetPosInternalServerError { return &GetPosInternalServerError{} } -/*GetPosInternalServerError handles this case with default header values. +/* GetPosInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -250,7 +244,6 @@ type GetPosInternalServerError struct { func (o *GetPosInternalServerError) Error() string { return fmt.Sprintf("[GET /pos][%d] getPosInternalServerError %+v", 500, o.Payload) } - func (o *GetPosInternalServerError) GetPayload() *vendor_gw_models.Error { return o.Payload } diff --git a/api/vendor-gw/vendor_gw_client/purchase_orders/purchase_orders_client.go b/api/vendor-gw/vendor_gw_client/purchase_orders/purchase_orders_client.go index 1c4b1b9..fbc660d 100644 --- a/api/vendor-gw/vendor_gw_client/purchase_orders/purchase_orders_client.go +++ b/api/vendor-gw/vendor_gw_client/purchase_orders/purchase_orders_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter) (*GetPosOK, error) + GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPosOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Return a list of available Purchase Orders */ -func (a *Client) GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter) (*GetPosOK, error) { +func (a *Client) GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPosOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPosParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getPos", Method: "GET", PathPattern: "/pos", @@ -59,7 +61,12 @@ func (a *Client) GetPos(params *GetPosParams, authInfo runtime.ClientAuthInfoWri 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 } diff --git a/api/vendor-gw/vendor_gw_models/account_basic.go b/api/vendor-gw/vendor_gw_models/account_basic.go index 8ece942..0a3b608 100644 --- a/api/vendor-gw/vendor_gw_models/account_basic.go +++ b/api/vendor-gw/vendor_gw_models/account_basic.go @@ -10,6 +10,8 @@ package vendor_gw_models // 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" @@ -94,7 +96,6 @@ func (m *AccountBasic) Validate(formats strfmt.Registry) error { } func (m *AccountBasic) validateBillingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BillingAddress) { // not required return nil } @@ -112,7 +113,6 @@ func (m *AccountBasic) validateBillingAddress(formats strfmt.Registry) error { } func (m *AccountBasic) validateBillingContact(formats strfmt.Registry) error { - if swag.IsZero(m.BillingContact) { // not required return nil } @@ -130,7 +130,6 @@ func (m *AccountBasic) validateBillingContact(formats strfmt.Registry) error { } func (m *AccountBasic) validateLicense(formats strfmt.Registry) error { - if swag.IsZero(m.License) { // not required return nil } @@ -148,7 +147,6 @@ func (m *AccountBasic) validateLicense(formats strfmt.Registry) error { } func (m *AccountBasic) validateShippingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingAddress) { // not required return nil } @@ -166,7 +164,6 @@ func (m *AccountBasic) validateShippingAddress(formats strfmt.Registry) error { } func (m *AccountBasic) validateShippingContact(formats strfmt.Registry) error { - if swag.IsZero(m.ShippingContact) { // not required return nil } @@ -183,6 +180,106 @@ func (m *AccountBasic) validateShippingContact(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account basic based on the context it is used +func (m *AccountBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBillingContact(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLicense(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateShippingContact(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AccountBasic) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAddress != nil { + if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingAddress") + } + return err + } + } + + return nil +} + +func (m *AccountBasic) contextValidateBillingContact(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingContact != nil { + if err := m.BillingContact.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BillingContact") + } + return err + } + } + + return nil +} + +func (m *AccountBasic) contextValidateLicense(ctx context.Context, formats strfmt.Registry) error { + + if m.License != nil { + if err := m.License.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("License") + } + return err + } + } + + return nil +} + +func (m *AccountBasic) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingAddress != nil { + if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingAddress") + } + return err + } + } + + return nil +} + +func (m *AccountBasic) contextValidateShippingContact(ctx context.Context, formats strfmt.Registry) error { + + if m.ShippingContact != nil { + if err := m.ShippingContact.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ShippingContact") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/account_response.go b/api/vendor-gw/vendor_gw_models/account_response.go index 12f7c94..03a125d 100644 --- a/api/vendor-gw/vendor_gw_models/account_response.go +++ b/api/vendor-gw/vendor_gw_models/account_response.go @@ -10,6 +10,7 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AccountResponse) Validate(formats strfmt.Registry) error { } func (m *AccountResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AccountResponse) validateData(formats strfmt.Registry) error { } func (m *AccountResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AccountResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account response based on the context it is used +func (m *AccountResponse) 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 *AccountResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AccountResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AccountResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/address.go b/api/vendor-gw/vendor_gw_models/address.go index f6f27c2..2fc2281 100644 --- a/api/vendor-gw/vendor_gw_models/address.go +++ b/api/vendor-gw/vendor_gw_models/address.go @@ -10,6 +10,8 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -46,6 +48,11 @@ func (m *Address) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this address based on context it is used +func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Address) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/contact_basic.go b/api/vendor-gw/vendor_gw_models/contact_basic.go index 2aaf56d..4b01e55 100644 --- a/api/vendor-gw/vendor_gw_models/contact_basic.go +++ b/api/vendor-gw/vendor_gw_models/contact_basic.go @@ -10,6 +10,8 @@ package vendor_gw_models // 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" @@ -63,7 +65,6 @@ func (m *ContactBasic) Validate(formats strfmt.Registry) error { } func (m *ContactBasic) validateMailingAddress(formats strfmt.Registry) error { - if swag.IsZero(m.MailingAddress) { // not required return nil } @@ -80,6 +81,34 @@ func (m *ContactBasic) validateMailingAddress(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contact basic based on the context it is used +func (m *ContactBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMailingAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ContactBasic) contextValidateMailingAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.MailingAddress != nil { + if err := m.MailingAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("MailingAddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ContactBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/error.go b/api/vendor-gw/vendor_gw_models/error.go index 9b46bb6..547c4c7 100644 --- a/api/vendor-gw/vendor_gw_models/error.go +++ b/api/vendor-gw/vendor_gw_models/error.go @@ -10,6 +10,8 @@ package vendor_gw_models // 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" @@ -45,22 +47,26 @@ func (m *Error) Validate(formats strfmt.Registry) error { } func (m *Error) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required return nil } - if err := validate.MinimumInt("status", "body", int64(m.Status), 100, false); err != nil { + if err := validate.MinimumInt("status", "body", m.Status, 100, false); err != nil { return err } - if err := validate.MaximumInt("status", "body", int64(m.Status), 600, false); err != nil { + if err := validate.MaximumInt("status", "body", m.Status, 600, false); err != nil { return err } return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/invalid_error.go b/api/vendor-gw/vendor_gw_models/invalid_error.go index 9eaf538..57e30db 100644 --- a/api/vendor-gw/vendor_gw_models/invalid_error.go +++ b/api/vendor-gw/vendor_gw_models/invalid_error.go @@ -10,6 +10,8 @@ package vendor_gw_models // 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" @@ -85,6 +87,21 @@ func (m *InvalidError) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invalid error based on the context it is used +func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with Error + if err := m.Error.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *InvalidError) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/invoice_basic.go b/api/vendor-gw/vendor_gw_models/invoice_basic.go index be033f9..859de22 100644 --- a/api/vendor-gw/vendor_gw_models/invoice_basic.go +++ b/api/vendor-gw/vendor_gw_models/invoice_basic.go @@ -10,6 +10,7 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -120,7 +121,6 @@ func (m *InvoiceBasic) Validate(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -138,7 +138,6 @@ func (m *InvoiceBasic) validateBusinessAddress(formats strfmt.Registry) error { } func (m *InvoiceBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -162,6 +161,56 @@ func (m *InvoiceBasic) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice basic based on the context it is used +func (m *InvoiceBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InvoiceBasic) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *InvoiceBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/invoice_response.go b/api/vendor-gw/vendor_gw_models/invoice_response.go index f59544e..ddfad3c 100644 --- a/api/vendor-gw/vendor_gw_models/invoice_response.go +++ b/api/vendor-gw/vendor_gw_models/invoice_response.go @@ -10,6 +10,7 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *InvoiceResponse) Validate(formats strfmt.Registry) error { } func (m *InvoiceResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *InvoiceResponse) validateData(formats strfmt.Registry) error { } func (m *InvoiceResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *InvoiceResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this invoice response based on the context it is used +func (m *InvoiceResponse) 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 *InvoiceResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InvoiceResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *InvoiceResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/item_basic.go b/api/vendor-gw/vendor_gw_models/item_basic.go index 627f1f8..2227862 100644 --- a/api/vendor-gw/vendor_gw_models/item_basic.go +++ b/api/vendor-gw/vendor_gw_models/item_basic.go @@ -10,6 +10,8 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -20,51 +22,67 @@ import ( type ItemBasic struct { // Cost of Goods Sold for this Item + // Example: 0 COGS float64 `json:"COGS,omitempty"` // Line Item Description (not used in tax calculation) + // Example: string Description string `json:"Description,omitempty"` // Taxnexus Record Id Only; not used in POST + // Example: string ID string `json:"ID,omitempty"` // Source System Parent Foreign Key to Invoice + // Example: string InvoiceID string `json:"InvoiceID,omitempty"` // The pre-discount price of the item + // Example: 0 ListPrice float64 `json:"ListPrice,omitempty"` // The pre-discount price of the item + // Example: 0 MRCInterval int64 `json:"MRCInterval,omitempty"` // UUID Reference the master record that owns this item + // Example: string ParentFK string `json:"ParentFK,omitempty"` // Product Code (not used in tax calculation) + // Example: string ProductCode string `json:"ProductCode,omitempty"` // Quantity + // Example: 0 Quantity float64 `json:"Quantity,omitempty"` // Source System identifier for this record, if any; copied to invoiceitemid in Tax Transaction result records + // Example: string Ref string `json:"Ref,omitempty"` // Sales Regulation Type + // Example: string SalesRegulation string `json:"SalesRegulation,omitempty"` // Shipping & Handling and Delivery Fees for this Item + // Example: 0 ShippingHandling float64 `json:"ShippingHandling,omitempty"` // Subtotal (not used in tax calculation) + // Example: 0 Subtotal float64 `json:"Subtotal,omitempty"` // Taxnexus Code + // Example: string TaxnexusCode string `json:"TaxnexusCode,omitempty"` // Unique Taxnexus ID + // Example: string UUID string `json:"UUID,omitempty"` // Unit Price + // Example: 0 UnitPrice float64 `json:"UnitPrice,omitempty"` // The Unit of Measure for this item @@ -76,6 +94,11 @@ func (m *ItemBasic) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this item basic based on context it is used +func (m *ItemBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ItemBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/license_basic.go b/api/vendor-gw/vendor_gw_models/license_basic.go index 1a5a488..e3a85f0 100644 --- a/api/vendor-gw/vendor_gw_models/license_basic.go +++ b/api/vendor-gw/vendor_gw_models/license_basic.go @@ -10,6 +10,8 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -58,6 +60,11 @@ func (m *LicenseBasic) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this license basic based on context it is used +func (m *LicenseBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LicenseBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/pagination.go b/api/vendor-gw/vendor_gw_models/pagination.go index 5174e5e..57f417d 100644 --- a/api/vendor-gw/vendor_gw_models/pagination.go +++ b/api/vendor-gw/vendor_gw_models/pagination.go @@ -10,6 +10,8 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -40,6 +42,11 @@ func (m *Pagination) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pagination based on context it is used +func (m *Pagination) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Pagination) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/purchase_order_basic.go b/api/vendor-gw/vendor_gw_models/purchase_order_basic.go index 9bb53a8..e91708d 100644 --- a/api/vendor-gw/vendor_gw_models/purchase_order_basic.go +++ b/api/vendor-gw/vendor_gw_models/purchase_order_basic.go @@ -10,6 +10,7 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -87,7 +88,6 @@ func (m *PurchaseOrderBasic) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderBasic) validateBusinessAddress(formats strfmt.Registry) error { - if swag.IsZero(m.BusinessAddress) { // not required return nil } @@ -105,7 +105,6 @@ func (m *PurchaseOrderBasic) validateBusinessAddress(formats strfmt.Registry) er } func (m *PurchaseOrderBasic) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required return nil } @@ -129,6 +128,56 @@ func (m *PurchaseOrderBasic) validateItems(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order basic based on the context it is used +func (m *PurchaseOrderBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBusinessAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PurchaseOrderBasic) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.BusinessAddress != nil { + if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("BusinessAddress") + } + return err + } + } + + return nil +} + +func (m *PurchaseOrderBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderBasic) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/purchase_order_response.go b/api/vendor-gw/vendor_gw_models/purchase_order_response.go index 1052d72..6680f11 100644 --- a/api/vendor-gw/vendor_gw_models/purchase_order_response.go +++ b/api/vendor-gw/vendor_gw_models/purchase_order_response.go @@ -10,6 +10,7 @@ package vendor_gw_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *PurchaseOrderResponse) Validate(formats strfmt.Registry) error { } func (m *PurchaseOrderResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *PurchaseOrderResponse) validateData(formats strfmt.Registry) error { } func (m *PurchaseOrderResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *PurchaseOrderResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this purchase order response based on the context it is used +func (m *PurchaseOrderResponse) 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 *PurchaseOrderResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PurchaseOrderResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PurchaseOrderResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/vendor-gw/vendor_gw_models/response_meta.go b/api/vendor-gw/vendor_gw_models/response_meta.go index a17b9ea..beb587f 100644 --- a/api/vendor-gw/vendor_gw_models/response_meta.go +++ b/api/vendor-gw/vendor_gw_models/response_meta.go @@ -10,6 +10,8 @@ package vendor_gw_models // 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" @@ -72,7 +74,6 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { } func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required return nil } @@ -89,6 +90,34 @@ func (m *ResponseMeta) validatePagination(formats strfmt.Registry) error { return nil } +// ContextValidate validate this response meta based on the context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseMeta) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Pagination") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_client/app_log/app_log_client.go b/api/workflow/workflow_client/app_log/app_log_client.go index a28d700..499efbf 100644 --- a/api/workflow/workflow_client/app_log/app_log_client.go +++ b/api/workflow/workflow_client/app_log/app_log_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - PostAppLogs(params *PostAppLogsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAppLogsOK, error) + PostAppLogs(params *PostAppLogsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAppLogsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Insert app log messages into workflow storage */ -func (a *Client) PostAppLogs(params *PostAppLogsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAppLogsOK, error) { +func (a *Client) PostAppLogs(params *PostAppLogsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAppLogsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostAppLogsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postAppLogs", Method: "POST", PathPattern: "/applogs", @@ -59,7 +61,12 @@ func (a *Client) PostAppLogs(params *PostAppLogsParams, authInfo runtime.ClientA 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 } diff --git a/api/workflow/workflow_client/app_log/post_app_logs_parameters.go b/api/workflow/workflow_client/app_log/post_app_logs_parameters.go index b54201e..ce8cbdc 100644 --- a/api/workflow/workflow_client/app_log/post_app_logs_parameters.go +++ b/api/workflow/workflow_client/app_log/post_app_logs_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" ) -// NewPostAppLogsParams creates a new PostAppLogsParams object -// with the default values initialized. +// NewPostAppLogsParams creates a new PostAppLogsParams 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 NewPostAppLogsParams() *PostAppLogsParams { - var () return &PostAppLogsParams{ - timeout: cr.DefaultTimeout, } } // NewPostAppLogsParamsWithTimeout creates a new PostAppLogsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostAppLogsParamsWithTimeout(timeout time.Duration) *PostAppLogsParams { - var () return &PostAppLogsParams{ - timeout: timeout, } } // NewPostAppLogsParamsWithContext creates a new PostAppLogsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostAppLogsParamsWithContext(ctx context.Context) *PostAppLogsParams { - var () return &PostAppLogsParams{ - Context: ctx, } } // NewPostAppLogsParamsWithHTTPClient creates a new PostAppLogsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostAppLogsParamsWithHTTPClient(client *http.Client) *PostAppLogsParams { - var () return &PostAppLogsParams{ HTTPClient: client, } } -/*PostAppLogsParams contains all the parameters to send to the API endpoint -for the post app logs operation typically these are written to a http.Request +/* PostAppLogsParams contains all the parameters to send to the API endpoint + for the post app logs operation. + + Typically these are written to a http.Request. */ type PostAppLogsParams struct { - /*AppLogRequest - An array of new AppLog records + /* AppLogRequest. + An array of new AppLog records */ AppLogRequest *workflow_models.AppLogRequest @@ -77,6 +76,21 @@ type PostAppLogsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post app logs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAppLogsParams) WithDefaults() *PostAppLogsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post app logs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAppLogsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post app logs params func (o *PostAppLogsParams) WithTimeout(timeout time.Duration) *PostAppLogsParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostAppLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.AppLogRequest != nil { if err := r.SetBodyParam(o.AppLogRequest); err != nil { return err diff --git a/api/workflow/workflow_client/app_log/post_app_logs_responses.go b/api/workflow/workflow_client/app_log/post_app_logs_responses.go index fd43a18..b84c459 100644 --- a/api/workflow/workflow_client/app_log/post_app_logs_responses.go +++ b/api/workflow/workflow_client/app_log/post_app_logs_responses.go @@ -63,9 +63,8 @@ func (o *PostAppLogsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostAppLogsOK() *PostAppLogsOK { return &PostAppLogsOK{} } -/*PostAppLogsOK handles this case with default header values. +/* PostAppLogsOK describes a response with status code 200, with default header values. Array of AppLogs */ @@ -87,15 +86,18 @@ type PostAppLogsOK struct { func (o *PostAppLogsOK) Error() string { return fmt.Sprintf("[POST /applogs][%d] postAppLogsOK %+v", 200, o.Payload) } - func (o *PostAppLogsOK) GetPayload() *workflow_models.AppLogResponse { return o.Payload } func (o *PostAppLogsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.AppLogResponse) @@ -112,7 +114,7 @@ func NewPostAppLogsUnauthorized() *PostAppLogsUnauthorized { return &PostAppLogsUnauthorized{} } -/*PostAppLogsUnauthorized handles this case with default header values. +/* PostAppLogsUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PostAppLogsUnauthorized struct { func (o *PostAppLogsUnauthorized) Error() string { return fmt.Sprintf("[POST /applogs][%d] postAppLogsUnauthorized %+v", 401, o.Payload) } - func (o *PostAppLogsUnauthorized) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostAppLogsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -150,7 +155,7 @@ func NewPostAppLogsForbidden() *PostAppLogsForbidden { return &PostAppLogsForbidden{} } -/*PostAppLogsForbidden handles this case with default header values. +/* PostAppLogsForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PostAppLogsForbidden struct { func (o *PostAppLogsForbidden) Error() string { return fmt.Sprintf("[POST /applogs][%d] postAppLogsForbidden %+v", 403, o.Payload) } - func (o *PostAppLogsForbidden) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostAppLogsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -188,7 +196,7 @@ func NewPostAppLogsNotFound() *PostAppLogsNotFound { return &PostAppLogsNotFound{} } -/*PostAppLogsNotFound handles this case with default header values. +/* PostAppLogsNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PostAppLogsNotFound struct { func (o *PostAppLogsNotFound) Error() string { return fmt.Sprintf("[POST /applogs][%d] postAppLogsNotFound %+v", 404, o.Payload) } - func (o *PostAppLogsNotFound) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostAppLogsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -226,7 +237,7 @@ func NewPostAppLogsUnprocessableEntity() *PostAppLogsUnprocessableEntity { return &PostAppLogsUnprocessableEntity{} } -/*PostAppLogsUnprocessableEntity handles this case with default header values. +/* PostAppLogsUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PostAppLogsUnprocessableEntity struct { func (o *PostAppLogsUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /applogs][%d] postAppLogsUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostAppLogsUnprocessableEntity) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostAppLogsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -264,7 +278,7 @@ func NewPostAppLogsInternalServerError() *PostAppLogsInternalServerError { return &PostAppLogsInternalServerError{} } -/*PostAppLogsInternalServerError handles this case with default header values. +/* PostAppLogsInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PostAppLogsInternalServerError struct { func (o *PostAppLogsInternalServerError) Error() string { return fmt.Sprintf("[POST /applogs][%d] postAppLogsInternalServerError %+v", 500, o.Payload) } - func (o *PostAppLogsInternalServerError) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostAppLogsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) diff --git a/api/workflow/workflow_client/cors/app_log_options_parameters.go b/api/workflow/workflow_client/cors/app_log_options_parameters.go index 8f7364f..74d8267 100644 --- a/api/workflow/workflow_client/cors/app_log_options_parameters.go +++ b/api/workflow/workflow_client/cors/app_log_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewAppLogOptionsParams creates a new AppLogOptionsParams object -// with the default values initialized. +// NewAppLogOptionsParams creates a new AppLogOptionsParams 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 NewAppLogOptionsParams() *AppLogOptionsParams { - return &AppLogOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewAppLogOptionsParamsWithTimeout creates a new AppLogOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAppLogOptionsParamsWithTimeout(timeout time.Duration) *AppLogOptionsParams { - return &AppLogOptionsParams{ - timeout: timeout, } } // NewAppLogOptionsParamsWithContext creates a new AppLogOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAppLogOptionsParamsWithContext(ctx context.Context) *AppLogOptionsParams { - return &AppLogOptionsParams{ - Context: ctx, } } // NewAppLogOptionsParamsWithHTTPClient creates a new AppLogOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAppLogOptionsParamsWithHTTPClient(client *http.Client) *AppLogOptionsParams { - return &AppLogOptionsParams{ HTTPClient: client, } } -/*AppLogOptionsParams contains all the parameters to send to the API endpoint -for the app log options operation typically these are written to a http.Request +/* AppLogOptionsParams contains all the parameters to send to the API endpoint + for the app log options operation. + + Typically these are written to a http.Request. */ type AppLogOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type AppLogOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the app log options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AppLogOptionsParams) WithDefaults() *AppLogOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the app log options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AppLogOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the app log options params func (o *AppLogOptionsParams) WithTimeout(timeout time.Duration) *AppLogOptionsParams { o.SetTimeout(timeout) diff --git a/api/workflow/workflow_client/cors/app_log_options_responses.go b/api/workflow/workflow_client/cors/app_log_options_responses.go index ad622f8..235ce9e 100644 --- a/api/workflow/workflow_client/cors/app_log_options_responses.go +++ b/api/workflow/workflow_client/cors/app_log_options_responses.go @@ -30,9 +30,8 @@ func (o *AppLogOptionsReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewAppLogOptionsOK() *AppLogOptionsOK { return &AppLogOptionsOK{} } -/*AppLogOptionsOK handles this case with default header values. +/* AppLogOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type AppLogOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *AppLogOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *AppLogOptionsOK) Error() string { func (o *AppLogOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/workflow/workflow_client/cors/cors_client.go b/api/workflow/workflow_client/cors/cors_client.go index e6f7143..a168408 100644 --- a/api/workflow/workflow_client/cors/cors_client.go +++ b/api/workflow/workflow_client/cors/cors_client.go @@ -29,13 +29,16 @@ type Client struct { 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 { - AppLogOptions(params *AppLogOptionsParams) (*AppLogOptionsOK, error) + AppLogOptions(params *AppLogOptionsParams, opts ...ClientOption) (*AppLogOptionsOK, error) - EmailMessageOptions(params *EmailMessageOptionsParams) (*EmailMessageOptionsOK, error) + EmailMessageOptions(params *EmailMessageOptionsParams, opts ...ClientOption) (*EmailMessageOptionsOK, error) - OutgoingEmailMessageOptions(params *OutgoingEmailMessageOptionsParams) (*OutgoingEmailMessageOptionsOK, error) + OutgoingEmailMessageOptions(params *OutgoingEmailMessageOptionsParams, opts ...ClientOption) (*OutgoingEmailMessageOptionsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -43,13 +46,12 @@ type ClientService interface { /* AppLogOptions CORS support */ -func (a *Client) AppLogOptions(params *AppLogOptionsParams) (*AppLogOptionsOK, error) { +func (a *Client) AppLogOptions(params *AppLogOptionsParams, opts ...ClientOption) (*AppLogOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAppLogOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "appLogOptions", Method: "OPTIONS", PathPattern: "/applogs", @@ -60,7 +62,12 @@ func (a *Client) AppLogOptions(params *AppLogOptionsParams) (*AppLogOptionsOK, e Reader: &AppLogOptionsReader{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 } @@ -77,13 +84,12 @@ func (a *Client) AppLogOptions(params *AppLogOptionsParams) (*AppLogOptionsOK, e /* EmailMessageOptions CORS support */ -func (a *Client) EmailMessageOptions(params *EmailMessageOptionsParams) (*EmailMessageOptionsOK, error) { +func (a *Client) EmailMessageOptions(params *EmailMessageOptionsParams, opts ...ClientOption) (*EmailMessageOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewEmailMessageOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "emailMessageOptions", Method: "OPTIONS", PathPattern: "/emailmessages", @@ -94,7 +100,12 @@ func (a *Client) EmailMessageOptions(params *EmailMessageOptionsParams) (*EmailM Reader: &EmailMessageOptionsReader{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 } @@ -111,13 +122,12 @@ func (a *Client) EmailMessageOptions(params *EmailMessageOptionsParams) (*EmailM /* OutgoingEmailMessageOptions CORS support */ -func (a *Client) OutgoingEmailMessageOptions(params *OutgoingEmailMessageOptionsParams) (*OutgoingEmailMessageOptionsOK, error) { +func (a *Client) OutgoingEmailMessageOptions(params *OutgoingEmailMessageOptionsParams, opts ...ClientOption) (*OutgoingEmailMessageOptionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOutgoingEmailMessageOptionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "outgoingEmailMessageOptions", Method: "OPTIONS", PathPattern: "/outgoingemailmessages", @@ -128,7 +138,12 @@ func (a *Client) OutgoingEmailMessageOptions(params *OutgoingEmailMessageOptions Reader: &OutgoingEmailMessageOptionsReader{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 } diff --git a/api/workflow/workflow_client/cors/email_message_options_parameters.go b/api/workflow/workflow_client/cors/email_message_options_parameters.go index f0fa871..b6e4b62 100644 --- a/api/workflow/workflow_client/cors/email_message_options_parameters.go +++ b/api/workflow/workflow_client/cors/email_message_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewEmailMessageOptionsParams creates a new EmailMessageOptionsParams object -// with the default values initialized. +// NewEmailMessageOptionsParams creates a new EmailMessageOptionsParams 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 NewEmailMessageOptionsParams() *EmailMessageOptionsParams { - return &EmailMessageOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewEmailMessageOptionsParamsWithTimeout creates a new EmailMessageOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewEmailMessageOptionsParamsWithTimeout(timeout time.Duration) *EmailMessageOptionsParams { - return &EmailMessageOptionsParams{ - timeout: timeout, } } // NewEmailMessageOptionsParamsWithContext creates a new EmailMessageOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewEmailMessageOptionsParamsWithContext(ctx context.Context) *EmailMessageOptionsParams { - return &EmailMessageOptionsParams{ - Context: ctx, } } // NewEmailMessageOptionsParamsWithHTTPClient creates a new EmailMessageOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewEmailMessageOptionsParamsWithHTTPClient(client *http.Client) *EmailMessageOptionsParams { - return &EmailMessageOptionsParams{ HTTPClient: client, } } -/*EmailMessageOptionsParams contains all the parameters to send to the API endpoint -for the email message options operation typically these are written to a http.Request +/* EmailMessageOptionsParams contains all the parameters to send to the API endpoint + for the email message options operation. + + Typically these are written to a http.Request. */ type EmailMessageOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type EmailMessageOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the email message options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmailMessageOptionsParams) WithDefaults() *EmailMessageOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the email message options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmailMessageOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the email message options params func (o *EmailMessageOptionsParams) WithTimeout(timeout time.Duration) *EmailMessageOptionsParams { o.SetTimeout(timeout) diff --git a/api/workflow/workflow_client/cors/email_message_options_responses.go b/api/workflow/workflow_client/cors/email_message_options_responses.go index 311119c..fa75978 100644 --- a/api/workflow/workflow_client/cors/email_message_options_responses.go +++ b/api/workflow/workflow_client/cors/email_message_options_responses.go @@ -30,9 +30,8 @@ func (o *EmailMessageOptionsReader) ReadResponse(response runtime.ClientResponse return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewEmailMessageOptionsOK() *EmailMessageOptionsOK { return &EmailMessageOptionsOK{} } -/*EmailMessageOptionsOK handles this case with default header values. +/* EmailMessageOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type EmailMessageOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *EmailMessageOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *EmailMessageOptionsOK) Error() string { func (o *EmailMessageOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/workflow/workflow_client/cors/outgoing_email_message_options_parameters.go b/api/workflow/workflow_client/cors/outgoing_email_message_options_parameters.go index 36fd392..a0c42df 100644 --- a/api/workflow/workflow_client/cors/outgoing_email_message_options_parameters.go +++ b/api/workflow/workflow_client/cors/outgoing_email_message_options_parameters.go @@ -20,47 +20,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewOutgoingEmailMessageOptionsParams creates a new OutgoingEmailMessageOptionsParams object -// with the default values initialized. +// NewOutgoingEmailMessageOptionsParams creates a new OutgoingEmailMessageOptionsParams 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 NewOutgoingEmailMessageOptionsParams() *OutgoingEmailMessageOptionsParams { - return &OutgoingEmailMessageOptionsParams{ - timeout: cr.DefaultTimeout, } } // NewOutgoingEmailMessageOptionsParamsWithTimeout creates a new OutgoingEmailMessageOptionsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOutgoingEmailMessageOptionsParamsWithTimeout(timeout time.Duration) *OutgoingEmailMessageOptionsParams { - return &OutgoingEmailMessageOptionsParams{ - timeout: timeout, } } // NewOutgoingEmailMessageOptionsParamsWithContext creates a new OutgoingEmailMessageOptionsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOutgoingEmailMessageOptionsParamsWithContext(ctx context.Context) *OutgoingEmailMessageOptionsParams { - return &OutgoingEmailMessageOptionsParams{ - Context: ctx, } } // NewOutgoingEmailMessageOptionsParamsWithHTTPClient creates a new OutgoingEmailMessageOptionsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOutgoingEmailMessageOptionsParamsWithHTTPClient(client *http.Client) *OutgoingEmailMessageOptionsParams { - return &OutgoingEmailMessageOptionsParams{ HTTPClient: client, } } -/*OutgoingEmailMessageOptionsParams contains all the parameters to send to the API endpoint -for the outgoing email message options operation typically these are written to a http.Request +/* OutgoingEmailMessageOptionsParams contains all the parameters to send to the API endpoint + for the outgoing email message options operation. + + Typically these are written to a http.Request. */ type OutgoingEmailMessageOptionsParams struct { timeout time.Duration @@ -68,6 +67,21 @@ type OutgoingEmailMessageOptionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the outgoing email message options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OutgoingEmailMessageOptionsParams) WithDefaults() *OutgoingEmailMessageOptionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the outgoing email message options params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OutgoingEmailMessageOptionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the outgoing email message options params func (o *OutgoingEmailMessageOptionsParams) WithTimeout(timeout time.Duration) *OutgoingEmailMessageOptionsParams { o.SetTimeout(timeout) diff --git a/api/workflow/workflow_client/cors/outgoing_email_message_options_responses.go b/api/workflow/workflow_client/cors/outgoing_email_message_options_responses.go index 0e1ba54..c7946d8 100644 --- a/api/workflow/workflow_client/cors/outgoing_email_message_options_responses.go +++ b/api/workflow/workflow_client/cors/outgoing_email_message_options_responses.go @@ -30,9 +30,8 @@ func (o *OutgoingEmailMessageOptionsReader) ReadResponse(response runtime.Client return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -41,24 +40,18 @@ func NewOutgoingEmailMessageOptionsOK() *OutgoingEmailMessageOptionsOK { return &OutgoingEmailMessageOptionsOK{} } -/*OutgoingEmailMessageOptionsOK handles this case with default header values. +/* OutgoingEmailMessageOptionsOK describes a response with status code 200, with default header values. CORS OPTIONS response */ type OutgoingEmailMessageOptionsOK struct { AccessControlAllowCredentials string - - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - AccessControlExposeHeaders string - - AccessControlMaxAge string - - CacheControl string + AccessControlAllowHeaders string + AccessControlAllowMethods string + AccessControlAllowOrigin string + AccessControlExposeHeaders string + AccessControlMaxAge string + CacheControl string } func (o *OutgoingEmailMessageOptionsOK) Error() string { @@ -67,26 +60,54 @@ func (o *OutgoingEmailMessageOptionsOK) Error() string { func (o *OutgoingEmailMessageOptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Credentials - o.AccessControlAllowCredentials = response.GetHeader("Access-Control-Allow-Credentials") + // hydrates response header Access-Control-Allow-Credentials + hdrAccessControlAllowCredentials := response.GetHeader("Access-Control-Allow-Credentials") - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + if hdrAccessControlAllowCredentials != "" { + o.AccessControlAllowCredentials = hdrAccessControlAllowCredentials + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Expose-Headers - o.AccessControlExposeHeaders = response.GetHeader("Access-Control-Expose-Headers") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Max-Age - o.AccessControlMaxAge = response.GetHeader("Access-Control-Max-Age") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Cache-Control - o.CacheControl = response.GetHeader("Cache-Control") + // 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 } diff --git a/api/workflow/workflow_client/email_message/email_message_client.go b/api/workflow/workflow_client/email_message/email_message_client.go index 85388d3..add9810 100644 --- a/api/workflow/workflow_client/email_message/email_message_client.go +++ b/api/workflow/workflow_client/email_message/email_message_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter) (*GetEmailMessagesOK, error) + GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Retrieves email messages from workflow storage */ -func (a *Client) GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter) (*GetEmailMessagesOK, error) { +func (a *Client) GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetEmailMessagesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getEmailMessages", Method: "GET", PathPattern: "/emailmessages", @@ -59,7 +61,12 @@ func (a *Client) GetEmailMessages(params *GetEmailMessagesParams, authInfo runti 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 } diff --git a/api/workflow/workflow_client/email_message/get_email_messages_parameters.go b/api/workflow/workflow_client/email_message/get_email_messages_parameters.go index fe0bdac..0e7cc54 100644 --- a/api/workflow/workflow_client/email_message/get_email_messages_parameters.go +++ b/api/workflow/workflow_client/email_message/get_email_messages_parameters.go @@ -20,53 +20,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetEmailMessagesParams creates a new GetEmailMessagesParams object -// with the default values initialized. +// NewGetEmailMessagesParams creates a new GetEmailMessagesParams 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 NewGetEmailMessagesParams() *GetEmailMessagesParams { - var () return &GetEmailMessagesParams{ - timeout: cr.DefaultTimeout, } } // NewGetEmailMessagesParamsWithTimeout creates a new GetEmailMessagesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetEmailMessagesParamsWithTimeout(timeout time.Duration) *GetEmailMessagesParams { - var () return &GetEmailMessagesParams{ - timeout: timeout, } } // NewGetEmailMessagesParamsWithContext creates a new GetEmailMessagesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetEmailMessagesParamsWithContext(ctx context.Context) *GetEmailMessagesParams { - var () return &GetEmailMessagesParams{ - Context: ctx, } } // NewGetEmailMessagesParamsWithHTTPClient creates a new GetEmailMessagesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetEmailMessagesParamsWithHTTPClient(client *http.Client) *GetEmailMessagesParams { - var () return &GetEmailMessagesParams{ HTTPClient: client, } } -/*GetEmailMessagesParams contains all the parameters to send to the API endpoint -for the get email messages operation typically these are written to a http.Request +/* GetEmailMessagesParams contains all the parameters to send to the API endpoint + for the get email messages operation. + + Typically these are written to a http.Request. */ type GetEmailMessagesParams struct { - /*EmailMessageID - Email Message ID + /* EmailMessageID. + Email Message ID */ EmailMessageID *string @@ -75,6 +74,21 @@ type GetEmailMessagesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get email messages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEmailMessagesParams) WithDefaults() *GetEmailMessagesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get email messages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEmailMessagesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get email messages params func (o *GetEmailMessagesParams) WithTimeout(timeout time.Duration) *GetEmailMessagesParams { o.SetTimeout(timeout) @@ -131,16 +145,17 @@ func (o *GetEmailMessagesParams) WriteToRequest(r runtime.ClientRequest, reg str // query param emailMessageId var qrEmailMessageID string + if o.EmailMessageID != nil { qrEmailMessageID = *o.EmailMessageID } qEmailMessageID := qrEmailMessageID if qEmailMessageID != "" { + if err := r.SetQueryParam("emailMessageId", qEmailMessageID); err != nil { return err } } - } if len(res) > 0 { diff --git a/api/workflow/workflow_client/email_message/get_email_messages_responses.go b/api/workflow/workflow_client/email_message/get_email_messages_responses.go index bd4a8a8..39f4d78 100644 --- a/api/workflow/workflow_client/email_message/get_email_messages_responses.go +++ b/api/workflow/workflow_client/email_message/get_email_messages_responses.go @@ -63,9 +63,8 @@ func (o *GetEmailMessagesReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewGetEmailMessagesOK() *GetEmailMessagesOK { return &GetEmailMessagesOK{} } -/*GetEmailMessagesOK handles this case with default header values. +/* GetEmailMessagesOK describes a response with status code 200, with default header values. Array of Email Messages */ @@ -87,15 +86,18 @@ type GetEmailMessagesOK struct { func (o *GetEmailMessagesOK) Error() string { return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesOK %+v", 200, o.Payload) } - func (o *GetEmailMessagesOK) GetPayload() *workflow_models.EmailMessagesResponse { return o.Payload } func (o *GetEmailMessagesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.EmailMessagesResponse) @@ -112,7 +114,7 @@ func NewGetEmailMessagesUnauthorized() *GetEmailMessagesUnauthorized { return &GetEmailMessagesUnauthorized{} } -/*GetEmailMessagesUnauthorized handles this case with default header values. +/* GetEmailMessagesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type GetEmailMessagesUnauthorized struct { func (o *GetEmailMessagesUnauthorized) Error() string { return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesUnauthorized %+v", 401, o.Payload) } - func (o *GetEmailMessagesUnauthorized) GetPayload() *workflow_models.Error { return o.Payload } func (o *GetEmailMessagesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -150,7 +155,7 @@ func NewGetEmailMessagesForbidden() *GetEmailMessagesForbidden { return &GetEmailMessagesForbidden{} } -/*GetEmailMessagesForbidden handles this case with default header values. +/* GetEmailMessagesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type GetEmailMessagesForbidden struct { func (o *GetEmailMessagesForbidden) Error() string { return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesForbidden %+v", 403, o.Payload) } - func (o *GetEmailMessagesForbidden) GetPayload() *workflow_models.Error { return o.Payload } func (o *GetEmailMessagesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -188,7 +196,7 @@ func NewGetEmailMessagesNotFound() *GetEmailMessagesNotFound { return &GetEmailMessagesNotFound{} } -/*GetEmailMessagesNotFound handles this case with default header values. +/* GetEmailMessagesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type GetEmailMessagesNotFound struct { func (o *GetEmailMessagesNotFound) Error() string { return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesNotFound %+v", 404, o.Payload) } - func (o *GetEmailMessagesNotFound) GetPayload() *workflow_models.Error { return o.Payload } func (o *GetEmailMessagesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -226,7 +237,7 @@ func NewGetEmailMessagesUnprocessableEntity() *GetEmailMessagesUnprocessableEnti return &GetEmailMessagesUnprocessableEntity{} } -/*GetEmailMessagesUnprocessableEntity handles this case with default header values. +/* GetEmailMessagesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type GetEmailMessagesUnprocessableEntity struct { func (o *GetEmailMessagesUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesUnprocessableEntity %+v", 422, o.Payload) } - func (o *GetEmailMessagesUnprocessableEntity) GetPayload() *workflow_models.Error { return o.Payload } func (o *GetEmailMessagesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -264,7 +278,7 @@ func NewGetEmailMessagesInternalServerError() *GetEmailMessagesInternalServerErr return &GetEmailMessagesInternalServerError{} } -/*GetEmailMessagesInternalServerError handles this case with default header values. +/* GetEmailMessagesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type GetEmailMessagesInternalServerError struct { func (o *GetEmailMessagesInternalServerError) Error() string { return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesInternalServerError %+v", 500, o.Payload) } - func (o *GetEmailMessagesInternalServerError) GetPayload() *workflow_models.Error { return o.Payload } func (o *GetEmailMessagesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) diff --git a/api/workflow/workflow_client/outgoing_email_message/outgoing_email_message_client.go b/api/workflow/workflow_client/outgoing_email_message/outgoing_email_message_client.go index 3fffd0a..382d9dc 100644 --- a/api/workflow/workflow_client/outgoing_email_message/outgoing_email_message_client.go +++ b/api/workflow/workflow_client/outgoing_email_message/outgoing_email_message_client.go @@ -29,9 +29,12 @@ type Client struct { 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 { - PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter) (*PostOutgoingEmailMessagesOK, error) + PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -41,13 +44,12 @@ type ClientService interface { Insert new email messages into workflow storage */ -func (a *Client) PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter) (*PostOutgoingEmailMessagesOK, error) { +func (a *Client) PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostOutgoingEmailMessagesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "postOutgoingEmailMessages", Method: "POST", PathPattern: "/outgoingemailmessages", @@ -59,7 +61,12 @@ func (a *Client) PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesPara 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 } diff --git a/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_parameters.go b/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_parameters.go index 28f9507..476dcd7 100644 --- a/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_parameters.go +++ b/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_parameters.go @@ -22,53 +22,52 @@ import ( "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" ) -// NewPostOutgoingEmailMessagesParams creates a new PostOutgoingEmailMessagesParams object -// with the default values initialized. +// NewPostOutgoingEmailMessagesParams creates a new PostOutgoingEmailMessagesParams 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 NewPostOutgoingEmailMessagesParams() *PostOutgoingEmailMessagesParams { - var () return &PostOutgoingEmailMessagesParams{ - timeout: cr.DefaultTimeout, } } // NewPostOutgoingEmailMessagesParamsWithTimeout creates a new PostOutgoingEmailMessagesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostOutgoingEmailMessagesParamsWithTimeout(timeout time.Duration) *PostOutgoingEmailMessagesParams { - var () return &PostOutgoingEmailMessagesParams{ - timeout: timeout, } } // NewPostOutgoingEmailMessagesParamsWithContext creates a new PostOutgoingEmailMessagesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostOutgoingEmailMessagesParamsWithContext(ctx context.Context) *PostOutgoingEmailMessagesParams { - var () return &PostOutgoingEmailMessagesParams{ - Context: ctx, } } // NewPostOutgoingEmailMessagesParamsWithHTTPClient creates a new PostOutgoingEmailMessagesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostOutgoingEmailMessagesParamsWithHTTPClient(client *http.Client) *PostOutgoingEmailMessagesParams { - var () return &PostOutgoingEmailMessagesParams{ HTTPClient: client, } } -/*PostOutgoingEmailMessagesParams contains all the parameters to send to the API endpoint -for the post outgoing email messages operation typically these are written to a http.Request +/* PostOutgoingEmailMessagesParams contains all the parameters to send to the API endpoint + for the post outgoing email messages operation. + + Typically these are written to a http.Request. */ type PostOutgoingEmailMessagesParams struct { - /*OutgoingEmailMessageRequest - An array of new Outgoing Email Message records + /* OutgoingEmailMessageRequest. + An array of new Outgoing Email Message records */ OutgoingEmailMessageRequest *workflow_models.OutgoingEmailMessageRequest @@ -77,6 +76,21 @@ type PostOutgoingEmailMessagesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post outgoing email messages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostOutgoingEmailMessagesParams) WithDefaults() *PostOutgoingEmailMessagesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post outgoing email messages params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostOutgoingEmailMessagesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post outgoing email messages params func (o *PostOutgoingEmailMessagesParams) WithTimeout(timeout time.Duration) *PostOutgoingEmailMessagesParams { o.SetTimeout(timeout) @@ -128,7 +142,6 @@ func (o *PostOutgoingEmailMessagesParams) WriteToRequest(r runtime.ClientRequest return err } var res []error - if o.OutgoingEmailMessageRequest != nil { if err := r.SetBodyParam(o.OutgoingEmailMessageRequest); err != nil { return err diff --git a/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_responses.go b/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_responses.go index 546a5c6..760bf9a 100644 --- a/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_responses.go +++ b/api/workflow/workflow_client/outgoing_email_message/post_outgoing_email_messages_responses.go @@ -63,9 +63,8 @@ func (o *PostOutgoingEmailMessagesReader) ReadResponse(response runtime.ClientRe return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -74,7 +73,7 @@ func NewPostOutgoingEmailMessagesOK() *PostOutgoingEmailMessagesOK { return &PostOutgoingEmailMessagesOK{} } -/*PostOutgoingEmailMessagesOK handles this case with default header values. +/* PostOutgoingEmailMessagesOK describes a response with status code 200, with default header values. Array of Email Messages */ @@ -87,15 +86,18 @@ type PostOutgoingEmailMessagesOK struct { func (o *PostOutgoingEmailMessagesOK) Error() string { return fmt.Sprintf("[POST /outgoingemailmessages][%d] postOutgoingEmailMessagesOK %+v", 200, o.Payload) } - func (o *PostOutgoingEmailMessagesOK) GetPayload() *workflow_models.EmailMessagesResponse { return o.Payload } func (o *PostOutgoingEmailMessagesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.EmailMessagesResponse) @@ -112,7 +114,7 @@ func NewPostOutgoingEmailMessagesUnauthorized() *PostOutgoingEmailMessagesUnauth return &PostOutgoingEmailMessagesUnauthorized{} } -/*PostOutgoingEmailMessagesUnauthorized handles this case with default header values. +/* PostOutgoingEmailMessagesUnauthorized describes a response with status code 401, with default header values. Access Unauthorized, invalid API-KEY was used */ @@ -125,15 +127,18 @@ type PostOutgoingEmailMessagesUnauthorized struct { func (o *PostOutgoingEmailMessagesUnauthorized) Error() string { return fmt.Sprintf("[POST /outgoingemailmessages][%d] postOutgoingEmailMessagesUnauthorized %+v", 401, o.Payload) } - func (o *PostOutgoingEmailMessagesUnauthorized) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostOutgoingEmailMessagesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -150,7 +155,7 @@ func NewPostOutgoingEmailMessagesForbidden() *PostOutgoingEmailMessagesForbidden return &PostOutgoingEmailMessagesForbidden{} } -/*PostOutgoingEmailMessagesForbidden handles this case with default header values. +/* PostOutgoingEmailMessagesForbidden describes a response with status code 403, with default header values. Access forbidden, account lacks access */ @@ -163,15 +168,18 @@ type PostOutgoingEmailMessagesForbidden struct { func (o *PostOutgoingEmailMessagesForbidden) Error() string { return fmt.Sprintf("[POST /outgoingemailmessages][%d] postOutgoingEmailMessagesForbidden %+v", 403, o.Payload) } - func (o *PostOutgoingEmailMessagesForbidden) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostOutgoingEmailMessagesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -188,7 +196,7 @@ func NewPostOutgoingEmailMessagesNotFound() *PostOutgoingEmailMessagesNotFound { return &PostOutgoingEmailMessagesNotFound{} } -/*PostOutgoingEmailMessagesNotFound handles this case with default header values. +/* PostOutgoingEmailMessagesNotFound describes a response with status code 404, with default header values. Resource was not found */ @@ -201,15 +209,18 @@ type PostOutgoingEmailMessagesNotFound struct { func (o *PostOutgoingEmailMessagesNotFound) Error() string { return fmt.Sprintf("[POST /outgoingemailmessages][%d] postOutgoingEmailMessagesNotFound %+v", 404, o.Payload) } - func (o *PostOutgoingEmailMessagesNotFound) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostOutgoingEmailMessagesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -226,7 +237,7 @@ func NewPostOutgoingEmailMessagesUnprocessableEntity() *PostOutgoingEmailMessage return &PostOutgoingEmailMessagesUnprocessableEntity{} } -/*PostOutgoingEmailMessagesUnprocessableEntity handles this case with default header values. +/* PostOutgoingEmailMessagesUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity, likely a bad parameter */ @@ -239,15 +250,18 @@ type PostOutgoingEmailMessagesUnprocessableEntity struct { func (o *PostOutgoingEmailMessagesUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /outgoingemailmessages][%d] postOutgoingEmailMessagesUnprocessableEntity %+v", 422, o.Payload) } - func (o *PostOutgoingEmailMessagesUnprocessableEntity) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostOutgoingEmailMessagesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) @@ -264,7 +278,7 @@ func NewPostOutgoingEmailMessagesInternalServerError() *PostOutgoingEmailMessage return &PostOutgoingEmailMessagesInternalServerError{} } -/*PostOutgoingEmailMessagesInternalServerError handles this case with default header values. +/* PostOutgoingEmailMessagesInternalServerError describes a response with status code 500, with default header values. Server Internal Error */ @@ -277,15 +291,18 @@ type PostOutgoingEmailMessagesInternalServerError struct { func (o *PostOutgoingEmailMessagesInternalServerError) Error() string { return fmt.Sprintf("[POST /outgoingemailmessages][%d] postOutgoingEmailMessagesInternalServerError %+v", 500, o.Payload) } - func (o *PostOutgoingEmailMessagesInternalServerError) GetPayload() *workflow_models.Error { return o.Payload } func (o *PostOutgoingEmailMessagesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(workflow_models.Error) diff --git a/api/workflow/workflow_models/app_log.go b/api/workflow/workflow_models/app_log.go index 20df32a..5910621 100644 --- a/api/workflow/workflow_models/app_log.go +++ b/api/workflow/workflow_models/app_log.go @@ -10,6 +10,8 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -58,6 +60,11 @@ func (m *AppLog) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this app log based on context it is used +func (m *AppLog) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AppLog) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/app_log_request.go b/api/workflow/workflow_models/app_log_request.go index 52789d5..27054a5 100644 --- a/api/workflow/workflow_models/app_log_request.go +++ b/api/workflow/workflow_models/app_log_request.go @@ -10,6 +10,7 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AppLogRequest) Validate(formats strfmt.Registry) error { } func (m *AppLogRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AppLogRequest) validateData(formats strfmt.Registry) error { } func (m *AppLogRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AppLogRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this app log request based on the context it is used +func (m *AppLogRequest) 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 *AppLogRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AppLogRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AppLogRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/app_log_response.go b/api/workflow/workflow_models/app_log_response.go index d9d5f8f..e3ed213 100644 --- a/api/workflow/workflow_models/app_log_response.go +++ b/api/workflow/workflow_models/app_log_response.go @@ -10,6 +10,7 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *AppLogResponse) Validate(formats strfmt.Registry) error { } func (m *AppLogResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *AppLogResponse) validateData(formats strfmt.Registry) error { } func (m *AppLogResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *AppLogResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this app log response based on the context it is used +func (m *AppLogResponse) 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 *AppLogResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AppLogResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *AppLogResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/document.go b/api/workflow/workflow_models/document.go index 5edd289..8342709 100644 --- a/api/workflow/workflow_models/document.go +++ b/api/workflow/workflow_models/document.go @@ -10,6 +10,8 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -207,6 +209,11 @@ func (m *Document) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this document based on context it is used +func (m *Document) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Document) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/email_message.go b/api/workflow/workflow_models/email_message.go index c44f03e..36b8e7d 100644 --- a/api/workflow/workflow_models/email_message.go +++ b/api/workflow/workflow_models/email_message.go @@ -10,6 +10,8 @@ package workflow_models // 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" @@ -134,7 +136,6 @@ func (m *EmailMessage) Validate(formats strfmt.Registry) error { } func (m *EmailMessage) validateHeaders(formats strfmt.Registry) error { - if swag.IsZero(m.Headers) { // not required return nil } @@ -151,6 +152,34 @@ func (m *EmailMessage) validateHeaders(formats strfmt.Registry) error { return nil } +// ContextValidate validate this email message based on the context it is used +func (m *EmailMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHeaders(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EmailMessage) contextValidateHeaders(ctx context.Context, formats strfmt.Registry) error { + + if m.Headers != nil { + if err := m.Headers.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Headers") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *EmailMessage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/email_message_request.go b/api/workflow/workflow_models/email_message_request.go index f27e64b..f8d64a6 100644 --- a/api/workflow/workflow_models/email_message_request.go +++ b/api/workflow/workflow_models/email_message_request.go @@ -10,6 +10,7 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *EmailMessageRequest) Validate(formats strfmt.Registry) error { } func (m *EmailMessageRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *EmailMessageRequest) validateData(formats strfmt.Registry) error { } func (m *EmailMessageRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *EmailMessageRequest) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this email message request based on the context it is used +func (m *EmailMessageRequest) 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 *EmailMessageRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *EmailMessageRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *EmailMessageRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/email_messages_response.go b/api/workflow/workflow_models/email_messages_response.go index 78bdf39..f57f1be 100644 --- a/api/workflow/workflow_models/email_messages_response.go +++ b/api/workflow/workflow_models/email_messages_response.go @@ -10,6 +10,7 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *EmailMessagesResponse) Validate(formats strfmt.Registry) error { } func (m *EmailMessagesResponse) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *EmailMessagesResponse) validateData(formats strfmt.Registry) error { } func (m *EmailMessagesResponse) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *EmailMessagesResponse) validateMeta(formats strfmt.Registry) error { return nil } +// ContextValidate validate this email messages response based on the context it is used +func (m *EmailMessagesResponse) 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 *EmailMessagesResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *EmailMessagesResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *EmailMessagesResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/error.go b/api/workflow/workflow_models/error.go index 4ba94b1..4cd9f7b 100644 --- a/api/workflow/workflow_models/error.go +++ b/api/workflow/workflow_models/error.go @@ -10,6 +10,8 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -34,6 +36,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/headers.go b/api/workflow/workflow_models/headers.go index 2d617e4..69b93a7 100644 --- a/api/workflow/workflow_models/headers.go +++ b/api/workflow/workflow_models/headers.go @@ -10,6 +10,8 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *Headers) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this headers based on context it is used +func (m *Headers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Headers) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/outgoing_email_message.go b/api/workflow/workflow_models/outgoing_email_message.go index 1a7d9ae..fb07edf 100644 --- a/api/workflow/workflow_models/outgoing_email_message.go +++ b/api/workflow/workflow_models/outgoing_email_message.go @@ -10,6 +10,8 @@ package workflow_models // 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" @@ -84,7 +86,6 @@ func (m *OutgoingEmailMessage) Validate(formats strfmt.Registry) error { } func (m *OutgoingEmailMessage) validateHeaders(formats strfmt.Registry) error { - if swag.IsZero(m.Headers) { // not required return nil } @@ -101,6 +102,34 @@ func (m *OutgoingEmailMessage) validateHeaders(formats strfmt.Registry) error { return nil } +// ContextValidate validate this outgoing email message based on the context it is used +func (m *OutgoingEmailMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHeaders(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OutgoingEmailMessage) contextValidateHeaders(ctx context.Context, formats strfmt.Registry) error { + + if m.Headers != nil { + if err := m.Headers.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Headers") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OutgoingEmailMessage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/outgoing_email_message_request.go b/api/workflow/workflow_models/outgoing_email_message_request.go index 56db6ec..21eec06 100644 --- a/api/workflow/workflow_models/outgoing_email_message_request.go +++ b/api/workflow/workflow_models/outgoing_email_message_request.go @@ -10,6 +10,7 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -48,7 +49,6 @@ func (m *OutgoingEmailMessageRequest) Validate(formats strfmt.Registry) error { } func (m *OutgoingEmailMessageRequest) validateData(formats strfmt.Registry) error { - if swag.IsZero(m.Data) { // not required return nil } @@ -73,7 +73,6 @@ func (m *OutgoingEmailMessageRequest) validateData(formats strfmt.Registry) erro } func (m *OutgoingEmailMessageRequest) validateMeta(formats strfmt.Registry) error { - if swag.IsZero(m.Meta) { // not required return nil } @@ -90,6 +89,56 @@ func (m *OutgoingEmailMessageRequest) validateMeta(formats strfmt.Registry) erro return nil } +// ContextValidate validate this outgoing email message request based on the context it is used +func (m *OutgoingEmailMessageRequest) 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 *OutgoingEmailMessageRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Data); i++ { + + if m.Data[i] != nil { + if err := m.Data[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *OutgoingEmailMessageRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OutgoingEmailMessageRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/request_meta.go b/api/workflow/workflow_models/request_meta.go index 71ee73a..0cee45c 100644 --- a/api/workflow/workflow_models/request_meta.go +++ b/api/workflow/workflow_models/request_meta.go @@ -10,6 +10,8 @@ package workflow_models // 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" @@ -49,6 +51,11 @@ func (m *RequestMeta) validateTaxnexusAccount(formats strfmt.Registry) error { return nil } +// ContextValidate validates this request meta based on context it is used +func (m *RequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RequestMeta) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/workflow/workflow_models/response_meta.go b/api/workflow/workflow_models/response_meta.go index 2747c04..f616f8b 100644 --- a/api/workflow/workflow_models/response_meta.go +++ b/api/workflow/workflow_models/response_meta.go @@ -10,6 +10,8 @@ package workflow_models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -58,6 +60,11 @@ func (m *ResponseMeta) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this response meta based on context it is used +func (m *ResponseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ResponseMeta) MarshalBinary() ([]byte, error) { if m == nil {