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

package package_appr

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

// ShowPackageReleasesReader is a Reader for the ShowPackageReleases structure.
type ShowPackageReleasesReader struct {
	formats strfmt.Registry
}

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

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

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

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

// NewShowPackageReleasesOK creates a ShowPackageReleasesOK with default headers values
func NewShowPackageReleasesOK() *ShowPackageReleasesOK {
	return &ShowPackageReleasesOK{}
}

/*ShowPackageReleasesOK handles this case with default header values.

successful operation
*/
type ShowPackageReleasesOK struct {
	Payload models.PackageManifest
}

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

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

// NewShowPackageReleasesUnauthorized creates a ShowPackageReleasesUnauthorized with default headers values
func NewShowPackageReleasesUnauthorized() *ShowPackageReleasesUnauthorized {
	return &ShowPackageReleasesUnauthorized{}
}

/*ShowPackageReleasesUnauthorized handles this case with default header values.

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

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

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

// NewShowPackageReleasesNotFound creates a ShowPackageReleasesNotFound with default headers values
func NewShowPackageReleasesNotFound() *ShowPackageReleasesNotFound {
	return &ShowPackageReleasesNotFound{}
}

/*ShowPackageReleasesNotFound handles this case with default header values.

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

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

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