lib/api/crm/crm_client/contracts/get_contracts_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"
)
// GetContractsReader is a Reader for the GetContracts structure.
type GetContractsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
2022-05-28 19:45:41 +00:00
switch response.Code() {
case 200:
result := NewGetContractsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetContractsUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewGetContractsForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetContractsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewGetContractsUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetContractsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /contracts] getContracts", response, response.Code())
2022-05-28 19:45:41 +00:00
}
}
// NewGetContractsOK creates a GetContractsOK with default headers values
func NewGetContractsOK() *GetContractsOK {
return &GetContractsOK{}
}
// GetContractsOK 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 GetContractsOK struct {
AccessControlAllowOrigin string
CacheControl string
Payload *crm_models.ContractResponse
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this get contracts o k response has a 2xx status code
func (o *GetContractsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get contracts o k response has a 3xx status code
func (o *GetContractsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get contracts o k response has a 4xx status code
func (o *GetContractsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get contracts o k response has a 5xx status code
func (o *GetContractsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get contracts o k response a status code equal to that given
func (o *GetContractsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get contracts o k response
func (o *GetContractsOK) Code() int {
return 200
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *GetContractsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsOK) GetPayload() *crm_models.ContractResponse {
return o.Payload
}
func (o *GetContractsOK) 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
}
// NewGetContractsUnauthorized creates a GetContractsUnauthorized with default headers values
func NewGetContractsUnauthorized() *GetContractsUnauthorized {
return &GetContractsUnauthorized{}
}
// GetContractsUnauthorized 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 GetContractsUnauthorized struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this get contracts unauthorized response has a 2xx status code
func (o *GetContractsUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get contracts unauthorized response has a 3xx status code
func (o *GetContractsUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this get contracts unauthorized response has a 4xx status code
func (o *GetContractsUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this get contracts unauthorized response has a 5xx status code
func (o *GetContractsUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this get contracts unauthorized response a status code equal to that given
func (o *GetContractsUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the get contracts unauthorized response
func (o *GetContractsUnauthorized) Code() int {
return 401
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *GetContractsUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsUnauthorized) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetContractsUnauthorized) 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
}
// NewGetContractsForbidden creates a GetContractsForbidden with default headers values
func NewGetContractsForbidden() *GetContractsForbidden {
return &GetContractsForbidden{}
}
// GetContractsForbidden 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 GetContractsForbidden struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this get contracts forbidden response has a 2xx status code
func (o *GetContractsForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get contracts forbidden response has a 3xx status code
func (o *GetContractsForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this get contracts forbidden response has a 4xx status code
func (o *GetContractsForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this get contracts forbidden response has a 5xx status code
func (o *GetContractsForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this get contracts forbidden response a status code equal to that given
func (o *GetContractsForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the get contracts forbidden response
func (o *GetContractsForbidden) Code() int {
return 403
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *GetContractsForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsForbidden) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetContractsForbidden) 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
}
// NewGetContractsNotFound creates a GetContractsNotFound with default headers values
func NewGetContractsNotFound() *GetContractsNotFound {
return &GetContractsNotFound{}
}
// GetContractsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
2022-05-28 19:45:41 +00:00
type GetContractsNotFound struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this get contracts not found response has a 2xx status code
func (o *GetContractsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get contracts not found response has a 3xx status code
func (o *GetContractsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get contracts not found response has a 4xx status code
func (o *GetContractsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get contracts not found response has a 5xx status code
func (o *GetContractsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get contracts not found response a status code equal to that given
func (o *GetContractsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get contracts not found response
func (o *GetContractsNotFound) Code() int {
return 404
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsNotFound) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *GetContractsNotFound) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsNotFound) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetContractsNotFound) 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
}
// NewGetContractsUnprocessableEntity creates a GetContractsUnprocessableEntity with default headers values
func NewGetContractsUnprocessableEntity() *GetContractsUnprocessableEntity {
return &GetContractsUnprocessableEntity{}
}
// GetContractsUnprocessableEntity 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 GetContractsUnprocessableEntity struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this get contracts unprocessable entity response has a 2xx status code
func (o *GetContractsUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get contracts unprocessable entity response has a 3xx status code
func (o *GetContractsUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this get contracts unprocessable entity response has a 4xx status code
func (o *GetContractsUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this get contracts unprocessable entity response has a 5xx status code
func (o *GetContractsUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this get contracts unprocessable entity response a status code equal to that given
func (o *GetContractsUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the get contracts unprocessable entity response
func (o *GetContractsUnprocessableEntity) Code() int {
return 422
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsUnprocessableEntity) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *GetContractsUnprocessableEntity) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsUnprocessableEntity) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetContractsUnprocessableEntity) 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
}
// NewGetContractsInternalServerError creates a GetContractsInternalServerError with default headers values
func NewGetContractsInternalServerError() *GetContractsInternalServerError {
return &GetContractsInternalServerError{}
}
// GetContractsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
2022-05-28 19:45:41 +00:00
type GetContractsInternalServerError struct {
AccessControlAllowOrigin string
Payload *crm_models.Error
}
2023-03-22 20:49:01 +00:00
// IsSuccess returns true when this get contracts internal server error response has a 2xx status code
func (o *GetContractsInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get contracts internal server error response has a 3xx status code
func (o *GetContractsInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this get contracts internal server error response has a 4xx status code
func (o *GetContractsInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this get contracts internal server error response has a 5xx status code
func (o *GetContractsInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this get contracts internal server error response a status code equal to that given
func (o *GetContractsInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the get contracts internal server error response
func (o *GetContractsInternalServerError) Code() int {
return 500
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
2022-05-28 19:45:41 +00:00
}
2023-03-22 20:49:01 +00:00
func (o *GetContractsInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
2023-03-22 20:49:01 +00:00
}
2022-05-28 19:45:41 +00:00
func (o *GetContractsInternalServerError) GetPayload() *crm_models.Error {
return o.Payload
}
func (o *GetContractsInternalServerError) 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
}