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

181 lines
5.4 KiB
Go

// 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"
)
// RenderMarkdownRawReader is a Reader for the RenderMarkdownRaw structure.
type RenderMarkdownRawReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RenderMarkdownRawReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRenderMarkdownRawOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 422:
result := NewRenderMarkdownRawUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /markdown/raw] renderMarkdownRaw", response, response.Code())
}
}
// NewRenderMarkdownRawOK creates a RenderMarkdownRawOK with default headers values
func NewRenderMarkdownRawOK() *RenderMarkdownRawOK {
return &RenderMarkdownRawOK{}
}
/*
RenderMarkdownRawOK describes a response with status code 200, with default header values.
MarkdownRender is a rendered markdown document
*/
type RenderMarkdownRawOK struct {
Payload string
}
// IsSuccess returns true when this render markdown raw o k response has a 2xx status code
func (o *RenderMarkdownRawOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this render markdown raw o k response has a 3xx status code
func (o *RenderMarkdownRawOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this render markdown raw o k response has a 4xx status code
func (o *RenderMarkdownRawOK) IsClientError() bool {
return false
}
// IsServerError returns true when this render markdown raw o k response has a 5xx status code
func (o *RenderMarkdownRawOK) IsServerError() bool {
return false
}
// IsCode returns true when this render markdown raw o k response a status code equal to that given
func (o *RenderMarkdownRawOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the render markdown raw o k response
func (o *RenderMarkdownRawOK) Code() int {
return 200
}
func (o *RenderMarkdownRawOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /markdown/raw][%d] renderMarkdownRawOK %s", 200, payload)
}
func (o *RenderMarkdownRawOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /markdown/raw][%d] renderMarkdownRawOK %s", 200, payload)
}
func (o *RenderMarkdownRawOK) GetPayload() string {
return o.Payload
}
func (o *RenderMarkdownRawOK) 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
}
// NewRenderMarkdownRawUnprocessableEntity creates a RenderMarkdownRawUnprocessableEntity with default headers values
func NewRenderMarkdownRawUnprocessableEntity() *RenderMarkdownRawUnprocessableEntity {
return &RenderMarkdownRawUnprocessableEntity{}
}
/*
RenderMarkdownRawUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type RenderMarkdownRawUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this render markdown raw unprocessable entity response has a 2xx status code
func (o *RenderMarkdownRawUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this render markdown raw unprocessable entity response has a 3xx status code
func (o *RenderMarkdownRawUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this render markdown raw unprocessable entity response has a 4xx status code
func (o *RenderMarkdownRawUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this render markdown raw unprocessable entity response has a 5xx status code
func (o *RenderMarkdownRawUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this render markdown raw unprocessable entity response a status code equal to that given
func (o *RenderMarkdownRawUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the render markdown raw unprocessable entity response
func (o *RenderMarkdownRawUnprocessableEntity) Code() int {
return 422
}
func (o *RenderMarkdownRawUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /markdown/raw][%d] renderMarkdownRawUnprocessableEntity", 422)
}
func (o *RenderMarkdownRawUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /markdown/raw][%d] renderMarkdownRawUnprocessableEntity", 422)
}
func (o *RenderMarkdownRawUnprocessableEntity) 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
}