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

package repository

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

import (
	"encoding/json"
	"fmt"
	"io"

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

// RepoDownloadCommitDiffOrPatchReader is a Reader for the RepoDownloadCommitDiffOrPatch structure.
type RepoDownloadCommitDiffOrPatchReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoDownloadCommitDiffOrPatchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewRepoDownloadCommitDiffOrPatchOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewRepoDownloadCommitDiffOrPatchNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /repos/{owner}/{repo}/git/commits/{sha}.{diffType}] repoDownloadCommitDiffOrPatch", response, response.Code())
	}
}

// NewRepoDownloadCommitDiffOrPatchOK creates a RepoDownloadCommitDiffOrPatchOK with default headers values
func NewRepoDownloadCommitDiffOrPatchOK() *RepoDownloadCommitDiffOrPatchOK {
	return &RepoDownloadCommitDiffOrPatchOK{}
}

/*
RepoDownloadCommitDiffOrPatchOK describes a response with status code 200, with default header values.

APIString is a string response
*/
type RepoDownloadCommitDiffOrPatchOK struct {
	Payload string
}

// IsSuccess returns true when this repo download commit diff or patch o k response has a 2xx status code
func (o *RepoDownloadCommitDiffOrPatchOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this repo download commit diff or patch o k response has a 3xx status code
func (o *RepoDownloadCommitDiffOrPatchOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo download commit diff or patch o k response has a 4xx status code
func (o *RepoDownloadCommitDiffOrPatchOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this repo download commit diff or patch o k response has a 5xx status code
func (o *RepoDownloadCommitDiffOrPatchOK) IsServerError() bool {
	return false
}

// IsCode returns true when this repo download commit diff or patch o k response a status code equal to that given
func (o *RepoDownloadCommitDiffOrPatchOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the repo download commit diff or patch o k response
func (o *RepoDownloadCommitDiffOrPatchOK) Code() int {
	return 200
}

func (o *RepoDownloadCommitDiffOrPatchOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/git/commits/{sha}.{diffType}][%d] repoDownloadCommitDiffOrPatchOK %s", 200, payload)
}

func (o *RepoDownloadCommitDiffOrPatchOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/git/commits/{sha}.{diffType}][%d] repoDownloadCommitDiffOrPatchOK %s", 200, payload)
}

func (o *RepoDownloadCommitDiffOrPatchOK) GetPayload() string {
	return o.Payload
}

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

// NewRepoDownloadCommitDiffOrPatchNotFound creates a RepoDownloadCommitDiffOrPatchNotFound with default headers values
func NewRepoDownloadCommitDiffOrPatchNotFound() *RepoDownloadCommitDiffOrPatchNotFound {
	return &RepoDownloadCommitDiffOrPatchNotFound{}
}

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

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

// IsSuccess returns true when this repo download commit diff or patch not found response has a 2xx status code
func (o *RepoDownloadCommitDiffOrPatchNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo download commit diff or patch not found response has a 3xx status code
func (o *RepoDownloadCommitDiffOrPatchNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo download commit diff or patch not found response has a 4xx status code
func (o *RepoDownloadCommitDiffOrPatchNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo download commit diff or patch not found response has a 5xx status code
func (o *RepoDownloadCommitDiffOrPatchNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this repo download commit diff or patch not found response a status code equal to that given
func (o *RepoDownloadCommitDiffOrPatchNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the repo download commit diff or patch not found response
func (o *RepoDownloadCommitDiffOrPatchNotFound) Code() int {
	return 404
}

func (o *RepoDownloadCommitDiffOrPatchNotFound) Error() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/git/commits/{sha}.{diffType}][%d] repoDownloadCommitDiffOrPatchNotFound", 404)
}

func (o *RepoDownloadCommitDiffOrPatchNotFound) String() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/git/commits/{sha}.{diffType}][%d] repoDownloadCommitDiffOrPatchNotFound", 404)
}

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

	return nil
}
