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

package channel

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

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

	models "github.com/operator-framework/go-appr/models"
)

// ShowChannelReader is a Reader for the ShowChannel structure.
type ShowChannelReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ShowChannelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 200:
		result := NewShowChannelOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 401:
		result := NewShowChannelUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	case 404:
		result := NewShowChannelNotFound()
		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())
	}
}

// NewShowChannelOK creates a ShowChannelOK with default headers values
func NewShowChannelOK() *ShowChannelOK {
	return &ShowChannelOK{}
}

/*ShowChannelOK handles this case with default header values.

successful operation
*/
type ShowChannelOK struct {
	Payload []*models.Channel
}

func (o *ShowChannelOK) Error() string {
	return fmt.Sprintf("[GET /api/v1/packages/{namespace}/{package}/channels/{channel}][%d] showChannelOK  %+v", 200, o.Payload)
}

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

// NewShowChannelUnauthorized creates a ShowChannelUnauthorized with default headers values
func NewShowChannelUnauthorized() *ShowChannelUnauthorized {
	return &ShowChannelUnauthorized{}
}

/*ShowChannelUnauthorized handles this case with default header values.

Not authorized to read the package
*/
type ShowChannelUnauthorized struct {
	Payload *models.Error
}

func (o *ShowChannelUnauthorized) Error() string {
	return fmt.Sprintf("[GET /api/v1/packages/{namespace}/{package}/channels/{channel}][%d] showChannelUnauthorized  %+v", 401, o.Payload)
}

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

	o.Payload = new(models.Error)

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

	return nil
}

// NewShowChannelNotFound creates a ShowChannelNotFound with default headers values
func NewShowChannelNotFound() *ShowChannelNotFound {
	return &ShowChannelNotFound{}
}

/*ShowChannelNotFound handles this case with default header values.

Package not found
*/
type ShowChannelNotFound struct {
	Payload *models.Error
}

func (o *ShowChannelNotFound) Error() string {
	return fmt.Sprintf("[GET /api/v1/packages/{namespace}/{package}/channels/{channel}][%d] showChannelNotFound  %+v", 404, o.Payload)
}

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

	o.Payload = new(models.Error)

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

	return nil
}
