// Code generated by go-swagger; DO NOT EDIT. // All Code Copyright(c) 2018-2021 by Taxnexus, Inc. // All rights reserved worldwide. // Proprietary product; unlicensed use is not allowed package state // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "fmt" "io" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) // PostStatesReader is a Reader for the PostStates structure. type PostStatesReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *PostStatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewPostStatesOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewPostStatesUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewPostStatesForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewPostStatesNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewPostStatesUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewPostStatesInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("unknown error", response, response.Code()) } } // NewPostStatesOK creates a PostStatesOK with default headers values func NewPostStatesOK() *PostStatesOK { return &PostStatesOK{} } /*PostStatesOK handles this case with default header values. Taxnexus Response with an array of State objects */ type PostStatesOK struct { AccessControlAllowOrigin string CacheControl string Payload *geo_models.StateResponse } 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") // response header Cache-Control o.CacheControl = response.GetHeader("Cache-Control") o.Payload = new(geo_models.StateResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostStatesUnauthorized creates a PostStatesUnauthorized with default headers values func NewPostStatesUnauthorized() *PostStatesUnauthorized { return &PostStatesUnauthorized{} } /*PostStatesUnauthorized handles this case with default header values. Access unauthorized, invalid API-KEY was used */ type PostStatesUnauthorized struct { AccessControlAllowOrigin string Payload *geo_models.Error } 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") o.Payload = new(geo_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostStatesForbidden creates a PostStatesForbidden with default headers values func NewPostStatesForbidden() *PostStatesForbidden { return &PostStatesForbidden{} } /*PostStatesForbidden handles this case with default header values. Access forbidden, account lacks access */ type PostStatesForbidden struct { AccessControlAllowOrigin string Payload *geo_models.Error } 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") o.Payload = new(geo_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostStatesNotFound creates a PostStatesNotFound with default headers values func NewPostStatesNotFound() *PostStatesNotFound { return &PostStatesNotFound{} } /*PostStatesNotFound handles this case with default header values. Resource was not found */ type PostStatesNotFound struct { AccessControlAllowOrigin string Payload *geo_models.Error } 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") o.Payload = new(geo_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostStatesUnprocessableEntity creates a PostStatesUnprocessableEntity with default headers values func NewPostStatesUnprocessableEntity() *PostStatesUnprocessableEntity { return &PostStatesUnprocessableEntity{} } /*PostStatesUnprocessableEntity handles this case with default header values. Unprocessable Entity, likely a bad parameter */ type PostStatesUnprocessableEntity struct { AccessControlAllowOrigin string Payload *geo_models.Error } 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") o.Payload = new(geo_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostStatesInternalServerError creates a PostStatesInternalServerError with default headers values func NewPostStatesInternalServerError() *PostStatesInternalServerError { return &PostStatesInternalServerError{} } /*PostStatesInternalServerError handles this case with default header values. Server Internal Error */ type PostStatesInternalServerError struct { AccessControlAllowOrigin string Payload *geo_models.Error } 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") o.Payload = new(geo_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil }