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

// RepoAddCollaboratorReader is a Reader for the RepoAddCollaborator structure.
type RepoAddCollaboratorReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoAddCollaboratorReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 204:
		result := NewRepoAddCollaboratorNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewRepoAddCollaboratorForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRepoAddCollaboratorNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewRepoAddCollaboratorUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}] repoAddCollaborator", response, response.Code())
	}
}

// NewRepoAddCollaboratorNoContent creates a RepoAddCollaboratorNoContent with default headers values
func NewRepoAddCollaboratorNoContent() *RepoAddCollaboratorNoContent {
	return &RepoAddCollaboratorNoContent{}
}

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

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

// IsSuccess returns true when this repo add collaborator no content response has a 2xx status code
func (o *RepoAddCollaboratorNoContent) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this repo add collaborator no content response has a 3xx status code
func (o *RepoAddCollaboratorNoContent) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo add collaborator no content response has a 4xx status code
func (o *RepoAddCollaboratorNoContent) IsClientError() bool {
	return false
}

// IsServerError returns true when this repo add collaborator no content response has a 5xx status code
func (o *RepoAddCollaboratorNoContent) IsServerError() bool {
	return false
}

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

// Code gets the status code for the repo add collaborator no content response
func (o *RepoAddCollaboratorNoContent) Code() int {
	return 204
}

func (o *RepoAddCollaboratorNoContent) Error() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorNoContent", 204)
}

func (o *RepoAddCollaboratorNoContent) String() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorNoContent", 204)
}

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

	return nil
}

// NewRepoAddCollaboratorForbidden creates a RepoAddCollaboratorForbidden with default headers values
func NewRepoAddCollaboratorForbidden() *RepoAddCollaboratorForbidden {
	return &RepoAddCollaboratorForbidden{}
}

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

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

// IsSuccess returns true when this repo add collaborator forbidden response has a 2xx status code
func (o *RepoAddCollaboratorForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo add collaborator forbidden response has a 3xx status code
func (o *RepoAddCollaboratorForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo add collaborator forbidden response has a 4xx status code
func (o *RepoAddCollaboratorForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo add collaborator forbidden response has a 5xx status code
func (o *RepoAddCollaboratorForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this repo add collaborator forbidden response a status code equal to that given
func (o *RepoAddCollaboratorForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the repo add collaborator forbidden response
func (o *RepoAddCollaboratorForbidden) Code() int {
	return 403
}

func (o *RepoAddCollaboratorForbidden) Error() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorForbidden", 403)
}

func (o *RepoAddCollaboratorForbidden) String() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorForbidden", 403)
}

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

// NewRepoAddCollaboratorNotFound creates a RepoAddCollaboratorNotFound with default headers values
func NewRepoAddCollaboratorNotFound() *RepoAddCollaboratorNotFound {
	return &RepoAddCollaboratorNotFound{}
}

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

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

// IsSuccess returns true when this repo add collaborator not found response has a 2xx status code
func (o *RepoAddCollaboratorNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo add collaborator not found response has a 3xx status code
func (o *RepoAddCollaboratorNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo add collaborator not found response has a 4xx status code
func (o *RepoAddCollaboratorNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo add collaborator not found response has a 5xx status code
func (o *RepoAddCollaboratorNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the repo add collaborator not found response
func (o *RepoAddCollaboratorNotFound) Code() int {
	return 404
}

func (o *RepoAddCollaboratorNotFound) Error() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorNotFound", 404)
}

func (o *RepoAddCollaboratorNotFound) String() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorNotFound", 404)
}

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

	return nil
}

// NewRepoAddCollaboratorUnprocessableEntity creates a RepoAddCollaboratorUnprocessableEntity with default headers values
func NewRepoAddCollaboratorUnprocessableEntity() *RepoAddCollaboratorUnprocessableEntity {
	return &RepoAddCollaboratorUnprocessableEntity{}
}

/*
RepoAddCollaboratorUnprocessableEntity describes a response with status code 422, with default header values.

APIValidationError is error format response related to input validation
*/
type RepoAddCollaboratorUnprocessableEntity struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo add collaborator unprocessable entity response has a 2xx status code
func (o *RepoAddCollaboratorUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo add collaborator unprocessable entity response has a 3xx status code
func (o *RepoAddCollaboratorUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo add collaborator unprocessable entity response has a 4xx status code
func (o *RepoAddCollaboratorUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo add collaborator unprocessable entity response has a 5xx status code
func (o *RepoAddCollaboratorUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this repo add collaborator unprocessable entity response a status code equal to that given
func (o *RepoAddCollaboratorUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the repo add collaborator unprocessable entity response
func (o *RepoAddCollaboratorUnprocessableEntity) Code() int {
	return 422
}

func (o *RepoAddCollaboratorUnprocessableEntity) Error() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorUnprocessableEntity", 422)
}

func (o *RepoAddCollaboratorUnprocessableEntity) String() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/collaborators/{collaborator}][%d] repoAddCollaboratorUnprocessableEntity", 422)
}

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