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

247 lines
7.4 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"
)
// RepoCreateKeyReader is a Reader for the RepoCreateKey structure.
type RepoCreateKeyReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RepoCreateKeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewRepoCreateKeyCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewRepoCreateKeyNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewRepoCreateKeyUnprocessableEntity()
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}/keys] repoCreateKey", response, response.Code())
}
}
// NewRepoCreateKeyCreated creates a RepoCreateKeyCreated with default headers values
func NewRepoCreateKeyCreated() *RepoCreateKeyCreated {
return &RepoCreateKeyCreated{}
}
/*
RepoCreateKeyCreated describes a response with status code 201, with default header values.
DeployKey
*/
type RepoCreateKeyCreated struct {
Payload *models.DeployKey
}
// IsSuccess returns true when this repo create key created response has a 2xx status code
func (o *RepoCreateKeyCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this repo create key created response has a 3xx status code
func (o *RepoCreateKeyCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create key created response has a 4xx status code
func (o *RepoCreateKeyCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this repo create key created response has a 5xx status code
func (o *RepoCreateKeyCreated) IsServerError() bool {
return false
}
// IsCode returns true when this repo create key created response a status code equal to that given
func (o *RepoCreateKeyCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the repo create key created response
func (o *RepoCreateKeyCreated) Code() int {
return 201
}
func (o *RepoCreateKeyCreated) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/keys][%d] repoCreateKeyCreated %s", 201, payload)
}
func (o *RepoCreateKeyCreated) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/keys][%d] repoCreateKeyCreated %s", 201, payload)
}
func (o *RepoCreateKeyCreated) GetPayload() *models.DeployKey {
return o.Payload
}
func (o *RepoCreateKeyCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.DeployKey)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewRepoCreateKeyNotFound creates a RepoCreateKeyNotFound with default headers values
func NewRepoCreateKeyNotFound() *RepoCreateKeyNotFound {
return &RepoCreateKeyNotFound{}
}
/*
RepoCreateKeyNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type RepoCreateKeyNotFound struct {
}
// IsSuccess returns true when this repo create key not found response has a 2xx status code
func (o *RepoCreateKeyNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create key not found response has a 3xx status code
func (o *RepoCreateKeyNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create key not found response has a 4xx status code
func (o *RepoCreateKeyNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create key not found response has a 5xx status code
func (o *RepoCreateKeyNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this repo create key not found response a status code equal to that given
func (o *RepoCreateKeyNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the repo create key not found response
func (o *RepoCreateKeyNotFound) Code() int {
return 404
}
func (o *RepoCreateKeyNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/keys][%d] repoCreateKeyNotFound", 404)
}
func (o *RepoCreateKeyNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/keys][%d] repoCreateKeyNotFound", 404)
}
func (o *RepoCreateKeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoCreateKeyUnprocessableEntity creates a RepoCreateKeyUnprocessableEntity with default headers values
func NewRepoCreateKeyUnprocessableEntity() *RepoCreateKeyUnprocessableEntity {
return &RepoCreateKeyUnprocessableEntity{}
}
/*
RepoCreateKeyUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type RepoCreateKeyUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this repo create key unprocessable entity response has a 2xx status code
func (o *RepoCreateKeyUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo create key unprocessable entity response has a 3xx status code
func (o *RepoCreateKeyUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo create key unprocessable entity response has a 4xx status code
func (o *RepoCreateKeyUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this repo create key unprocessable entity response has a 5xx status code
func (o *RepoCreateKeyUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this repo create key unprocessable entity response a status code equal to that given
func (o *RepoCreateKeyUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the repo create key unprocessable entity response
func (o *RepoCreateKeyUnprocessableEntity) Code() int {
return 422
}
func (o *RepoCreateKeyUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/keys][%d] repoCreateKeyUnprocessableEntity", 422)
}
func (o *RepoCreateKeyUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/keys][%d] repoCreateKeyUnprocessableEntity", 422)
}
func (o *RepoCreateKeyUnprocessableEntity) 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
}