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

	"src.opensuse.org/autogits/common/gitea-generated/models"
)

// RepoCreateWikiPageReader is a Reader for the RepoCreateWikiPage structure.
type RepoCreateWikiPageReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoCreateWikiPageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewRepoCreateWikiPageCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewRepoCreateWikiPageBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewRepoCreateWikiPageForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRepoCreateWikiPageNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 423:
		result := NewRepoCreateWikiPageLocked()
		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}/wiki/new] repoCreateWikiPage", response, response.Code())
	}
}

// NewRepoCreateWikiPageCreated creates a RepoCreateWikiPageCreated with default headers values
func NewRepoCreateWikiPageCreated() *RepoCreateWikiPageCreated {
	return &RepoCreateWikiPageCreated{}
}

/*
RepoCreateWikiPageCreated describes a response with status code 201, with default header values.

WikiPage
*/
type RepoCreateWikiPageCreated struct {
	Payload *models.WikiPage
}

// IsSuccess returns true when this repo create wiki page created response has a 2xx status code
func (o *RepoCreateWikiPageCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this repo create wiki page created response has a 3xx status code
func (o *RepoCreateWikiPageCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo create wiki page created response has a 4xx status code
func (o *RepoCreateWikiPageCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this repo create wiki page created response has a 5xx status code
func (o *RepoCreateWikiPageCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this repo create wiki page created response a status code equal to that given
func (o *RepoCreateWikiPageCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the repo create wiki page created response
func (o *RepoCreateWikiPageCreated) Code() int {
	return 201
}

func (o *RepoCreateWikiPageCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageCreated %s", 201, payload)
}

func (o *RepoCreateWikiPageCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageCreated %s", 201, payload)
}

func (o *RepoCreateWikiPageCreated) GetPayload() *models.WikiPage {
	return o.Payload
}

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

	o.Payload = new(models.WikiPage)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewRepoCreateWikiPageBadRequest creates a RepoCreateWikiPageBadRequest with default headers values
func NewRepoCreateWikiPageBadRequest() *RepoCreateWikiPageBadRequest {
	return &RepoCreateWikiPageBadRequest{}
}

/*
RepoCreateWikiPageBadRequest describes a response with status code 400, with default header values.

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

// IsSuccess returns true when this repo create wiki page bad request response has a 2xx status code
func (o *RepoCreateWikiPageBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo create wiki page bad request response has a 3xx status code
func (o *RepoCreateWikiPageBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo create wiki page bad request response has a 4xx status code
func (o *RepoCreateWikiPageBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo create wiki page bad request response has a 5xx status code
func (o *RepoCreateWikiPageBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this repo create wiki page bad request response a status code equal to that given
func (o *RepoCreateWikiPageBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the repo create wiki page bad request response
func (o *RepoCreateWikiPageBadRequest) Code() int {
	return 400
}

func (o *RepoCreateWikiPageBadRequest) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageBadRequest", 400)
}

func (o *RepoCreateWikiPageBadRequest) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageBadRequest", 400)
}

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

// NewRepoCreateWikiPageForbidden creates a RepoCreateWikiPageForbidden with default headers values
func NewRepoCreateWikiPageForbidden() *RepoCreateWikiPageForbidden {
	return &RepoCreateWikiPageForbidden{}
}

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

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

// IsSuccess returns true when this repo create wiki page forbidden response has a 2xx status code
func (o *RepoCreateWikiPageForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo create wiki page forbidden response has a 3xx status code
func (o *RepoCreateWikiPageForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo create wiki page forbidden response has a 4xx status code
func (o *RepoCreateWikiPageForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo create wiki page forbidden response has a 5xx status code
func (o *RepoCreateWikiPageForbidden) IsServerError() bool {
	return false
}

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

// Code gets the status code for the repo create wiki page forbidden response
func (o *RepoCreateWikiPageForbidden) Code() int {
	return 403
}

func (o *RepoCreateWikiPageForbidden) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageForbidden", 403)
}

func (o *RepoCreateWikiPageForbidden) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageForbidden", 403)
}

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

// NewRepoCreateWikiPageNotFound creates a RepoCreateWikiPageNotFound with default headers values
func NewRepoCreateWikiPageNotFound() *RepoCreateWikiPageNotFound {
	return &RepoCreateWikiPageNotFound{}
}

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

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

// IsSuccess returns true when this repo create wiki page not found response has a 2xx status code
func (o *RepoCreateWikiPageNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo create wiki page not found response has a 3xx status code
func (o *RepoCreateWikiPageNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo create wiki page not found response has a 4xx status code
func (o *RepoCreateWikiPageNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo create wiki page not found response has a 5xx status code
func (o *RepoCreateWikiPageNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the repo create wiki page not found response
func (o *RepoCreateWikiPageNotFound) Code() int {
	return 404
}

func (o *RepoCreateWikiPageNotFound) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageNotFound", 404)
}

func (o *RepoCreateWikiPageNotFound) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageNotFound", 404)
}

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

	return nil
}

// NewRepoCreateWikiPageLocked creates a RepoCreateWikiPageLocked with default headers values
func NewRepoCreateWikiPageLocked() *RepoCreateWikiPageLocked {
	return &RepoCreateWikiPageLocked{}
}

/*
RepoCreateWikiPageLocked 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 RepoCreateWikiPageLocked struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo create wiki page locked response has a 2xx status code
func (o *RepoCreateWikiPageLocked) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo create wiki page locked response has a 3xx status code
func (o *RepoCreateWikiPageLocked) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo create wiki page locked response has a 4xx status code
func (o *RepoCreateWikiPageLocked) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo create wiki page locked response has a 5xx status code
func (o *RepoCreateWikiPageLocked) IsServerError() bool {
	return false
}

// IsCode returns true when this repo create wiki page locked response a status code equal to that given
func (o *RepoCreateWikiPageLocked) IsCode(code int) bool {
	return code == 423
}

// Code gets the status code for the repo create wiki page locked response
func (o *RepoCreateWikiPageLocked) Code() int {
	return 423
}

func (o *RepoCreateWikiPageLocked) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageLocked", 423)
}

func (o *RepoCreateWikiPageLocked) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/wiki/new][%d] repoCreateWikiPageLocked", 423)
}

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