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

package timelines

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

	"git.coopcloud.tech/decentral1se/gtslib/models"
)

// TagTimelineReader is a Reader for the TagTimeline structure.
type TagTimelineReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *TagTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewTagTimelineOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewTagTimelineBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewTagTimelineUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /api/v1/timelines/tag/{tag_name}] tagTimeline", response, response.Code())
	}
}

// NewTagTimelineOK creates a TagTimelineOK with default headers values
func NewTagTimelineOK() *TagTimelineOK {
	return &TagTimelineOK{}
}

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

Array of statuses.
*/
type TagTimelineOK struct {

	/* Links to the next and previous queries.
	 */
	Link string

	Payload []*models.Status
}

// IsSuccess returns true when this tag timeline o k response has a 2xx status code
func (o *TagTimelineOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this tag timeline o k response has a 3xx status code
func (o *TagTimelineOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this tag timeline o k response has a 4xx status code
func (o *TagTimelineOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this tag timeline o k response has a 5xx status code
func (o *TagTimelineOK) IsServerError() bool {
	return false
}

// IsCode returns true when this tag timeline o k response a status code equal to that given
func (o *TagTimelineOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the tag timeline o k response
func (o *TagTimelineOK) Code() int {
	return 200
}

func (o *TagTimelineOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineOK %s", 200, payload)
}

func (o *TagTimelineOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineOK %s", 200, payload)
}

func (o *TagTimelineOK) GetPayload() []*models.Status {
	return o.Payload
}

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

	// hydrates response header Link
	hdrLink := response.GetHeader("Link")

	if hdrLink != "" {
		o.Link = hdrLink
	}

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

	return nil
}

// NewTagTimelineBadRequest creates a TagTimelineBadRequest with default headers values
func NewTagTimelineBadRequest() *TagTimelineBadRequest {
	return &TagTimelineBadRequest{}
}

/*
TagTimelineBadRequest describes a response with status code 400, with default header values.

bad request
*/
type TagTimelineBadRequest struct {
}

// IsSuccess returns true when this tag timeline bad request response has a 2xx status code
func (o *TagTimelineBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this tag timeline bad request response has a 3xx status code
func (o *TagTimelineBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this tag timeline bad request response has a 4xx status code
func (o *TagTimelineBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this tag timeline bad request response has a 5xx status code
func (o *TagTimelineBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this tag timeline bad request response a status code equal to that given
func (o *TagTimelineBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the tag timeline bad request response
func (o *TagTimelineBadRequest) Code() int {
	return 400
}

func (o *TagTimelineBadRequest) Error() string {
	return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineBadRequest", 400)
}

func (o *TagTimelineBadRequest) String() string {
	return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineBadRequest", 400)
}

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

	return nil
}

// NewTagTimelineUnauthorized creates a TagTimelineUnauthorized with default headers values
func NewTagTimelineUnauthorized() *TagTimelineUnauthorized {
	return &TagTimelineUnauthorized{}
}

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

unauthorized
*/
type TagTimelineUnauthorized struct {
}

// IsSuccess returns true when this tag timeline unauthorized response has a 2xx status code
func (o *TagTimelineUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this tag timeline unauthorized response has a 3xx status code
func (o *TagTimelineUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this tag timeline unauthorized response has a 4xx status code
func (o *TagTimelineUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this tag timeline unauthorized response has a 5xx status code
func (o *TagTimelineUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this tag timeline unauthorized response a status code equal to that given
func (o *TagTimelineUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the tag timeline unauthorized response
func (o *TagTimelineUnauthorized) Code() int {
	return 401
}

func (o *TagTimelineUnauthorized) Error() string {
	return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineUnauthorized", 401)
}

func (o *TagTimelineUnauthorized) String() string {
	return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineUnauthorized", 401)
}

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

	return nil
}
