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

169 lines
4.7 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"
)
// RepoGetKeyReader is a Reader for the RepoGetKey structure.
type RepoGetKeyReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RepoGetKeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRepoGetKeyOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewRepoGetKeyNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /repos/{owner}/{repo}/keys/{id}] repoGetKey", response, response.Code())
}
}
// NewRepoGetKeyOK creates a RepoGetKeyOK with default headers values
func NewRepoGetKeyOK() *RepoGetKeyOK {
return &RepoGetKeyOK{}
}
/*
RepoGetKeyOK describes a response with status code 200, with default header values.
DeployKey
*/
type RepoGetKeyOK struct {
Payload *models.DeployKey
}
// IsSuccess returns true when this repo get key o k response has a 2xx status code
func (o *RepoGetKeyOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this repo get key o k response has a 3xx status code
func (o *RepoGetKeyOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo get key o k response has a 4xx status code
func (o *RepoGetKeyOK) IsClientError() bool {
return false
}
// IsServerError returns true when this repo get key o k response has a 5xx status code
func (o *RepoGetKeyOK) IsServerError() bool {
return false
}
// IsCode returns true when this repo get key o k response a status code equal to that given
func (o *RepoGetKeyOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the repo get key o k response
func (o *RepoGetKeyOK) Code() int {
return 200
}
func (o *RepoGetKeyOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repos/{owner}/{repo}/keys/{id}][%d] repoGetKeyOK %s", 200, payload)
}
func (o *RepoGetKeyOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repos/{owner}/{repo}/keys/{id}][%d] repoGetKeyOK %s", 200, payload)
}
func (o *RepoGetKeyOK) GetPayload() *models.DeployKey {
return o.Payload
}
func (o *RepoGetKeyOK) 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
}
// NewRepoGetKeyNotFound creates a RepoGetKeyNotFound with default headers values
func NewRepoGetKeyNotFound() *RepoGetKeyNotFound {
return &RepoGetKeyNotFound{}
}
/*
RepoGetKeyNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type RepoGetKeyNotFound struct {
}
// IsSuccess returns true when this repo get key not found response has a 2xx status code
func (o *RepoGetKeyNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo get key not found response has a 3xx status code
func (o *RepoGetKeyNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo get key not found response has a 4xx status code
func (o *RepoGetKeyNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this repo get key not found response has a 5xx status code
func (o *RepoGetKeyNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this repo get key not found response a status code equal to that given
func (o *RepoGetKeyNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the repo get key not found response
func (o *RepoGetKeyNotFound) Code() int {
return 404
}
func (o *RepoGetKeyNotFound) Error() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/keys/{id}][%d] repoGetKeyNotFound", 404)
}
func (o *RepoGetKeyNotFound) String() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/keys/{id}][%d] repoGetKeyNotFound", 404)
}
func (o *RepoGetKeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}