// 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 (
	"fmt"

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

// RepoMergePullRequestReader is a Reader for the RepoMergePullRequest structure.
type RepoMergePullRequestReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoMergePullRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewRepoMergePullRequestOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewRepoMergePullRequestNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 405:
		result := NewRepoMergePullRequestMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewRepoMergePullRequestConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 423:
		result := NewRepoMergePullRequestLocked()
		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}/pulls/{index}/merge] repoMergePullRequest", response, response.Code())
	}
}

// NewRepoMergePullRequestOK creates a RepoMergePullRequestOK with default headers values
func NewRepoMergePullRequestOK() *RepoMergePullRequestOK {
	return &RepoMergePullRequestOK{}
}

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

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

// IsSuccess returns true when this repo merge pull request o k response has a 2xx status code
func (o *RepoMergePullRequestOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this repo merge pull request o k response has a 3xx status code
func (o *RepoMergePullRequestOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo merge pull request o k response has a 4xx status code
func (o *RepoMergePullRequestOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this repo merge pull request o k response has a 5xx status code
func (o *RepoMergePullRequestOK) IsServerError() bool {
	return false
}

// IsCode returns true when this repo merge pull request o k response a status code equal to that given
func (o *RepoMergePullRequestOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the repo merge pull request o k response
func (o *RepoMergePullRequestOK) Code() int {
	return 200
}

func (o *RepoMergePullRequestOK) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestOK", 200)
}

func (o *RepoMergePullRequestOK) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestOK", 200)
}

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

	return nil
}

// NewRepoMergePullRequestNotFound creates a RepoMergePullRequestNotFound with default headers values
func NewRepoMergePullRequestNotFound() *RepoMergePullRequestNotFound {
	return &RepoMergePullRequestNotFound{}
}

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

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

// IsSuccess returns true when this repo merge pull request not found response has a 2xx status code
func (o *RepoMergePullRequestNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo merge pull request not found response has a 3xx status code
func (o *RepoMergePullRequestNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo merge pull request not found response has a 4xx status code
func (o *RepoMergePullRequestNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo merge pull request not found response has a 5xx status code
func (o *RepoMergePullRequestNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this repo merge pull request not found response a status code equal to that given
func (o *RepoMergePullRequestNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the repo merge pull request not found response
func (o *RepoMergePullRequestNotFound) Code() int {
	return 404
}

func (o *RepoMergePullRequestNotFound) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestNotFound", 404)
}

func (o *RepoMergePullRequestNotFound) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestNotFound", 404)
}

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

	return nil
}

// NewRepoMergePullRequestMethodNotAllowed creates a RepoMergePullRequestMethodNotAllowed with default headers values
func NewRepoMergePullRequestMethodNotAllowed() *RepoMergePullRequestMethodNotAllowed {
	return &RepoMergePullRequestMethodNotAllowed{}
}

/*
RepoMergePullRequestMethodNotAllowed describes a response with status code 405, with default header values.

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

// IsSuccess returns true when this repo merge pull request method not allowed response has a 2xx status code
func (o *RepoMergePullRequestMethodNotAllowed) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo merge pull request method not allowed response has a 3xx status code
func (o *RepoMergePullRequestMethodNotAllowed) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo merge pull request method not allowed response has a 4xx status code
func (o *RepoMergePullRequestMethodNotAllowed) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo merge pull request method not allowed response has a 5xx status code
func (o *RepoMergePullRequestMethodNotAllowed) IsServerError() bool {
	return false
}

// IsCode returns true when this repo merge pull request method not allowed response a status code equal to that given
func (o *RepoMergePullRequestMethodNotAllowed) IsCode(code int) bool {
	return code == 405
}

// Code gets the status code for the repo merge pull request method not allowed response
func (o *RepoMergePullRequestMethodNotAllowed) Code() int {
	return 405
}

func (o *RepoMergePullRequestMethodNotAllowed) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestMethodNotAllowed", 405)
}

func (o *RepoMergePullRequestMethodNotAllowed) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestMethodNotAllowed", 405)
}

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

	return nil
}

// NewRepoMergePullRequestConflict creates a RepoMergePullRequestConflict with default headers values
func NewRepoMergePullRequestConflict() *RepoMergePullRequestConflict {
	return &RepoMergePullRequestConflict{}
}

/*
RepoMergePullRequestConflict describes a response with status code 409, with default header values.

APIError is error format response
*/
type RepoMergePullRequestConflict struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo merge pull request conflict response has a 2xx status code
func (o *RepoMergePullRequestConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo merge pull request conflict response has a 3xx status code
func (o *RepoMergePullRequestConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo merge pull request conflict response has a 4xx status code
func (o *RepoMergePullRequestConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo merge pull request conflict response has a 5xx status code
func (o *RepoMergePullRequestConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this repo merge pull request conflict response a status code equal to that given
func (o *RepoMergePullRequestConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the repo merge pull request conflict response
func (o *RepoMergePullRequestConflict) Code() int {
	return 409
}

func (o *RepoMergePullRequestConflict) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestConflict", 409)
}

func (o *RepoMergePullRequestConflict) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestConflict", 409)
}

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

// NewRepoMergePullRequestLocked creates a RepoMergePullRequestLocked with default headers values
func NewRepoMergePullRequestLocked() *RepoMergePullRequestLocked {
	return &RepoMergePullRequestLocked{}
}

/*
RepoMergePullRequestLocked describes a response with status code 423, with default header values.

APIRepoArchivedError is an error that is raised when an archived repo should be modified
*/
type RepoMergePullRequestLocked struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo merge pull request locked response has a 2xx status code
func (o *RepoMergePullRequestLocked) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo merge pull request locked response has a 3xx status code
func (o *RepoMergePullRequestLocked) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo merge pull request locked response has a 4xx status code
func (o *RepoMergePullRequestLocked) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo merge pull request locked response has a 5xx status code
func (o *RepoMergePullRequestLocked) IsServerError() bool {
	return false
}

// IsCode returns true when this repo merge pull request locked response a status code equal to that given
func (o *RepoMergePullRequestLocked) IsCode(code int) bool {
	return code == 423
}

// Code gets the status code for the repo merge pull request locked response
func (o *RepoMergePullRequestLocked) Code() int {
	return 423
}

func (o *RepoMergePullRequestLocked) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestLocked", 423)
}

func (o *RepoMergePullRequestLocked) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/pulls/{index}/merge][%d] repoMergePullRequestLocked", 423)
}

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