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

325 lines
10 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"
)
// RepoCreateReleaseReader is a Reader for the RepoCreateRelease structure.
type RepoCreateReleaseReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RepoCreateReleaseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewRepoCreateReleaseCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewRepoCreateReleaseNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewRepoCreateReleaseConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewRepoCreateReleaseUnprocessableEntity()
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}/releases] repoCreateRelease", response, response.Code())
}
}
// NewRepoCreateReleaseCreated creates a RepoCreateReleaseCreated with default headers values
func NewRepoCreateReleaseCreated() *RepoCreateReleaseCreated {
return &RepoCreateReleaseCreated{}
}
/*
RepoCreateReleaseCreated describes a response with status code 201, with default header values.
Release
*/
type RepoCreateReleaseCreated struct {
Payload *models.Release
}
// IsSuccess returns true when this repo create release created response has a 2xx status code
func (o *RepoCreateReleaseCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this repo create release created response has a 3xx status code
func (o *RepoCreateReleaseCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create release created response has a 4xx status code
func (o *RepoCreateReleaseCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this repo create release created response has a 5xx status code
func (o *RepoCreateReleaseCreated) IsServerError() bool {
return false
}
// IsCode returns true when this repo create release created response a status code equal to that given
func (o *RepoCreateReleaseCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the repo create release created response
func (o *RepoCreateReleaseCreated) Code() int {
return 201
}
func (o *RepoCreateReleaseCreated) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseCreated %s", 201, payload)
}
func (o *RepoCreateReleaseCreated) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseCreated %s", 201, payload)
}
func (o *RepoCreateReleaseCreated) GetPayload() *models.Release {
return o.Payload
}
func (o *RepoCreateReleaseCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Release)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewRepoCreateReleaseNotFound creates a RepoCreateReleaseNotFound with default headers values
func NewRepoCreateReleaseNotFound() *RepoCreateReleaseNotFound {
return &RepoCreateReleaseNotFound{}
}
/*
RepoCreateReleaseNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type RepoCreateReleaseNotFound struct {
}
// IsSuccess returns true when this repo create release not found response has a 2xx status code
func (o *RepoCreateReleaseNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create release not found response has a 3xx status code
func (o *RepoCreateReleaseNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create release not found response has a 4xx status code
func (o *RepoCreateReleaseNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create release not found response has a 5xx status code
func (o *RepoCreateReleaseNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this repo create release not found response a status code equal to that given
func (o *RepoCreateReleaseNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the repo create release not found response
func (o *RepoCreateReleaseNotFound) Code() int {
return 404
}
func (o *RepoCreateReleaseNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseNotFound", 404)
}
func (o *RepoCreateReleaseNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseNotFound", 404)
}
func (o *RepoCreateReleaseNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoCreateReleaseConflict creates a RepoCreateReleaseConflict with default headers values
func NewRepoCreateReleaseConflict() *RepoCreateReleaseConflict {
return &RepoCreateReleaseConflict{}
}
/*
RepoCreateReleaseConflict describes a response with status code 409, with default header values.
APIError is error format response
*/
type RepoCreateReleaseConflict struct {
Message string
URL string
}
// IsSuccess returns true when this repo create release conflict response has a 2xx status code
func (o *RepoCreateReleaseConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create release conflict response has a 3xx status code
func (o *RepoCreateReleaseConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create release conflict response has a 4xx status code
func (o *RepoCreateReleaseConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create release conflict response has a 5xx status code
func (o *RepoCreateReleaseConflict) IsServerError() bool {
return false
}
// IsCode returns true when this repo create release conflict response a status code equal to that given
func (o *RepoCreateReleaseConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the repo create release conflict response
func (o *RepoCreateReleaseConflict) Code() int {
return 409
}
func (o *RepoCreateReleaseConflict) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseConflict", 409)
}
func (o *RepoCreateReleaseConflict) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseConflict", 409)
}
func (o *RepoCreateReleaseConflict) 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
}
// NewRepoCreateReleaseUnprocessableEntity creates a RepoCreateReleaseUnprocessableEntity with default headers values
func NewRepoCreateReleaseUnprocessableEntity() *RepoCreateReleaseUnprocessableEntity {
return &RepoCreateReleaseUnprocessableEntity{}
}
/*
RepoCreateReleaseUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type RepoCreateReleaseUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this repo create release unprocessable entity response has a 2xx status code
func (o *RepoCreateReleaseUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create release unprocessable entity response has a 3xx status code
func (o *RepoCreateReleaseUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create release unprocessable entity response has a 4xx status code
func (o *RepoCreateReleaseUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create release unprocessable entity response has a 5xx status code
func (o *RepoCreateReleaseUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this repo create release unprocessable entity response a status code equal to that given
func (o *RepoCreateReleaseUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the repo create release unprocessable entity response
func (o *RepoCreateReleaseUnprocessableEntity) Code() int {
return 422
}
func (o *RepoCreateReleaseUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseUnprocessableEntity", 422)
}
func (o *RepoCreateReleaseUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/releases][%d] repoCreateReleaseUnprocessableEntity", 422)
}
func (o *RepoCreateReleaseUnprocessableEntity) 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
}