Files
autogits/common/gitea-generated/client/user/create_user_variable_responses.go

229 lines
7.2 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 (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// CreateUserVariableReader is a Reader for the CreateUserVariable structure.
type CreateUserVariableReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateUserVariableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewCreateUserVariableCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewCreateUserVariableBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewCreateUserVariableConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /user/actions/variables/{variablename}] createUserVariable", response, response.Code())
}
}
// NewCreateUserVariableCreated creates a CreateUserVariableCreated with default headers values
func NewCreateUserVariableCreated() *CreateUserVariableCreated {
return &CreateUserVariableCreated{}
}
/*
CreateUserVariableCreated describes a response with status code 201, with default header values.
successfully created the user-level variable
*/
type CreateUserVariableCreated struct {
}
// IsSuccess returns true when this create user variable created response has a 2xx status code
func (o *CreateUserVariableCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create user variable created response has a 3xx status code
func (o *CreateUserVariableCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this create user variable created response has a 4xx status code
func (o *CreateUserVariableCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this create user variable created response has a 5xx status code
func (o *CreateUserVariableCreated) IsServerError() bool {
return false
}
// IsCode returns true when this create user variable created response a status code equal to that given
func (o *CreateUserVariableCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the create user variable created response
func (o *CreateUserVariableCreated) Code() int {
return 201
}
func (o *CreateUserVariableCreated) Error() string {
return fmt.Sprintf("[POST /user/actions/variables/{variablename}][%d] createUserVariableCreated", 201)
}
func (o *CreateUserVariableCreated) String() string {
return fmt.Sprintf("[POST /user/actions/variables/{variablename}][%d] createUserVariableCreated", 201)
}
func (o *CreateUserVariableCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewCreateUserVariableBadRequest creates a CreateUserVariableBadRequest with default headers values
func NewCreateUserVariableBadRequest() *CreateUserVariableBadRequest {
return &CreateUserVariableBadRequest{}
}
/*
CreateUserVariableBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type CreateUserVariableBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this create user variable bad request response has a 2xx status code
func (o *CreateUserVariableBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create user variable bad request response has a 3xx status code
func (o *CreateUserVariableBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this create user variable bad request response has a 4xx status code
func (o *CreateUserVariableBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this create user variable bad request response has a 5xx status code
func (o *CreateUserVariableBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this create user variable bad request response a status code equal to that given
func (o *CreateUserVariableBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the create user variable bad request response
func (o *CreateUserVariableBadRequest) Code() int {
return 400
}
func (o *CreateUserVariableBadRequest) Error() string {
return fmt.Sprintf("[POST /user/actions/variables/{variablename}][%d] createUserVariableBadRequest", 400)
}
func (o *CreateUserVariableBadRequest) String() string {
return fmt.Sprintf("[POST /user/actions/variables/{variablename}][%d] createUserVariableBadRequest", 400)
}
func (o *CreateUserVariableBadRequest) 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
}
// NewCreateUserVariableConflict creates a CreateUserVariableConflict with default headers values
func NewCreateUserVariableConflict() *CreateUserVariableConflict {
return &CreateUserVariableConflict{}
}
/*
CreateUserVariableConflict describes a response with status code 409, with default header values.
variable name already exists.
*/
type CreateUserVariableConflict struct {
}
// IsSuccess returns true when this create user variable conflict response has a 2xx status code
func (o *CreateUserVariableConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create user variable conflict response has a 3xx status code
func (o *CreateUserVariableConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this create user variable conflict response has a 4xx status code
func (o *CreateUserVariableConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this create user variable conflict response has a 5xx status code
func (o *CreateUserVariableConflict) IsServerError() bool {
return false
}
// IsCode returns true when this create user variable conflict response a status code equal to that given
func (o *CreateUserVariableConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the create user variable conflict response
func (o *CreateUserVariableConflict) Code() int {
return 409
}
func (o *CreateUserVariableConflict) Error() string {
return fmt.Sprintf("[POST /user/actions/variables/{variablename}][%d] createUserVariableConflict", 409)
}
func (o *CreateUserVariableConflict) String() string {
return fmt.Sprintf("[POST /user/actions/variables/{variablename}][%d] createUserVariableConflict", 409)
}
func (o *CreateUserVariableConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}