autogits/bots-common/gitea-generated/client/repository/repo_create_branch_responses.go

371 lines
11 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// 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"
)
// RepoCreateBranchReader is a Reader for the RepoCreateBranch structure.
type RepoCreateBranchReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RepoCreateBranchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewRepoCreateBranchCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewRepoCreateBranchForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewRepoCreateBranchNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewRepoCreateBranchConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 423:
result := NewRepoCreateBranchLocked()
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}/branches] repoCreateBranch", response, response.Code())
}
}
// NewRepoCreateBranchCreated creates a RepoCreateBranchCreated with default headers values
func NewRepoCreateBranchCreated() *RepoCreateBranchCreated {
return &RepoCreateBranchCreated{}
}
/*
RepoCreateBranchCreated describes a response with status code 201, with default header values.
Branch
*/
type RepoCreateBranchCreated struct {
Payload *models.Branch
}
// IsSuccess returns true when this repo create branch created response has a 2xx status code
func (o *RepoCreateBranchCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this repo create branch created response has a 3xx status code
func (o *RepoCreateBranchCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create branch created response has a 4xx status code
func (o *RepoCreateBranchCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this repo create branch created response has a 5xx status code
func (o *RepoCreateBranchCreated) IsServerError() bool {
return false
}
// IsCode returns true when this repo create branch created response a status code equal to that given
func (o *RepoCreateBranchCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the repo create branch created response
func (o *RepoCreateBranchCreated) Code() int {
return 201
}
func (o *RepoCreateBranchCreated) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchCreated %s", 201, payload)
}
func (o *RepoCreateBranchCreated) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchCreated %s", 201, payload)
}
func (o *RepoCreateBranchCreated) GetPayload() *models.Branch {
return o.Payload
}
func (o *RepoCreateBranchCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Branch)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewRepoCreateBranchForbidden creates a RepoCreateBranchForbidden with default headers values
func NewRepoCreateBranchForbidden() *RepoCreateBranchForbidden {
return &RepoCreateBranchForbidden{}
}
/*
RepoCreateBranchForbidden describes a response with status code 403, with default header values.
The branch is archived or a mirror.
*/
type RepoCreateBranchForbidden struct {
}
// IsSuccess returns true when this repo create branch forbidden response has a 2xx status code
func (o *RepoCreateBranchForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create branch forbidden response has a 3xx status code
func (o *RepoCreateBranchForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create branch forbidden response has a 4xx status code
func (o *RepoCreateBranchForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create branch forbidden response has a 5xx status code
func (o *RepoCreateBranchForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this repo create branch forbidden response a status code equal to that given
func (o *RepoCreateBranchForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the repo create branch forbidden response
func (o *RepoCreateBranchForbidden) Code() int {
return 403
}
func (o *RepoCreateBranchForbidden) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchForbidden", 403)
}
func (o *RepoCreateBranchForbidden) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchForbidden", 403)
}
func (o *RepoCreateBranchForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoCreateBranchNotFound creates a RepoCreateBranchNotFound with default headers values
func NewRepoCreateBranchNotFound() *RepoCreateBranchNotFound {
return &RepoCreateBranchNotFound{}
}
/*
RepoCreateBranchNotFound describes a response with status code 404, with default header values.
The old branch does not exist.
*/
type RepoCreateBranchNotFound struct {
}
// IsSuccess returns true when this repo create branch not found response has a 2xx status code
func (o *RepoCreateBranchNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create branch not found response has a 3xx status code
func (o *RepoCreateBranchNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create branch not found response has a 4xx status code
func (o *RepoCreateBranchNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create branch not found response has a 5xx status code
func (o *RepoCreateBranchNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this repo create branch not found response a status code equal to that given
func (o *RepoCreateBranchNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the repo create branch not found response
func (o *RepoCreateBranchNotFound) Code() int {
return 404
}
func (o *RepoCreateBranchNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchNotFound", 404)
}
func (o *RepoCreateBranchNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchNotFound", 404)
}
func (o *RepoCreateBranchNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoCreateBranchConflict creates a RepoCreateBranchConflict with default headers values
func NewRepoCreateBranchConflict() *RepoCreateBranchConflict {
return &RepoCreateBranchConflict{}
}
/*
RepoCreateBranchConflict describes a response with status code 409, with default header values.
The branch with the same name already exists.
*/
type RepoCreateBranchConflict struct {
}
// IsSuccess returns true when this repo create branch conflict response has a 2xx status code
func (o *RepoCreateBranchConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create branch conflict response has a 3xx status code
func (o *RepoCreateBranchConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create branch conflict response has a 4xx status code
func (o *RepoCreateBranchConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create branch conflict response has a 5xx status code
func (o *RepoCreateBranchConflict) IsServerError() bool {
return false
}
// IsCode returns true when this repo create branch conflict response a status code equal to that given
func (o *RepoCreateBranchConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the repo create branch conflict response
func (o *RepoCreateBranchConflict) Code() int {
return 409
}
func (o *RepoCreateBranchConflict) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchConflict", 409)
}
func (o *RepoCreateBranchConflict) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchConflict", 409)
}
func (o *RepoCreateBranchConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoCreateBranchLocked creates a RepoCreateBranchLocked with default headers values
func NewRepoCreateBranchLocked() *RepoCreateBranchLocked {
return &RepoCreateBranchLocked{}
}
/*
RepoCreateBranchLocked 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 RepoCreateBranchLocked struct {
Message string
URL string
}
// IsSuccess returns true when this repo create branch locked response has a 2xx status code
func (o *RepoCreateBranchLocked) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create branch locked response has a 3xx status code
func (o *RepoCreateBranchLocked) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create branch locked response has a 4xx status code
func (o *RepoCreateBranchLocked) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create branch locked response has a 5xx status code
func (o *RepoCreateBranchLocked) IsServerError() bool {
return false
}
// IsCode returns true when this repo create branch locked response a status code equal to that given
func (o *RepoCreateBranchLocked) IsCode(code int) bool {
return code == 423
}
// Code gets the status code for the repo create branch locked response
func (o *RepoCreateBranchLocked) Code() int {
return 423
}
func (o *RepoCreateBranchLocked) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchLocked", 423)
}
func (o *RepoCreateBranchLocked) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/branches][%d] repoCreateBranchLocked", 423)
}
func (o *RepoCreateBranchLocked) 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
}