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

package issue

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"

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

// PinIssueReader is a Reader for the PinIssue structure.
type PinIssueReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PinIssueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 204:
		result := NewPinIssueNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewPinIssueForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPinIssueNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/{index}/pin] pinIssue", response, response.Code())
	}
}

// NewPinIssueNoContent creates a PinIssueNoContent with default headers values
func NewPinIssueNoContent() *PinIssueNoContent {
	return &PinIssueNoContent{}
}

/*
PinIssueNoContent describes a response with status code 204, with default header values.

APIEmpty is an empty response
*/
type PinIssueNoContent struct {
}

// IsSuccess returns true when this pin issue no content response has a 2xx status code
func (o *PinIssueNoContent) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this pin issue no content response has a 3xx status code
func (o *PinIssueNoContent) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pin issue no content response has a 4xx status code
func (o *PinIssueNoContent) IsClientError() bool {
	return false
}

// IsServerError returns true when this pin issue no content response has a 5xx status code
func (o *PinIssueNoContent) IsServerError() bool {
	return false
}

// IsCode returns true when this pin issue no content response a status code equal to that given
func (o *PinIssueNoContent) IsCode(code int) bool {
	return code == 204
}

// Code gets the status code for the pin issue no content response
func (o *PinIssueNoContent) Code() int {
	return 204
}

func (o *PinIssueNoContent) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/pin][%d] pinIssueNoContent", 204)
}

func (o *PinIssueNoContent) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/pin][%d] pinIssueNoContent", 204)
}

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

	return nil
}

// NewPinIssueForbidden creates a PinIssueForbidden with default headers values
func NewPinIssueForbidden() *PinIssueForbidden {
	return &PinIssueForbidden{}
}

/*
PinIssueForbidden describes a response with status code 403, with default header values.

APIForbiddenError is a forbidden error response
*/
type PinIssueForbidden struct {
	Message string
	URL     string
}

// IsSuccess returns true when this pin issue forbidden response has a 2xx status code
func (o *PinIssueForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this pin issue forbidden response has a 3xx status code
func (o *PinIssueForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pin issue forbidden response has a 4xx status code
func (o *PinIssueForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this pin issue forbidden response has a 5xx status code
func (o *PinIssueForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this pin issue forbidden response a status code equal to that given
func (o *PinIssueForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the pin issue forbidden response
func (o *PinIssueForbidden) Code() int {
	return 403
}

func (o *PinIssueForbidden) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/pin][%d] pinIssueForbidden", 403)
}

func (o *PinIssueForbidden) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/pin][%d] pinIssueForbidden", 403)
}

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

	// hydrates response header message
	hdrMessage := response.GetHeader("message")

	if hdrMessage != "" {
		o.Message = hdrMessage
	}

	// hydrates response header url
	hdrURL := response.GetHeader("url")

	if hdrURL != "" {
		o.URL = hdrURL
	}

	return nil
}

// NewPinIssueNotFound creates a PinIssueNotFound with default headers values
func NewPinIssueNotFound() *PinIssueNotFound {
	return &PinIssueNotFound{}
}

/*
PinIssueNotFound describes a response with status code 404, with default header values.

APINotFound is a not found empty response
*/
type PinIssueNotFound struct {
}

// IsSuccess returns true when this pin issue not found response has a 2xx status code
func (o *PinIssueNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this pin issue not found response has a 3xx status code
func (o *PinIssueNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pin issue not found response has a 4xx status code
func (o *PinIssueNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this pin issue not found response has a 5xx status code
func (o *PinIssueNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this pin issue not found response a status code equal to that given
func (o *PinIssueNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the pin issue not found response
func (o *PinIssueNotFound) Code() int {
	return 404
}

func (o *PinIssueNotFound) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/pin][%d] pinIssueNotFound", 404)
}

func (o *PinIssueNotFound) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/pin][%d] pinIssueNotFound", 404)
}

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

	return nil
}