// Code generated by go-swagger; DO NOT EDIT.

package dashboard_versions

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/grafana/grafana-openapi-client-go/models"
)

// GetDashboardVersionsByUIDReader is a Reader for the GetDashboardVersionsByUID structure.
type GetDashboardVersionsByUIDReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetDashboardVersionsByUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetDashboardVersionsByUIDOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetDashboardVersionsByUIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetDashboardVersionsByUIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetDashboardVersionsByUIDNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetDashboardVersionsByUIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /dashboards/uid/{uid}/versions] getDashboardVersionsByUID", response, response.Code())
	}
}

// NewGetDashboardVersionsByUIDOK creates a GetDashboardVersionsByUIDOK with default headers values
func NewGetDashboardVersionsByUIDOK() *GetDashboardVersionsByUIDOK {
	return &GetDashboardVersionsByUIDOK{}
}

/*
GetDashboardVersionsByUIDOK describes a response with status code 200, with default header values.

(empty)
*/
type GetDashboardVersionsByUIDOK struct {
	Payload []*models.DashboardVersionMeta
}

// IsSuccess returns true when this get dashboard versions by Uid Ok response has a 2xx status code
func (o *GetDashboardVersionsByUIDOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get dashboard versions by Uid Ok response has a 3xx status code
func (o *GetDashboardVersionsByUIDOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get dashboard versions by Uid Ok response has a 4xx status code
func (o *GetDashboardVersionsByUIDOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get dashboard versions by Uid Ok response has a 5xx status code
func (o *GetDashboardVersionsByUIDOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get dashboard versions by Uid Ok response a status code equal to that given
func (o *GetDashboardVersionsByUIDOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get dashboard versions by Uid Ok response
func (o *GetDashboardVersionsByUIDOK) Code() int {
	return 200
}

func (o *GetDashboardVersionsByUIDOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidOk %s", 200, payload)
}

func (o *GetDashboardVersionsByUIDOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidOk %s", 200, payload)
}

func (o *GetDashboardVersionsByUIDOK) GetPayload() []*models.DashboardVersionMeta {
	return o.Payload
}

func (o *GetDashboardVersionsByUIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetDashboardVersionsByUIDUnauthorized creates a GetDashboardVersionsByUIDUnauthorized with default headers values
func NewGetDashboardVersionsByUIDUnauthorized() *GetDashboardVersionsByUIDUnauthorized {
	return &GetDashboardVersionsByUIDUnauthorized{}
}

/*
GetDashboardVersionsByUIDUnauthorized describes a response with status code 401, with default header values.

UnauthorizedError is returned when the request is not authenticated.
*/
type GetDashboardVersionsByUIDUnauthorized struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this get dashboard versions by Uid unauthorized response has a 2xx status code
func (o *GetDashboardVersionsByUIDUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get dashboard versions by Uid unauthorized response has a 3xx status code
func (o *GetDashboardVersionsByUIDUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get dashboard versions by Uid unauthorized response has a 4xx status code
func (o *GetDashboardVersionsByUIDUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get dashboard versions by Uid unauthorized response has a 5xx status code
func (o *GetDashboardVersionsByUIDUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get dashboard versions by Uid unauthorized response a status code equal to that given
func (o *GetDashboardVersionsByUIDUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get dashboard versions by Uid unauthorized response
func (o *GetDashboardVersionsByUIDUnauthorized) Code() int {
	return 401
}

func (o *GetDashboardVersionsByUIDUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidUnauthorized %s", 401, payload)
}

func (o *GetDashboardVersionsByUIDUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidUnauthorized %s", 401, payload)
}

func (o *GetDashboardVersionsByUIDUnauthorized) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

func (o *GetDashboardVersionsByUIDUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponseBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetDashboardVersionsByUIDForbidden creates a GetDashboardVersionsByUIDForbidden with default headers values
func NewGetDashboardVersionsByUIDForbidden() *GetDashboardVersionsByUIDForbidden {
	return &GetDashboardVersionsByUIDForbidden{}
}

/*
GetDashboardVersionsByUIDForbidden describes a response with status code 403, with default header values.

ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
*/
type GetDashboardVersionsByUIDForbidden struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this get dashboard versions by Uid forbidden response has a 2xx status code
func (o *GetDashboardVersionsByUIDForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get dashboard versions by Uid forbidden response has a 3xx status code
func (o *GetDashboardVersionsByUIDForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get dashboard versions by Uid forbidden response has a 4xx status code
func (o *GetDashboardVersionsByUIDForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get dashboard versions by Uid forbidden response has a 5xx status code
func (o *GetDashboardVersionsByUIDForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get dashboard versions by Uid forbidden response a status code equal to that given
func (o *GetDashboardVersionsByUIDForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get dashboard versions by Uid forbidden response
func (o *GetDashboardVersionsByUIDForbidden) Code() int {
	return 403
}

func (o *GetDashboardVersionsByUIDForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidForbidden %s", 403, payload)
}

func (o *GetDashboardVersionsByUIDForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidForbidden %s", 403, payload)
}

func (o *GetDashboardVersionsByUIDForbidden) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

func (o *GetDashboardVersionsByUIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponseBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetDashboardVersionsByUIDNotFound creates a GetDashboardVersionsByUIDNotFound with default headers values
func NewGetDashboardVersionsByUIDNotFound() *GetDashboardVersionsByUIDNotFound {
	return &GetDashboardVersionsByUIDNotFound{}
}

/*
GetDashboardVersionsByUIDNotFound describes a response with status code 404, with default header values.

NotFoundError is returned when the requested resource was not found.
*/
type GetDashboardVersionsByUIDNotFound struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this get dashboard versions by Uid not found response has a 2xx status code
func (o *GetDashboardVersionsByUIDNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get dashboard versions by Uid not found response has a 3xx status code
func (o *GetDashboardVersionsByUIDNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get dashboard versions by Uid not found response has a 4xx status code
func (o *GetDashboardVersionsByUIDNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this get dashboard versions by Uid not found response has a 5xx status code
func (o *GetDashboardVersionsByUIDNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this get dashboard versions by Uid not found response a status code equal to that given
func (o *GetDashboardVersionsByUIDNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the get dashboard versions by Uid not found response
func (o *GetDashboardVersionsByUIDNotFound) Code() int {
	return 404
}

func (o *GetDashboardVersionsByUIDNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidNotFound %s", 404, payload)
}

func (o *GetDashboardVersionsByUIDNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidNotFound %s", 404, payload)
}

func (o *GetDashboardVersionsByUIDNotFound) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

func (o *GetDashboardVersionsByUIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponseBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetDashboardVersionsByUIDInternalServerError creates a GetDashboardVersionsByUIDInternalServerError with default headers values
func NewGetDashboardVersionsByUIDInternalServerError() *GetDashboardVersionsByUIDInternalServerError {
	return &GetDashboardVersionsByUIDInternalServerError{}
}

/*
GetDashboardVersionsByUIDInternalServerError describes a response with status code 500, with default header values.

InternalServerError is a general error indicating something went wrong internally.
*/
type GetDashboardVersionsByUIDInternalServerError struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this get dashboard versions by Uid internal server error response has a 2xx status code
func (o *GetDashboardVersionsByUIDInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get dashboard versions by Uid internal server error response has a 3xx status code
func (o *GetDashboardVersionsByUIDInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get dashboard versions by Uid internal server error response has a 4xx status code
func (o *GetDashboardVersionsByUIDInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get dashboard versions by Uid internal server error response has a 5xx status code
func (o *GetDashboardVersionsByUIDInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get dashboard versions by Uid internal server error response a status code equal to that given
func (o *GetDashboardVersionsByUIDInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get dashboard versions by Uid internal server error response
func (o *GetDashboardVersionsByUIDInternalServerError) Code() int {
	return 500
}

func (o *GetDashboardVersionsByUIDInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidInternalServerError %s", 500, payload)
}

func (o *GetDashboardVersionsByUIDInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /dashboards/uid/{uid}/versions][%d] getDashboardVersionsByUidInternalServerError %s", 500, payload)
}

func (o *GetDashboardVersionsByUIDInternalServerError) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

func (o *GetDashboardVersionsByUIDInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponseBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}
