autogits/bots-common/gitea-generated/client/issue/issue_add_time_responses.go

325 lines
9.2 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// 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"
)
// IssueAddTimeReader is a Reader for the IssueAddTime structure.
type IssueAddTimeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *IssueAddTimeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewIssueAddTimeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewIssueAddTimeBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewIssueAddTimeForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewIssueAddTimeNotFound()
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}/issues/{index}/times] issueAddTime", response, response.Code())
}
}
// NewIssueAddTimeOK creates a IssueAddTimeOK with default headers values
func NewIssueAddTimeOK() *IssueAddTimeOK {
return &IssueAddTimeOK{}
}
/*
IssueAddTimeOK describes a response with status code 200, with default header values.
TrackedTime
*/
type IssueAddTimeOK struct {
Payload *models.TrackedTime
}
// IsSuccess returns true when this issue add time o k response has a 2xx status code
func (o *IssueAddTimeOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this issue add time o k response has a 3xx status code
func (o *IssueAddTimeOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue add time o k response has a 4xx status code
func (o *IssueAddTimeOK) IsClientError() bool {
return false
}
// IsServerError returns true when this issue add time o k response has a 5xx status code
func (o *IssueAddTimeOK) IsServerError() bool {
return false
}
// IsCode returns true when this issue add time o k response a status code equal to that given
func (o *IssueAddTimeOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the issue add time o k response
func (o *IssueAddTimeOK) Code() int {
return 200
}
func (o *IssueAddTimeOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeOK %s", 200, payload)
}
func (o *IssueAddTimeOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeOK %s", 200, payload)
}
func (o *IssueAddTimeOK) GetPayload() *models.TrackedTime {
return o.Payload
}
func (o *IssueAddTimeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.TrackedTime)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewIssueAddTimeBadRequest creates a IssueAddTimeBadRequest with default headers values
func NewIssueAddTimeBadRequest() *IssueAddTimeBadRequest {
return &IssueAddTimeBadRequest{}
}
/*
IssueAddTimeBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type IssueAddTimeBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this issue add time bad request response has a 2xx status code
func (o *IssueAddTimeBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue add time bad request response has a 3xx status code
func (o *IssueAddTimeBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue add time bad request response has a 4xx status code
func (o *IssueAddTimeBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this issue add time bad request response has a 5xx status code
func (o *IssueAddTimeBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this issue add time bad request response a status code equal to that given
func (o *IssueAddTimeBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the issue add time bad request response
func (o *IssueAddTimeBadRequest) Code() int {
return 400
}
func (o *IssueAddTimeBadRequest) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeBadRequest", 400)
}
func (o *IssueAddTimeBadRequest) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeBadRequest", 400)
}
func (o *IssueAddTimeBadRequest) 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
}
// NewIssueAddTimeForbidden creates a IssueAddTimeForbidden with default headers values
func NewIssueAddTimeForbidden() *IssueAddTimeForbidden {
return &IssueAddTimeForbidden{}
}
/*
IssueAddTimeForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type IssueAddTimeForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this issue add time forbidden response has a 2xx status code
func (o *IssueAddTimeForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue add time forbidden response has a 3xx status code
func (o *IssueAddTimeForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue add time forbidden response has a 4xx status code
func (o *IssueAddTimeForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this issue add time forbidden response has a 5xx status code
func (o *IssueAddTimeForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this issue add time forbidden response a status code equal to that given
func (o *IssueAddTimeForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the issue add time forbidden response
func (o *IssueAddTimeForbidden) Code() int {
return 403
}
func (o *IssueAddTimeForbidden) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeForbidden", 403)
}
func (o *IssueAddTimeForbidden) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeForbidden", 403)
}
func (o *IssueAddTimeForbidden) 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
}
// NewIssueAddTimeNotFound creates a IssueAddTimeNotFound with default headers values
func NewIssueAddTimeNotFound() *IssueAddTimeNotFound {
return &IssueAddTimeNotFound{}
}
/*
IssueAddTimeNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type IssueAddTimeNotFound struct {
}
// IsSuccess returns true when this issue add time not found response has a 2xx status code
func (o *IssueAddTimeNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue add time not found response has a 3xx status code
func (o *IssueAddTimeNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue add time not found response has a 4xx status code
func (o *IssueAddTimeNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this issue add time not found response has a 5xx status code
func (o *IssueAddTimeNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this issue add time not found response a status code equal to that given
func (o *IssueAddTimeNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the issue add time not found response
func (o *IssueAddTimeNotFound) Code() int {
return 404
}
func (o *IssueAddTimeNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeNotFound", 404)
}
func (o *IssueAddTimeNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeNotFound", 404)
}
func (o *IssueAddTimeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}