// Code generated by go-swagger; DO NOT EDIT. // All Code Copyright(c) 2018-2020 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" "github.com/taxnexus/go/lib/api/ledger/ledger_models" ) // GetPeriodsReader is a Reader for the GetPeriods structure. type GetPeriodsReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *GetPeriodsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetPeriodsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewGetPeriodsUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewGetPeriodsForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewGetPeriodsNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewGetPeriodsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewGetPeriodsInternalServerError() 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()) } } // NewGetPeriodsOK creates a GetPeriodsOK with default headers values func NewGetPeriodsOK() *GetPeriodsOK { return &GetPeriodsOK{} } /*GetPeriodsOK handles this case with default header values. Taxnexus Response with Period objects */ type GetPeriodsOK struct { Payload *ledger_models.PeriodResponse } func (o *GetPeriodsOK) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsOK %+v", 200, o.Payload) } func (o *GetPeriodsOK) GetPayload() *ledger_models.PeriodResponse { return o.Payload } func (o *GetPeriodsOK) 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 } // NewGetPeriodsUnauthorized creates a GetPeriodsUnauthorized with default headers values func NewGetPeriodsUnauthorized() *GetPeriodsUnauthorized { return &GetPeriodsUnauthorized{} } /*GetPeriodsUnauthorized handles this case with default header values. Access Unauthorized, invalid API-KEY was used */ type GetPeriodsUnauthorized struct { Payload *ledger_models.Error } func (o *GetPeriodsUnauthorized) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsUnauthorized %+v", 401, o.Payload) } func (o *GetPeriodsUnauthorized) GetPayload() *ledger_models.Error { return o.Payload } func (o *GetPeriodsUnauthorized) 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 } // NewGetPeriodsForbidden creates a GetPeriodsForbidden with default headers values func NewGetPeriodsForbidden() *GetPeriodsForbidden { return &GetPeriodsForbidden{} } /*GetPeriodsForbidden handles this case with default header values. Access forbidden, account lacks access */ type GetPeriodsForbidden struct { Payload *ledger_models.Error } func (o *GetPeriodsForbidden) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsForbidden %+v", 403, o.Payload) } func (o *GetPeriodsForbidden) GetPayload() *ledger_models.Error { return o.Payload } func (o *GetPeriodsForbidden) 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 } // NewGetPeriodsNotFound creates a GetPeriodsNotFound with default headers values func NewGetPeriodsNotFound() *GetPeriodsNotFound { return &GetPeriodsNotFound{} } /*GetPeriodsNotFound handles this case with default header values. Resource was not found */ type GetPeriodsNotFound struct { Payload *ledger_models.Error } func (o *GetPeriodsNotFound) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsNotFound %+v", 404, o.Payload) } func (o *GetPeriodsNotFound) GetPayload() *ledger_models.Error { return o.Payload } func (o *GetPeriodsNotFound) 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 } // NewGetPeriodsUnprocessableEntity creates a GetPeriodsUnprocessableEntity with default headers values func NewGetPeriodsUnprocessableEntity() *GetPeriodsUnprocessableEntity { return &GetPeriodsUnprocessableEntity{} } /*GetPeriodsUnprocessableEntity handles this case with default header values. Unprocessable Entity, likely a bad parameter */ type GetPeriodsUnprocessableEntity struct { Payload *ledger_models.Error } func (o *GetPeriodsUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsUnprocessableEntity %+v", 422, o.Payload) } func (o *GetPeriodsUnprocessableEntity) GetPayload() *ledger_models.Error { return o.Payload } func (o *GetPeriodsUnprocessableEntity) 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 } // NewGetPeriodsInternalServerError creates a GetPeriodsInternalServerError with default headers values func NewGetPeriodsInternalServerError() *GetPeriodsInternalServerError { return &GetPeriodsInternalServerError{} } /*GetPeriodsInternalServerError handles this case with default header values. Server Internal Error */ type GetPeriodsInternalServerError struct { Payload *ledger_models.Error } func (o *GetPeriodsInternalServerError) Error() string { return fmt.Sprintf("[GET /periods][%d] getPeriodsInternalServerError %+v", 500, o.Payload) } func (o *GetPeriodsInternalServerError) GetPayload() *ledger_models.Error { return o.Payload } func (o *GetPeriodsInternalServerError) 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 }