autogits/bots-common/gitea-generated/client/miscellaneous/render_markup_responses.go

181 lines
5.1 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// Code generated by go-swagger; DO NOT EDIT.
package miscellaneous
// 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"
)
// RenderMarkupReader is a Reader for the RenderMarkup structure.
type RenderMarkupReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RenderMarkupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRenderMarkupOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 422:
result := NewRenderMarkupUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /markup] renderMarkup", response, response.Code())
}
}
// NewRenderMarkupOK creates a RenderMarkupOK with default headers values
func NewRenderMarkupOK() *RenderMarkupOK {
return &RenderMarkupOK{}
}
/*
RenderMarkupOK describes a response with status code 200, with default header values.
MarkupRender is a rendered markup document
*/
type RenderMarkupOK struct {
Payload string
}
// IsSuccess returns true when this render markup o k response has a 2xx status code
func (o *RenderMarkupOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this render markup o k response has a 3xx status code
func (o *RenderMarkupOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this render markup o k response has a 4xx status code
func (o *RenderMarkupOK) IsClientError() bool {
return false
}
// IsServerError returns true when this render markup o k response has a 5xx status code
func (o *RenderMarkupOK) IsServerError() bool {
return false
}
// IsCode returns true when this render markup o k response a status code equal to that given
func (o *RenderMarkupOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the render markup o k response
func (o *RenderMarkupOK) Code() int {
return 200
}
func (o *RenderMarkupOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /markup][%d] renderMarkupOK %s", 200, payload)
}
func (o *RenderMarkupOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /markup][%d] renderMarkupOK %s", 200, payload)
}
func (o *RenderMarkupOK) GetPayload() string {
return o.Payload
}
func (o *RenderMarkupOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewRenderMarkupUnprocessableEntity creates a RenderMarkupUnprocessableEntity with default headers values
func NewRenderMarkupUnprocessableEntity() *RenderMarkupUnprocessableEntity {
return &RenderMarkupUnprocessableEntity{}
}
/*
RenderMarkupUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type RenderMarkupUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this render markup unprocessable entity response has a 2xx status code
func (o *RenderMarkupUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this render markup unprocessable entity response has a 3xx status code
func (o *RenderMarkupUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this render markup unprocessable entity response has a 4xx status code
func (o *RenderMarkupUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this render markup unprocessable entity response has a 5xx status code
func (o *RenderMarkupUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this render markup unprocessable entity response a status code equal to that given
func (o *RenderMarkupUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the render markup unprocessable entity response
func (o *RenderMarkupUnprocessableEntity) Code() int {
return 422
}
func (o *RenderMarkupUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /markup][%d] renderMarkupUnprocessableEntity", 422)
}
func (o *RenderMarkupUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /markup][%d] renderMarkupUnprocessableEntity", 422)
}
func (o *RenderMarkupUnprocessableEntity) 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
}