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

169 lines
5.0 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package user
// 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"
)
// UserCurrentGetKeyReader is a Reader for the UserCurrentGetKey structure.
type UserCurrentGetKeyReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *UserCurrentGetKeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewUserCurrentGetKeyOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewUserCurrentGetKeyNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /user/keys/{id}] userCurrentGetKey", response, response.Code())
}
}
// NewUserCurrentGetKeyOK creates a UserCurrentGetKeyOK with default headers values
func NewUserCurrentGetKeyOK() *UserCurrentGetKeyOK {
return &UserCurrentGetKeyOK{}
}
/*
UserCurrentGetKeyOK describes a response with status code 200, with default header values.
PublicKey
*/
type UserCurrentGetKeyOK struct {
Payload *models.PublicKey
}
// IsSuccess returns true when this user current get key o k response has a 2xx status code
func (o *UserCurrentGetKeyOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this user current get key o k response has a 3xx status code
func (o *UserCurrentGetKeyOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this user current get key o k response has a 4xx status code
func (o *UserCurrentGetKeyOK) IsClientError() bool {
return false
}
// IsServerError returns true when this user current get key o k response has a 5xx status code
func (o *UserCurrentGetKeyOK) IsServerError() bool {
return false
}
// IsCode returns true when this user current get key o k response a status code equal to that given
func (o *UserCurrentGetKeyOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the user current get key o k response
func (o *UserCurrentGetKeyOK) Code() int {
return 200
}
func (o *UserCurrentGetKeyOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /user/keys/{id}][%d] userCurrentGetKeyOK %s", 200, payload)
}
func (o *UserCurrentGetKeyOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /user/keys/{id}][%d] userCurrentGetKeyOK %s", 200, payload)
}
func (o *UserCurrentGetKeyOK) GetPayload() *models.PublicKey {
return o.Payload
}
func (o *UserCurrentGetKeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.PublicKey)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewUserCurrentGetKeyNotFound creates a UserCurrentGetKeyNotFound with default headers values
func NewUserCurrentGetKeyNotFound() *UserCurrentGetKeyNotFound {
return &UserCurrentGetKeyNotFound{}
}
/*
UserCurrentGetKeyNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type UserCurrentGetKeyNotFound struct {
}
// IsSuccess returns true when this user current get key not found response has a 2xx status code
func (o *UserCurrentGetKeyNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this user current get key not found response has a 3xx status code
func (o *UserCurrentGetKeyNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this user current get key not found response has a 4xx status code
func (o *UserCurrentGetKeyNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this user current get key not found response has a 5xx status code
func (o *UserCurrentGetKeyNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this user current get key not found response a status code equal to that given
func (o *UserCurrentGetKeyNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the user current get key not found response
func (o *UserCurrentGetKeyNotFound) Code() int {
return 404
}
func (o *UserCurrentGetKeyNotFound) Error() string {
return fmt.Sprintf("[GET /user/keys/{id}][%d] userCurrentGetKeyNotFound", 404)
}
func (o *UserCurrentGetKeyNotFound) String() string {
return fmt.Sprintf("[GET /user/keys/{id}][%d] userCurrentGetKeyNotFound", 404)
}
func (o *UserCurrentGetKeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}