autogits/bots-common/gitea-generated/client/repository/accept_repo_transfer_responses.go
Adam Majer 598ecbbd5a .
2024-07-07 21:12:40 +02:00

247 lines
7.6 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 (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"src.opensuse.org/autogits/common/gitea-generated/models"
)
// AcceptRepoTransferReader is a Reader for the AcceptRepoTransfer structure.
type AcceptRepoTransferReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *AcceptRepoTransferReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 202:
result := NewAcceptRepoTransferAccepted()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewAcceptRepoTransferForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewAcceptRepoTransferNotFound()
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}/transfer/accept] acceptRepoTransfer", response, response.Code())
}
}
// NewAcceptRepoTransferAccepted creates a AcceptRepoTransferAccepted with default headers values
func NewAcceptRepoTransferAccepted() *AcceptRepoTransferAccepted {
return &AcceptRepoTransferAccepted{}
}
/*
AcceptRepoTransferAccepted describes a response with status code 202, with default header values.
Repository
*/
type AcceptRepoTransferAccepted struct {
Payload *models.Repository
}
// IsSuccess returns true when this accept repo transfer accepted response has a 2xx status code
func (o *AcceptRepoTransferAccepted) IsSuccess() bool {
return true
}
// IsRedirect returns true when this accept repo transfer accepted response has a 3xx status code
func (o *AcceptRepoTransferAccepted) IsRedirect() bool {
return false
}
// IsClientError returns true when this accept repo transfer accepted response has a 4xx status code
func (o *AcceptRepoTransferAccepted) IsClientError() bool {
return false
}
// IsServerError returns true when this accept repo transfer accepted response has a 5xx status code
func (o *AcceptRepoTransferAccepted) IsServerError() bool {
return false
}
// IsCode returns true when this accept repo transfer accepted response a status code equal to that given
func (o *AcceptRepoTransferAccepted) IsCode(code int) bool {
return code == 202
}
// Code gets the status code for the accept repo transfer accepted response
func (o *AcceptRepoTransferAccepted) Code() int {
return 202
}
func (o *AcceptRepoTransferAccepted) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer/accept][%d] acceptRepoTransferAccepted %s", 202, payload)
}
func (o *AcceptRepoTransferAccepted) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer/accept][%d] acceptRepoTransferAccepted %s", 202, payload)
}
func (o *AcceptRepoTransferAccepted) GetPayload() *models.Repository {
return o.Payload
}
func (o *AcceptRepoTransferAccepted) 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
}
// NewAcceptRepoTransferForbidden creates a AcceptRepoTransferForbidden with default headers values
func NewAcceptRepoTransferForbidden() *AcceptRepoTransferForbidden {
return &AcceptRepoTransferForbidden{}
}
/*
AcceptRepoTransferForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type AcceptRepoTransferForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this accept repo transfer forbidden response has a 2xx status code
func (o *AcceptRepoTransferForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this accept repo transfer forbidden response has a 3xx status code
func (o *AcceptRepoTransferForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this accept repo transfer forbidden response has a 4xx status code
func (o *AcceptRepoTransferForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this accept repo transfer forbidden response has a 5xx status code
func (o *AcceptRepoTransferForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this accept repo transfer forbidden response a status code equal to that given
func (o *AcceptRepoTransferForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the accept repo transfer forbidden response
func (o *AcceptRepoTransferForbidden) Code() int {
return 403
}
func (o *AcceptRepoTransferForbidden) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer/accept][%d] acceptRepoTransferForbidden", 403)
}
func (o *AcceptRepoTransferForbidden) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer/accept][%d] acceptRepoTransferForbidden", 403)
}
func (o *AcceptRepoTransferForbidden) 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
}
// NewAcceptRepoTransferNotFound creates a AcceptRepoTransferNotFound with default headers values
func NewAcceptRepoTransferNotFound() *AcceptRepoTransferNotFound {
return &AcceptRepoTransferNotFound{}
}
/*
AcceptRepoTransferNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type AcceptRepoTransferNotFound struct {
}
// IsSuccess returns true when this accept repo transfer not found response has a 2xx status code
func (o *AcceptRepoTransferNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this accept repo transfer not found response has a 3xx status code
func (o *AcceptRepoTransferNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this accept repo transfer not found response has a 4xx status code
func (o *AcceptRepoTransferNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this accept repo transfer not found response has a 5xx status code
func (o *AcceptRepoTransferNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this accept repo transfer not found response a status code equal to that given
func (o *AcceptRepoTransferNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the accept repo transfer not found response
func (o *AcceptRepoTransferNotFound) Code() int {
return 404
}
func (o *AcceptRepoTransferNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer/accept][%d] acceptRepoTransferNotFound", 404)
}
func (o *AcceptRepoTransferNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer/accept][%d] acceptRepoTransferNotFound", 404)
}
func (o *AcceptRepoTransferNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}