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

// ListTimelineReader is a Reader for the ListTimeline structure.
type ListTimelineReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewListTimelineOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewListTimelineBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewListTimelineUnauthorized()
		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/list/{id}] listTimeline", response, response.Code())
	}
}

// NewListTimelineOK creates a ListTimelineOK with default headers values
func NewListTimelineOK() *ListTimelineOK {
	return &ListTimelineOK{}
}

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

Array of statuses.
*/
type ListTimelineOK struct {

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

	Payload []*models.Status
}

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

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

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

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

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

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

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

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

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

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

// NewListTimelineBadRequest creates a ListTimelineBadRequest with default headers values
func NewListTimelineBadRequest() *ListTimelineBadRequest {
	return &ListTimelineBadRequest{}
}

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

bad request
*/
type ListTimelineBadRequest struct {
}

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

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

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

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

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

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

func (o *ListTimelineBadRequest) Error() string {
	return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineBadRequest", 400)
}

func (o *ListTimelineBadRequest) String() string {
	return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineBadRequest", 400)
}

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

	return nil
}

// NewListTimelineUnauthorized creates a ListTimelineUnauthorized with default headers values
func NewListTimelineUnauthorized() *ListTimelineUnauthorized {
	return &ListTimelineUnauthorized{}
}

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

unauthorized
*/
type ListTimelineUnauthorized struct {
}

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

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

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

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

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

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

func (o *ListTimelineUnauthorized) Error() string {
	return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineUnauthorized", 401)
}

func (o *ListTimelineUnauthorized) String() string {
	return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineUnauthorized", 401)
}

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

	return nil
}
