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

// UnpinIssueReader is a Reader for the UnpinIssue structure.
type UnpinIssueReader struct {
	formats strfmt.Registry
}

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

// NewUnpinIssueNoContent creates a UnpinIssueNoContent with default headers values
func NewUnpinIssueNoContent() *UnpinIssueNoContent {
	return &UnpinIssueNoContent{}
}

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

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

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

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

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

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

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

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

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

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

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

	return nil
}

// NewUnpinIssueForbidden creates a UnpinIssueForbidden with default headers values
func NewUnpinIssueForbidden() *UnpinIssueForbidden {
	return &UnpinIssueForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUnpinIssueNotFound creates a UnpinIssueNotFound with default headers values
func NewUnpinIssueNotFound() *UnpinIssueNotFound {
	return &UnpinIssueNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

	return nil
}
