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

341 lines
9.9 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package admin
// 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"
)
// AdminCreateUserReader is a Reader for the AdminCreateUser structure.
type AdminCreateUserReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *AdminCreateUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewAdminCreateUserCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewAdminCreateUserBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewAdminCreateUserForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewAdminCreateUserUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /admin/users] adminCreateUser", response, response.Code())
}
}
// NewAdminCreateUserCreated creates a AdminCreateUserCreated with default headers values
func NewAdminCreateUserCreated() *AdminCreateUserCreated {
return &AdminCreateUserCreated{}
}
/*
AdminCreateUserCreated describes a response with status code 201, with default header values.
User
*/
type AdminCreateUserCreated struct {
Payload *models.User
}
// IsSuccess returns true when this admin create user created response has a 2xx status code
func (o *AdminCreateUserCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this admin create user created response has a 3xx status code
func (o *AdminCreateUserCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this admin create user created response has a 4xx status code
func (o *AdminCreateUserCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this admin create user created response has a 5xx status code
func (o *AdminCreateUserCreated) IsServerError() bool {
return false
}
// IsCode returns true when this admin create user created response a status code equal to that given
func (o *AdminCreateUserCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the admin create user created response
func (o *AdminCreateUserCreated) Code() int {
return 201
}
func (o *AdminCreateUserCreated) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserCreated %s", 201, payload)
}
func (o *AdminCreateUserCreated) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserCreated %s", 201, payload)
}
func (o *AdminCreateUserCreated) GetPayload() *models.User {
return o.Payload
}
func (o *AdminCreateUserCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.User)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewAdminCreateUserBadRequest creates a AdminCreateUserBadRequest with default headers values
func NewAdminCreateUserBadRequest() *AdminCreateUserBadRequest {
return &AdminCreateUserBadRequest{}
}
/*
AdminCreateUserBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type AdminCreateUserBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this admin create user bad request response has a 2xx status code
func (o *AdminCreateUserBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this admin create user bad request response has a 3xx status code
func (o *AdminCreateUserBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this admin create user bad request response has a 4xx status code
func (o *AdminCreateUserBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this admin create user bad request response has a 5xx status code
func (o *AdminCreateUserBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this admin create user bad request response a status code equal to that given
func (o *AdminCreateUserBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the admin create user bad request response
func (o *AdminCreateUserBadRequest) Code() int {
return 400
}
func (o *AdminCreateUserBadRequest) Error() string {
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserBadRequest", 400)
}
func (o *AdminCreateUserBadRequest) String() string {
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserBadRequest", 400)
}
func (o *AdminCreateUserBadRequest) 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
}
// NewAdminCreateUserForbidden creates a AdminCreateUserForbidden with default headers values
func NewAdminCreateUserForbidden() *AdminCreateUserForbidden {
return &AdminCreateUserForbidden{}
}
/*
AdminCreateUserForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type AdminCreateUserForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this admin create user forbidden response has a 2xx status code
func (o *AdminCreateUserForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this admin create user forbidden response has a 3xx status code
func (o *AdminCreateUserForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this admin create user forbidden response has a 4xx status code
func (o *AdminCreateUserForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this admin create user forbidden response has a 5xx status code
func (o *AdminCreateUserForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this admin create user forbidden response a status code equal to that given
func (o *AdminCreateUserForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the admin create user forbidden response
func (o *AdminCreateUserForbidden) Code() int {
return 403
}
func (o *AdminCreateUserForbidden) Error() string {
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserForbidden", 403)
}
func (o *AdminCreateUserForbidden) String() string {
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserForbidden", 403)
}
func (o *AdminCreateUserForbidden) 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
}
// NewAdminCreateUserUnprocessableEntity creates a AdminCreateUserUnprocessableEntity with default headers values
func NewAdminCreateUserUnprocessableEntity() *AdminCreateUserUnprocessableEntity {
return &AdminCreateUserUnprocessableEntity{}
}
/*
AdminCreateUserUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type AdminCreateUserUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this admin create user unprocessable entity response has a 2xx status code
func (o *AdminCreateUserUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this admin create user unprocessable entity response has a 3xx status code
func (o *AdminCreateUserUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this admin create user unprocessable entity response has a 4xx status code
func (o *AdminCreateUserUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this admin create user unprocessable entity response has a 5xx status code
func (o *AdminCreateUserUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this admin create user unprocessable entity response a status code equal to that given
func (o *AdminCreateUserUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the admin create user unprocessable entity response
func (o *AdminCreateUserUnprocessableEntity) Code() int {
return 422
}
func (o *AdminCreateUserUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserUnprocessableEntity", 422)
}
func (o *AdminCreateUserUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserUnprocessableEntity", 422)
}
func (o *AdminCreateUserUnprocessableEntity) 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
}