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

325 lines
9.9 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"
)
// IssueCreateCommentReader is a Reader for the IssueCreateComment structure.
type IssueCreateCommentReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *IssueCreateCommentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewIssueCreateCommentCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewIssueCreateCommentForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewIssueCreateCommentNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 423:
result := NewIssueCreateCommentLocked()
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}/comments] issueCreateComment", response, response.Code())
}
}
// NewIssueCreateCommentCreated creates a IssueCreateCommentCreated with default headers values
func NewIssueCreateCommentCreated() *IssueCreateCommentCreated {
return &IssueCreateCommentCreated{}
}
/*
IssueCreateCommentCreated describes a response with status code 201, with default header values.
Comment
*/
type IssueCreateCommentCreated struct {
Payload *models.Comment
}
// IsSuccess returns true when this issue create comment created response has a 2xx status code
func (o *IssueCreateCommentCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this issue create comment created response has a 3xx status code
func (o *IssueCreateCommentCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue create comment created response has a 4xx status code
func (o *IssueCreateCommentCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this issue create comment created response has a 5xx status code
func (o *IssueCreateCommentCreated) IsServerError() bool {
return false
}
// IsCode returns true when this issue create comment created response a status code equal to that given
func (o *IssueCreateCommentCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the issue create comment created response
func (o *IssueCreateCommentCreated) Code() int {
return 201
}
func (o *IssueCreateCommentCreated) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentCreated %s", 201, payload)
}
func (o *IssueCreateCommentCreated) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentCreated %s", 201, payload)
}
func (o *IssueCreateCommentCreated) GetPayload() *models.Comment {
return o.Payload
}
func (o *IssueCreateCommentCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Comment)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewIssueCreateCommentForbidden creates a IssueCreateCommentForbidden with default headers values
func NewIssueCreateCommentForbidden() *IssueCreateCommentForbidden {
return &IssueCreateCommentForbidden{}
}
/*
IssueCreateCommentForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type IssueCreateCommentForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this issue create comment forbidden response has a 2xx status code
func (o *IssueCreateCommentForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue create comment forbidden response has a 3xx status code
func (o *IssueCreateCommentForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue create comment forbidden response has a 4xx status code
func (o *IssueCreateCommentForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this issue create comment forbidden response has a 5xx status code
func (o *IssueCreateCommentForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this issue create comment forbidden response a status code equal to that given
func (o *IssueCreateCommentForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the issue create comment forbidden response
func (o *IssueCreateCommentForbidden) Code() int {
return 403
}
func (o *IssueCreateCommentForbidden) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentForbidden", 403)
}
func (o *IssueCreateCommentForbidden) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentForbidden", 403)
}
func (o *IssueCreateCommentForbidden) 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
}
// NewIssueCreateCommentNotFound creates a IssueCreateCommentNotFound with default headers values
func NewIssueCreateCommentNotFound() *IssueCreateCommentNotFound {
return &IssueCreateCommentNotFound{}
}
/*
IssueCreateCommentNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type IssueCreateCommentNotFound struct {
}
// IsSuccess returns true when this issue create comment not found response has a 2xx status code
func (o *IssueCreateCommentNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue create comment not found response has a 3xx status code
func (o *IssueCreateCommentNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue create comment not found response has a 4xx status code
func (o *IssueCreateCommentNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this issue create comment not found response has a 5xx status code
func (o *IssueCreateCommentNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this issue create comment not found response a status code equal to that given
func (o *IssueCreateCommentNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the issue create comment not found response
func (o *IssueCreateCommentNotFound) Code() int {
return 404
}
func (o *IssueCreateCommentNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentNotFound", 404)
}
func (o *IssueCreateCommentNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentNotFound", 404)
}
func (o *IssueCreateCommentNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewIssueCreateCommentLocked creates a IssueCreateCommentLocked with default headers values
func NewIssueCreateCommentLocked() *IssueCreateCommentLocked {
return &IssueCreateCommentLocked{}
}
/*
IssueCreateCommentLocked describes a response with status code 423, with default header values.
APIRepoArchivedError is an error that is raised when an archived repo should be modified
*/
type IssueCreateCommentLocked struct {
Message string
URL string
}
// IsSuccess returns true when this issue create comment locked response has a 2xx status code
func (o *IssueCreateCommentLocked) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue create comment locked response has a 3xx status code
func (o *IssueCreateCommentLocked) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue create comment locked response has a 4xx status code
func (o *IssueCreateCommentLocked) IsClientError() bool {
return true
}
// IsServerError returns true when this issue create comment locked response has a 5xx status code
func (o *IssueCreateCommentLocked) IsServerError() bool {
return false
}
// IsCode returns true when this issue create comment locked response a status code equal to that given
func (o *IssueCreateCommentLocked) IsCode(code int) bool {
return code == 423
}
// Code gets the status code for the issue create comment locked response
func (o *IssueCreateCommentLocked) Code() int {
return 423
}
func (o *IssueCreateCommentLocked) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentLocked", 423)
}
func (o *IssueCreateCommentLocked) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentLocked", 423)
}
func (o *IssueCreateCommentLocked) 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
}