lib/api/crm/crm_client/contracts/put_contract_responses.go

538 lines
16 KiB
Go
Raw Permalink Normal View History

2022-05-28 19:45:41 +00:00
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package contracts
import (
"encoding/json"
stderrors "errors"
2022-05-28 19:45:41 +00:00
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
2022-05-28 19:45:41 +00:00
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// PutContractReader is a Reader for the PutContract structure.
type PutContractReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PutContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
2022-05-28 19:45:41 +00:00
switch response.Code() {
case 200:
result := NewPutContractOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewPutContractUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewPutContractForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPutContractNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewPutContractUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPutContractInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[PUT /contracts] putContract", response, response.Code())
2022-05-28 19:45:41 +00:00
}
}
// NewPutContractOK creates a PutContractOK with default headers values
func NewPutContractOK() *PutContractOK {
return &PutContractOK{}
}
// PutContractOK describes a response with status code 200, with default header values.
//
// Response with an array of Contract objects
2022-05-28 19:45:41 +00:00
type PutContractOK struct {
AccessControlAllowOrigin string
CacheControl string
Payload *crm_models.ContractResponse
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this put contract o k response has a 2xx status code
func (o *PutContractOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this put contract o k response has a 3xx status code
func (o *PutContractOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this put contract o k response has a 4xx status code
func (o *PutContractOK) IsClientError() bool {
return false
}
// IsServerError returns true when this put contract o k response has a 5xx status code
func (o *PutContractOK) IsServerError() bool {
return false
}
// IsCode returns true when this put contract o k response a status code equal to that given
func (o *PutContractOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the put contract o k response
func (o *PutContractOK) Code() int {
return 200
}
2022-05-28 19:45:41 +00:00
func (o *PutContractOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %s", 200, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *PutContractOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractOK %s", 200, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *PutContractOK) GetPayload() *crm_models.ContractResponse {
return o.Payload
}
func (o *PutContractOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
// hydrates response header Cache-Control
hdrCacheControl := response.GetHeader("Cache-Control")
if hdrCacheControl != "" {
o.CacheControl = hdrCacheControl
}
o.Payload = new(crm_models.ContractResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
2022-05-28 19:45:41 +00:00
return err
}
return nil
}
// NewPutContractUnauthorized creates a PutContractUnauthorized with default headers values
func NewPutContractUnauthorized() *PutContractUnauthorized {
return &PutContractUnauthorized{}
}
// PutContractUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
2022-05-28 19:45:41 +00:00
type PutContractUnauthorized struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this put contract unauthorized response has a 2xx status code
func (o *PutContractUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this put contract unauthorized response has a 3xx status code
func (o *PutContractUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this put contract unauthorized response has a 4xx status code
func (o *PutContractUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this put contract unauthorized response has a 5xx status code
func (o *PutContractUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this put contract unauthorized response a status code equal to that given
func (o *PutContractUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the put contract unauthorized response
func (o *PutContractUnauthorized) Code() int {
return 401
}
2022-05-28 19:45:41 +00:00
func (o *PutContractUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %s", 401, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *PutContractUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnauthorized %s", 401, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *PutContractUnauthorized) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutContractUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
2022-05-28 19:45:41 +00:00
return err
}
return nil
}
// NewPutContractForbidden creates a PutContractForbidden with default headers values
func NewPutContractForbidden() *PutContractForbidden {
return &PutContractForbidden{}
}
// PutContractForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
2022-05-28 19:45:41 +00:00
type PutContractForbidden struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this put contract forbidden response has a 2xx status code
func (o *PutContractForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this put contract forbidden response has a 3xx status code
func (o *PutContractForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this put contract forbidden response has a 4xx status code
func (o *PutContractForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this put contract forbidden response has a 5xx status code
func (o *PutContractForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this put contract forbidden response a status code equal to that given
func (o *PutContractForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the put contract forbidden response
func (o *PutContractForbidden) Code() int {
return 403
}
2022-05-28 19:45:41 +00:00
func (o *PutContractForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %s", 403, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *PutContractForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractForbidden %s", 403, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *PutContractForbidden) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutContractForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
2022-05-28 19:45:41 +00:00
return err
}
return nil
}
// NewPutContractNotFound creates a PutContractNotFound with default headers values
func NewPutContractNotFound() *PutContractNotFound {
return &PutContractNotFound{}
}
// PutContractNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
2022-05-28 19:45:41 +00:00
type PutContractNotFound struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this put contract not found response has a 2xx status code
func (o *PutContractNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this put contract not found response has a 3xx status code
func (o *PutContractNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this put contract not found response has a 4xx status code
func (o *PutContractNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this put contract not found response has a 5xx status code
func (o *PutContractNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this put contract not found response a status code equal to that given
func (o *PutContractNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the put contract not found response
func (o *PutContractNotFound) Code() int {
return 404
}
2022-05-28 19:45:41 +00:00
func (o *PutContractNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %s", 404, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *PutContractNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractNotFound %s", 404, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *PutContractNotFound) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutContractNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
2022-05-28 19:45:41 +00:00
return err
}
return nil
}
// NewPutContractUnprocessableEntity creates a PutContractUnprocessableEntity with default headers values
func NewPutContractUnprocessableEntity() *PutContractUnprocessableEntity {
return &PutContractUnprocessableEntity{}
}
// PutContractUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
2022-05-28 19:45:41 +00:00
type PutContractUnprocessableEntity struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this put contract unprocessable entity response has a 2xx status code
func (o *PutContractUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this put contract unprocessable entity response has a 3xx status code
func (o *PutContractUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this put contract unprocessable entity response has a 4xx status code
func (o *PutContractUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this put contract unprocessable entity response has a 5xx status code
func (o *PutContractUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this put contract unprocessable entity response a status code equal to that given
func (o *PutContractUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the put contract unprocessable entity response
func (o *PutContractUnprocessableEntity) Code() int {
return 422
}
2022-05-28 19:45:41 +00:00
func (o *PutContractUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %s", 422, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *PutContractUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractUnprocessableEntity %s", 422, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *PutContractUnprocessableEntity) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutContractUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
2022-05-28 19:45:41 +00:00
return err
}
return nil
}
// NewPutContractInternalServerError creates a PutContractInternalServerError with default headers values
func NewPutContractInternalServerError() *PutContractInternalServerError {
return &PutContractInternalServerError{}
}
// PutContractInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
2022-05-28 19:45:41 +00:00
type PutContractInternalServerError struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this put contract internal server error response has a 2xx status code
func (o *PutContractInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this put contract internal server error response has a 3xx status code
func (o *PutContractInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this put contract internal server error response has a 4xx status code
func (o *PutContractInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this put contract internal server error response has a 5xx status code
func (o *PutContractInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this put contract internal server error response a status code equal to that given
func (o *PutContractInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the put contract internal server error response
func (o *PutContractInternalServerError) Code() int {
return 500
}
2022-05-28 19:45:41 +00:00
func (o *PutContractInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %s", 500, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *PutContractInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[PUT /contracts][%d] putContractInternalServerError %s", 500, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *PutContractInternalServerError) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *PutContractInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(crm_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
2022-05-28 19:45:41 +00:00
return err
}
return nil
}