go-gitea/client/repository/create_fork_responses.go
jolheiser 021242f2ad
initial commit
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-04-11 22:59:19 -05:00

322 lines
9.2 KiB
Go

// 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"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"gitea.com/jolheiser/go-gitea/models"
)
// CreateForkReader is a Reader for the CreateFork structure.
type CreateForkReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateForkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 202:
result := NewCreateForkAccepted()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewCreateForkForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewCreateForkConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewCreateForkUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewCreateForkAccepted creates a CreateForkAccepted with default headers values
func NewCreateForkAccepted() *CreateForkAccepted {
return &CreateForkAccepted{}
}
/*
CreateForkAccepted describes a response with status code 202, with default header values.
Repository
*/
type CreateForkAccepted struct {
Payload *models.Repository
}
// IsSuccess returns true when this create fork accepted response has a 2xx status code
func (o *CreateForkAccepted) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create fork accepted response has a 3xx status code
func (o *CreateForkAccepted) IsRedirect() bool {
return false
}
// IsClientError returns true when this create fork accepted response has a 4xx status code
func (o *CreateForkAccepted) IsClientError() bool {
return false
}
// IsServerError returns true when this create fork accepted response has a 5xx status code
func (o *CreateForkAccepted) IsServerError() bool {
return false
}
// IsCode returns true when this create fork accepted response a status code equal to that given
func (o *CreateForkAccepted) IsCode(code int) bool {
return code == 202
}
// Code gets the status code for the create fork accepted response
func (o *CreateForkAccepted) Code() int {
return 202
}
func (o *CreateForkAccepted) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkAccepted %+v", 202, o.Payload)
}
func (o *CreateForkAccepted) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkAccepted %+v", 202, o.Payload)
}
func (o *CreateForkAccepted) GetPayload() *models.Repository {
return o.Payload
}
func (o *CreateForkAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Repository)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateForkForbidden creates a CreateForkForbidden with default headers values
func NewCreateForkForbidden() *CreateForkForbidden {
return &CreateForkForbidden{}
}
/*
CreateForkForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type CreateForkForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this create fork forbidden response has a 2xx status code
func (o *CreateForkForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create fork forbidden response has a 3xx status code
func (o *CreateForkForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this create fork forbidden response has a 4xx status code
func (o *CreateForkForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this create fork forbidden response has a 5xx status code
func (o *CreateForkForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this create fork forbidden response a status code equal to that given
func (o *CreateForkForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the create fork forbidden response
func (o *CreateForkForbidden) Code() int {
return 403
}
func (o *CreateForkForbidden) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkForbidden ", 403)
}
func (o *CreateForkForbidden) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkForbidden ", 403)
}
func (o *CreateForkForbidden) 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
}
// NewCreateForkConflict creates a CreateForkConflict with default headers values
func NewCreateForkConflict() *CreateForkConflict {
return &CreateForkConflict{}
}
/*
CreateForkConflict describes a response with status code 409, with default header values.
The repository with the same name already exists.
*/
type CreateForkConflict struct {
}
// IsSuccess returns true when this create fork conflict response has a 2xx status code
func (o *CreateForkConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create fork conflict response has a 3xx status code
func (o *CreateForkConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this create fork conflict response has a 4xx status code
func (o *CreateForkConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this create fork conflict response has a 5xx status code
func (o *CreateForkConflict) IsServerError() bool {
return false
}
// IsCode returns true when this create fork conflict response a status code equal to that given
func (o *CreateForkConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the create fork conflict response
func (o *CreateForkConflict) Code() int {
return 409
}
func (o *CreateForkConflict) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkConflict ", 409)
}
func (o *CreateForkConflict) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkConflict ", 409)
}
func (o *CreateForkConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewCreateForkUnprocessableEntity creates a CreateForkUnprocessableEntity with default headers values
func NewCreateForkUnprocessableEntity() *CreateForkUnprocessableEntity {
return &CreateForkUnprocessableEntity{}
}
/*
CreateForkUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type CreateForkUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this create fork unprocessable entity response has a 2xx status code
func (o *CreateForkUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create fork unprocessable entity response has a 3xx status code
func (o *CreateForkUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this create fork unprocessable entity response has a 4xx status code
func (o *CreateForkUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this create fork unprocessable entity response has a 5xx status code
func (o *CreateForkUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this create fork unprocessable entity response a status code equal to that given
func (o *CreateForkUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the create fork unprocessable entity response
func (o *CreateForkUnprocessableEntity) Code() int {
return 422
}
func (o *CreateForkUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkUnprocessableEntity ", 422)
}
func (o *CreateForkUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkUnprocessableEntity ", 422)
}
func (o *CreateForkUnprocessableEntity) 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
}