// 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 period // 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/ledger/ledger_models" ) // PostPeriodsReader is a Reader for the PostPeriods structure. type PostPeriodsReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *PostPeriodsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewPostPeriodsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewPostPeriodsUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewPostPeriodsForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewPostPeriodsNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewPostPeriodsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewPostPeriodsInternalServerError() 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()) } } // NewPostPeriodsOK creates a PostPeriodsOK with default headers values func NewPostPeriodsOK() *PostPeriodsOK { return &PostPeriodsOK{} } /*PostPeriodsOK handles this case with default header values. Taxnexus Response with Period objects */ type PostPeriodsOK struct { Payload *ledger_models.PeriodResponse } 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 } func (o *PostPeriodsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(ledger_models.PeriodResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostPeriodsUnauthorized creates a PostPeriodsUnauthorized with default headers values func NewPostPeriodsUnauthorized() *PostPeriodsUnauthorized { return &PostPeriodsUnauthorized{} } /*PostPeriodsUnauthorized handles this case with default header values. Access Unauthorized, invalid API-KEY was used */ type PostPeriodsUnauthorized struct { Payload *ledger_models.Error } 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 } func (o *PostPeriodsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(ledger_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostPeriodsForbidden creates a PostPeriodsForbidden with default headers values func NewPostPeriodsForbidden() *PostPeriodsForbidden { return &PostPeriodsForbidden{} } /*PostPeriodsForbidden handles this case with default header values. Access forbidden, account lacks access */ type PostPeriodsForbidden struct { Payload *ledger_models.Error } 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 } func (o *PostPeriodsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(ledger_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostPeriodsNotFound creates a PostPeriodsNotFound with default headers values func NewPostPeriodsNotFound() *PostPeriodsNotFound { return &PostPeriodsNotFound{} } /*PostPeriodsNotFound handles this case with default header values. Resource was not found */ type PostPeriodsNotFound struct { Payload *ledger_models.Error } 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 } func (o *PostPeriodsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(ledger_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostPeriodsUnprocessableEntity creates a PostPeriodsUnprocessableEntity with default headers values func NewPostPeriodsUnprocessableEntity() *PostPeriodsUnprocessableEntity { return &PostPeriodsUnprocessableEntity{} } /*PostPeriodsUnprocessableEntity handles this case with default header values. Unprocessable Entity, likely a bad parameter */ type PostPeriodsUnprocessableEntity struct { Payload *ledger_models.Error } 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 } func (o *PostPeriodsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(ledger_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostPeriodsInternalServerError creates a PostPeriodsInternalServerError with default headers values func NewPostPeriodsInternalServerError() *PostPeriodsInternalServerError { return &PostPeriodsInternalServerError{} } /*PostPeriodsInternalServerError handles this case with default header values. Server Internal Error */ type PostPeriodsInternalServerError struct { Payload *ledger_models.Error } 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 } func (o *PostPeriodsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(ledger_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil }