247 lines
7.6 KiB
Go
247 lines
7.6 KiB
Go
|
// Code generated by go-swagger; DO NOT EDIT.
|
||
|
|
||
|
package issue
|
||
|
|
||
|
// 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"
|
||
|
)
|
||
|
|
||
|
// IssueCreateLabelReader is a Reader for the IssueCreateLabel structure.
|
||
|
type IssueCreateLabelReader struct {
|
||
|
formats strfmt.Registry
|
||
|
}
|
||
|
|
||
|
// ReadResponse reads a server response into the received o.
|
||
|
func (o *IssueCreateLabelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||
|
switch response.Code() {
|
||
|
case 201:
|
||
|
result := NewIssueCreateLabelCreated()
|
||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return result, nil
|
||
|
case 404:
|
||
|
result := NewIssueCreateLabelNotFound()
|
||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return nil, result
|
||
|
case 422:
|
||
|
result := NewIssueCreateLabelUnprocessableEntity()
|
||
|
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}/labels] issueCreateLabel", response, response.Code())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// NewIssueCreateLabelCreated creates a IssueCreateLabelCreated with default headers values
|
||
|
func NewIssueCreateLabelCreated() *IssueCreateLabelCreated {
|
||
|
return &IssueCreateLabelCreated{}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
IssueCreateLabelCreated describes a response with status code 201, with default header values.
|
||
|
|
||
|
Label
|
||
|
*/
|
||
|
type IssueCreateLabelCreated struct {
|
||
|
Payload *models.Label
|
||
|
}
|
||
|
|
||
|
// IsSuccess returns true when this issue create label created response has a 2xx status code
|
||
|
func (o *IssueCreateLabelCreated) IsSuccess() bool {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// IsRedirect returns true when this issue create label created response has a 3xx status code
|
||
|
func (o *IssueCreateLabelCreated) IsRedirect() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsClientError returns true when this issue create label created response has a 4xx status code
|
||
|
func (o *IssueCreateLabelCreated) IsClientError() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsServerError returns true when this issue create label created response has a 5xx status code
|
||
|
func (o *IssueCreateLabelCreated) IsServerError() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsCode returns true when this issue create label created response a status code equal to that given
|
||
|
func (o *IssueCreateLabelCreated) IsCode(code int) bool {
|
||
|
return code == 201
|
||
|
}
|
||
|
|
||
|
// Code gets the status code for the issue create label created response
|
||
|
func (o *IssueCreateLabelCreated) Code() int {
|
||
|
return 201
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelCreated) Error() string {
|
||
|
payload, _ := json.Marshal(o.Payload)
|
||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelCreated %s", 201, payload)
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelCreated) String() string {
|
||
|
payload, _ := json.Marshal(o.Payload)
|
||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelCreated %s", 201, payload)
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelCreated) GetPayload() *models.Label {
|
||
|
return o.Payload
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||
|
|
||
|
o.Payload = new(models.Label)
|
||
|
|
||
|
// response payload
|
||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// NewIssueCreateLabelNotFound creates a IssueCreateLabelNotFound with default headers values
|
||
|
func NewIssueCreateLabelNotFound() *IssueCreateLabelNotFound {
|
||
|
return &IssueCreateLabelNotFound{}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
IssueCreateLabelNotFound describes a response with status code 404, with default header values.
|
||
|
|
||
|
APINotFound is a not found empty response
|
||
|
*/
|
||
|
type IssueCreateLabelNotFound struct {
|
||
|
}
|
||
|
|
||
|
// IsSuccess returns true when this issue create label not found response has a 2xx status code
|
||
|
func (o *IssueCreateLabelNotFound) IsSuccess() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsRedirect returns true when this issue create label not found response has a 3xx status code
|
||
|
func (o *IssueCreateLabelNotFound) IsRedirect() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsClientError returns true when this issue create label not found response has a 4xx status code
|
||
|
func (o *IssueCreateLabelNotFound) IsClientError() bool {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// IsServerError returns true when this issue create label not found response has a 5xx status code
|
||
|
func (o *IssueCreateLabelNotFound) IsServerError() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsCode returns true when this issue create label not found response a status code equal to that given
|
||
|
func (o *IssueCreateLabelNotFound) IsCode(code int) bool {
|
||
|
return code == 404
|
||
|
}
|
||
|
|
||
|
// Code gets the status code for the issue create label not found response
|
||
|
func (o *IssueCreateLabelNotFound) Code() int {
|
||
|
return 404
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelNotFound) Error() string {
|
||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelNotFound", 404)
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelNotFound) String() string {
|
||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelNotFound", 404)
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// NewIssueCreateLabelUnprocessableEntity creates a IssueCreateLabelUnprocessableEntity with default headers values
|
||
|
func NewIssueCreateLabelUnprocessableEntity() *IssueCreateLabelUnprocessableEntity {
|
||
|
return &IssueCreateLabelUnprocessableEntity{}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
IssueCreateLabelUnprocessableEntity describes a response with status code 422, with default header values.
|
||
|
|
||
|
APIValidationError is error format response related to input validation
|
||
|
*/
|
||
|
type IssueCreateLabelUnprocessableEntity struct {
|
||
|
Message string
|
||
|
URL string
|
||
|
}
|
||
|
|
||
|
// IsSuccess returns true when this issue create label unprocessable entity response has a 2xx status code
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) IsSuccess() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsRedirect returns true when this issue create label unprocessable entity response has a 3xx status code
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) IsRedirect() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsClientError returns true when this issue create label unprocessable entity response has a 4xx status code
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) IsClientError() bool {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// IsServerError returns true when this issue create label unprocessable entity response has a 5xx status code
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) IsServerError() bool {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
// IsCode returns true when this issue create label unprocessable entity response a status code equal to that given
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) IsCode(code int) bool {
|
||
|
return code == 422
|
||
|
}
|
||
|
|
||
|
// Code gets the status code for the issue create label unprocessable entity response
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) Code() int {
|
||
|
return 422
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) Error() string {
|
||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelUnprocessableEntity", 422)
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) String() string {
|
||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelUnprocessableEntity", 422)
|
||
|
}
|
||
|
|
||
|
func (o *IssueCreateLabelUnprocessableEntity) 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
|
||
|
}
|