// Code generated by go-swagger; DO NOT EDIT. // (c) 2012-2020 by Taxnexus, Inc. // All rights reserved worldwide. // Proprietary product; unlicensed use is not allowed package assets import ( "encoding/json" stderrors "errors" "fmt" "io" "code.tnxs.net/vernonkeenan/lib/api/crm/crm_models" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" ) // PostAssetsReader is a Reader for the PostAssets structure. type PostAssetsReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *PostAssetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { switch response.Code() { case 200: result := NewPostAssetsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewPostAssetsUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewPostAssetsForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewPostAssetsNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewPostAssetsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewPostAssetsInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[POST /assets] postAssets", response, response.Code()) } } // NewPostAssetsOK creates a PostAssetsOK with default headers values func NewPostAssetsOK() *PostAssetsOK { return &PostAssetsOK{} } // PostAssetsOK describes a response with status code 200, with default header values. // // Response with Asset objects with Contacts type PostAssetsOK struct { AccessControlAllowOrigin string CacheControl string Payload *crm_models.AssetResponse } // IsSuccess returns true when this post assets o k response has a 2xx status code func (o *PostAssetsOK) IsSuccess() bool { return true } // IsRedirect returns true when this post assets o k response has a 3xx status code func (o *PostAssetsOK) IsRedirect() bool { return false } // IsClientError returns true when this post assets o k response has a 4xx status code func (o *PostAssetsOK) IsClientError() bool { return false } // IsServerError returns true when this post assets o k response has a 5xx status code func (o *PostAssetsOK) IsServerError() bool { return false } // IsCode returns true when this post assets o k response a status code equal to that given func (o *PostAssetsOK) IsCode(code int) bool { return code == 200 } // Code gets the status code for the post assets o k response func (o *PostAssetsOK) Code() int { return 200 } func (o *PostAssetsOK) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsOK %s", 200, payload) } func (o *PostAssetsOK) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsOK %s", 200, payload) } func (o *PostAssetsOK) GetPayload() *crm_models.AssetResponse { return o.Payload } func (o *PostAssetsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header Access-Control-Allow-Origin hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") if hdrAccessControlAllowOrigin != "" { o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin } // hydrates response header Cache-Control hdrCacheControl := response.GetHeader("Cache-Control") if hdrCacheControl != "" { o.CacheControl = hdrCacheControl } o.Payload = new(crm_models.AssetResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostAssetsUnauthorized creates a PostAssetsUnauthorized with default headers values func NewPostAssetsUnauthorized() *PostAssetsUnauthorized { return &PostAssetsUnauthorized{} } // PostAssetsUnauthorized describes a response with status code 401, with default header values. // // Access unauthorized, invalid API-KEY was used type PostAssetsUnauthorized struct { AccessControlAllowOrigin string Payload *crm_models.Error } // IsSuccess returns true when this post assets unauthorized response has a 2xx status code func (o *PostAssetsUnauthorized) IsSuccess() bool { return false } // IsRedirect returns true when this post assets unauthorized response has a 3xx status code func (o *PostAssetsUnauthorized) IsRedirect() bool { return false } // IsClientError returns true when this post assets unauthorized response has a 4xx status code func (o *PostAssetsUnauthorized) IsClientError() bool { return true } // IsServerError returns true when this post assets unauthorized response has a 5xx status code func (o *PostAssetsUnauthorized) IsServerError() bool { return false } // IsCode returns true when this post assets unauthorized response a status code equal to that given func (o *PostAssetsUnauthorized) IsCode(code int) bool { return code == 401 } // Code gets the status code for the post assets unauthorized response func (o *PostAssetsUnauthorized) Code() int { return 401 } func (o *PostAssetsUnauthorized) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %s", 401, payload) } func (o *PostAssetsUnauthorized) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsUnauthorized %s", 401, payload) } func (o *PostAssetsUnauthorized) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAssetsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header Access-Control-Allow-Origin hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") if hdrAccessControlAllowOrigin != "" { o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin } o.Payload = new(crm_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostAssetsForbidden creates a PostAssetsForbidden with default headers values func NewPostAssetsForbidden() *PostAssetsForbidden { return &PostAssetsForbidden{} } // PostAssetsForbidden describes a response with status code 403, with default header values. // // Access forbidden, account lacks access type PostAssetsForbidden struct { AccessControlAllowOrigin string Payload *crm_models.Error } // IsSuccess returns true when this post assets forbidden response has a 2xx status code func (o *PostAssetsForbidden) IsSuccess() bool { return false } // IsRedirect returns true when this post assets forbidden response has a 3xx status code func (o *PostAssetsForbidden) IsRedirect() bool { return false } // IsClientError returns true when this post assets forbidden response has a 4xx status code func (o *PostAssetsForbidden) IsClientError() bool { return true } // IsServerError returns true when this post assets forbidden response has a 5xx status code func (o *PostAssetsForbidden) IsServerError() bool { return false } // IsCode returns true when this post assets forbidden response a status code equal to that given func (o *PostAssetsForbidden) IsCode(code int) bool { return code == 403 } // Code gets the status code for the post assets forbidden response func (o *PostAssetsForbidden) Code() int { return 403 } func (o *PostAssetsForbidden) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %s", 403, payload) } func (o *PostAssetsForbidden) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsForbidden %s", 403, payload) } func (o *PostAssetsForbidden) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAssetsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header Access-Control-Allow-Origin hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") if hdrAccessControlAllowOrigin != "" { o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin } o.Payload = new(crm_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostAssetsNotFound creates a PostAssetsNotFound with default headers values func NewPostAssetsNotFound() *PostAssetsNotFound { return &PostAssetsNotFound{} } // PostAssetsNotFound describes a response with status code 404, with default header values. // // Resource was not found type PostAssetsNotFound struct { AccessControlAllowOrigin string Payload *crm_models.Error } // IsSuccess returns true when this post assets not found response has a 2xx status code func (o *PostAssetsNotFound) IsSuccess() bool { return false } // IsRedirect returns true when this post assets not found response has a 3xx status code func (o *PostAssetsNotFound) IsRedirect() bool { return false } // IsClientError returns true when this post assets not found response has a 4xx status code func (o *PostAssetsNotFound) IsClientError() bool { return true } // IsServerError returns true when this post assets not found response has a 5xx status code func (o *PostAssetsNotFound) IsServerError() bool { return false } // IsCode returns true when this post assets not found response a status code equal to that given func (o *PostAssetsNotFound) IsCode(code int) bool { return code == 404 } // Code gets the status code for the post assets not found response func (o *PostAssetsNotFound) Code() int { return 404 } func (o *PostAssetsNotFound) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %s", 404, payload) } func (o *PostAssetsNotFound) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsNotFound %s", 404, payload) } func (o *PostAssetsNotFound) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAssetsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header Access-Control-Allow-Origin hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") if hdrAccessControlAllowOrigin != "" { o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin } o.Payload = new(crm_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostAssetsUnprocessableEntity creates a PostAssetsUnprocessableEntity with default headers values func NewPostAssetsUnprocessableEntity() *PostAssetsUnprocessableEntity { return &PostAssetsUnprocessableEntity{} } // PostAssetsUnprocessableEntity describes a response with status code 422, with default header values. // // Unprocessable Entity, likely a bad parameter type PostAssetsUnprocessableEntity struct { AccessControlAllowOrigin string Payload *crm_models.Error } // IsSuccess returns true when this post assets unprocessable entity response has a 2xx status code func (o *PostAssetsUnprocessableEntity) IsSuccess() bool { return false } // IsRedirect returns true when this post assets unprocessable entity response has a 3xx status code func (o *PostAssetsUnprocessableEntity) IsRedirect() bool { return false } // IsClientError returns true when this post assets unprocessable entity response has a 4xx status code func (o *PostAssetsUnprocessableEntity) IsClientError() bool { return true } // IsServerError returns true when this post assets unprocessable entity response has a 5xx status code func (o *PostAssetsUnprocessableEntity) IsServerError() bool { return false } // IsCode returns true when this post assets unprocessable entity response a status code equal to that given func (o *PostAssetsUnprocessableEntity) IsCode(code int) bool { return code == 422 } // Code gets the status code for the post assets unprocessable entity response func (o *PostAssetsUnprocessableEntity) Code() int { return 422 } func (o *PostAssetsUnprocessableEntity) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %s", 422, payload) } func (o *PostAssetsUnprocessableEntity) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsUnprocessableEntity %s", 422, payload) } func (o *PostAssetsUnprocessableEntity) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAssetsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header Access-Control-Allow-Origin hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") if hdrAccessControlAllowOrigin != "" { o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin } o.Payload = new(crm_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostAssetsInternalServerError creates a PostAssetsInternalServerError with default headers values func NewPostAssetsInternalServerError() *PostAssetsInternalServerError { return &PostAssetsInternalServerError{} } // PostAssetsInternalServerError describes a response with status code 500, with default header values. // // Server Internal Error type PostAssetsInternalServerError struct { AccessControlAllowOrigin string Payload *crm_models.Error } // IsSuccess returns true when this post assets internal server error response has a 2xx status code func (o *PostAssetsInternalServerError) IsSuccess() bool { return false } // IsRedirect returns true when this post assets internal server error response has a 3xx status code func (o *PostAssetsInternalServerError) IsRedirect() bool { return false } // IsClientError returns true when this post assets internal server error response has a 4xx status code func (o *PostAssetsInternalServerError) IsClientError() bool { return false } // IsServerError returns true when this post assets internal server error response has a 5xx status code func (o *PostAssetsInternalServerError) IsServerError() bool { return true } // IsCode returns true when this post assets internal server error response a status code equal to that given func (o *PostAssetsInternalServerError) IsCode(code int) bool { return code == 500 } // Code gets the status code for the post assets internal server error response func (o *PostAssetsInternalServerError) Code() int { return 500 } func (o *PostAssetsInternalServerError) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %s", 500, payload) } func (o *PostAssetsInternalServerError) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /assets][%d] postAssetsInternalServerError %s", 500, payload) } func (o *PostAssetsInternalServerError) GetPayload() *crm_models.Error { return o.Payload } func (o *PostAssetsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header Access-Control-Allow-Origin hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") if hdrAccessControlAllowOrigin != "" { o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin } o.Payload = new(crm_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil }