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

package dashboards

// 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"
)

// GetDashboardTagsReader is a Reader for the GetDashboardTags structure.
type GetDashboardTagsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetDashboardTagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetDashboardTagsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetDashboardTagsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetDashboardTagsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /dashboards/tags] getDashboardTags", response, response.Code())
	}
}

// NewGetDashboardTagsOK creates a GetDashboardTagsOK with default headers values
func NewGetDashboardTagsOK() *GetDashboardTagsOK {
	return &GetDashboardTagsOK{}
}

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

(empty)
*/
type GetDashboardTagsOK struct {
	Payload []*models.DashboardTagCloudItem
}

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

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

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

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

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

// Code gets the status code for the get dashboard tags Ok response
func (o *GetDashboardTagsOK) Code() int {
	return 200
}

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

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

func (o *GetDashboardTagsOK) GetPayload() []*models.DashboardTagCloudItem {
	return o.Payload
}

func (o *GetDashboardTagsOK) 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
}

// NewGetDashboardTagsUnauthorized creates a GetDashboardTagsUnauthorized with default headers values
func NewGetDashboardTagsUnauthorized() *GetDashboardTagsUnauthorized {
	return &GetDashboardTagsUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get dashboard tags unauthorized response
func (o *GetDashboardTagsUnauthorized) Code() int {
	return 401
}

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

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

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

func (o *GetDashboardTagsUnauthorized) 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
}

// NewGetDashboardTagsInternalServerError creates a GetDashboardTagsInternalServerError with default headers values
func NewGetDashboardTagsInternalServerError() *GetDashboardTagsInternalServerError {
	return &GetDashboardTagsInternalServerError{}
}

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

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

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

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

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

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

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

// Code gets the status code for the get dashboard tags internal server error response
func (o *GetDashboardTagsInternalServerError) Code() int {
	return 500
}

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

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

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

func (o *GetDashboardTagsInternalServerError) 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
}
