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

package blobs

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

// PullBlobJSONReader is a Reader for the PullBlobJSON structure.
type PullBlobJSONReader struct {
	formats strfmt.Registry
}

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

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

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

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

// NewPullBlobJSONOK creates a PullBlobJSONOK with default headers values
func NewPullBlobJSONOK() *PullBlobJSONOK {
	return &PullBlobJSONOK{}
}

/*PullBlobJSONOK handles this case with default header values.

successful operation
*/
type PullBlobJSONOK struct {
	Payload *models.PullJSON
}

func (o *PullBlobJSONOK) Error() string {
	return fmt.Sprintf("[GET /api/v1/packages/{namespace}/{package}/blobs/sha256/{digest}/json][%d] pullBlobJsonOK  %+v", 200, o.Payload)
}

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

	o.Payload = new(models.PullJSON)

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

	return nil
}

// NewPullBlobJSONUnauthorized creates a PullBlobJSONUnauthorized with default headers values
func NewPullBlobJSONUnauthorized() *PullBlobJSONUnauthorized {
	return &PullBlobJSONUnauthorized{}
}

/*PullBlobJSONUnauthorized handles this case with default header values.

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

func (o *PullBlobJSONUnauthorized) Error() string {
	return fmt.Sprintf("[GET /api/v1/packages/{namespace}/{package}/blobs/sha256/{digest}/json][%d] pullBlobJsonUnauthorized  %+v", 401, o.Payload)
}

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

// NewPullBlobJSONNotFound creates a PullBlobJSONNotFound with default headers values
func NewPullBlobJSONNotFound() *PullBlobJSONNotFound {
	return &PullBlobJSONNotFound{}
}

/*PullBlobJSONNotFound handles this case with default header values.

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

func (o *PullBlobJSONNotFound) Error() string {
	return fmt.Sprintf("[GET /api/v1/packages/{namespace}/{package}/blobs/sha256/{digest}/json][%d] pullBlobJsonNotFound  %+v", 404, o.Payload)
}

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