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

325 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 (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"src.opensuse.org/autogits/common/gitea-generated/models"
)
// RepoMigrateReader is a Reader for the RepoMigrate structure.
type RepoMigrateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RepoMigrateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewRepoMigrateCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewRepoMigrateForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewRepoMigrateConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewRepoMigrateUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /repos/migrate] repoMigrate", response, response.Code())
}
}
// NewRepoMigrateCreated creates a RepoMigrateCreated with default headers values
func NewRepoMigrateCreated() *RepoMigrateCreated {
return &RepoMigrateCreated{}
}
/*
RepoMigrateCreated describes a response with status code 201, with default header values.
Repository
*/
type RepoMigrateCreated struct {
Payload *models.Repository
}
// IsSuccess returns true when this repo migrate created response has a 2xx status code
func (o *RepoMigrateCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this repo migrate created response has a 3xx status code
func (o *RepoMigrateCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo migrate created response has a 4xx status code
func (o *RepoMigrateCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this repo migrate created response has a 5xx status code
func (o *RepoMigrateCreated) IsServerError() bool {
return false
}
// IsCode returns true when this repo migrate created response a status code equal to that given
func (o *RepoMigrateCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the repo migrate created response
func (o *RepoMigrateCreated) Code() int {
return 201
}
func (o *RepoMigrateCreated) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateCreated %s", 201, payload)
}
func (o *RepoMigrateCreated) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateCreated %s", 201, payload)
}
func (o *RepoMigrateCreated) GetPayload() *models.Repository {
return o.Payload
}
func (o *RepoMigrateCreated) 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
}
// NewRepoMigrateForbidden creates a RepoMigrateForbidden with default headers values
func NewRepoMigrateForbidden() *RepoMigrateForbidden {
return &RepoMigrateForbidden{}
}
/*
RepoMigrateForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type RepoMigrateForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this repo migrate forbidden response has a 2xx status code
func (o *RepoMigrateForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo migrate forbidden response has a 3xx status code
func (o *RepoMigrateForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo migrate forbidden response has a 4xx status code
func (o *RepoMigrateForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this repo migrate forbidden response has a 5xx status code
func (o *RepoMigrateForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this repo migrate forbidden response a status code equal to that given
func (o *RepoMigrateForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the repo migrate forbidden response
func (o *RepoMigrateForbidden) Code() int {
return 403
}
func (o *RepoMigrateForbidden) Error() string {
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateForbidden", 403)
}
func (o *RepoMigrateForbidden) String() string {
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateForbidden", 403)
}
func (o *RepoMigrateForbidden) 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
}
// NewRepoMigrateConflict creates a RepoMigrateConflict with default headers values
func NewRepoMigrateConflict() *RepoMigrateConflict {
return &RepoMigrateConflict{}
}
/*
RepoMigrateConflict describes a response with status code 409, with default header values.
The repository with the same name already exists.
*/
type RepoMigrateConflict struct {
}
// IsSuccess returns true when this repo migrate conflict response has a 2xx status code
func (o *RepoMigrateConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo migrate conflict response has a 3xx status code
func (o *RepoMigrateConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo migrate conflict response has a 4xx status code
func (o *RepoMigrateConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this repo migrate conflict response has a 5xx status code
func (o *RepoMigrateConflict) IsServerError() bool {
return false
}
// IsCode returns true when this repo migrate conflict response a status code equal to that given
func (o *RepoMigrateConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the repo migrate conflict response
func (o *RepoMigrateConflict) Code() int {
return 409
}
func (o *RepoMigrateConflict) Error() string {
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateConflict", 409)
}
func (o *RepoMigrateConflict) String() string {
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateConflict", 409)
}
func (o *RepoMigrateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoMigrateUnprocessableEntity creates a RepoMigrateUnprocessableEntity with default headers values
func NewRepoMigrateUnprocessableEntity() *RepoMigrateUnprocessableEntity {
return &RepoMigrateUnprocessableEntity{}
}
/*
RepoMigrateUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type RepoMigrateUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this repo migrate unprocessable entity response has a 2xx status code
func (o *RepoMigrateUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo migrate unprocessable entity response has a 3xx status code
func (o *RepoMigrateUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo migrate unprocessable entity response has a 4xx status code
func (o *RepoMigrateUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this repo migrate unprocessable entity response has a 5xx status code
func (o *RepoMigrateUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this repo migrate unprocessable entity response a status code equal to that given
func (o *RepoMigrateUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the repo migrate unprocessable entity response
func (o *RepoMigrateUnprocessableEntity) Code() int {
return 422
}
func (o *RepoMigrateUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateUnprocessableEntity", 422)
}
func (o *RepoMigrateUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /repos/migrate][%d] repoMigrateUnprocessableEntity", 422)
}
func (o *RepoMigrateUnprocessableEntity) 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
}