autogits/bots-common/gitea-generated/client/repository/topic_search_responses.go

245 lines
6.7 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// TopicSearchReader is a Reader for the TopicSearch structure.
type TopicSearchReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *TopicSearchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewTopicSearchOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewTopicSearchForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewTopicSearchNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /topics/search] topicSearch", response, response.Code())
}
}
// NewTopicSearchOK creates a TopicSearchOK with default headers values
func NewTopicSearchOK() *TopicSearchOK {
return &TopicSearchOK{}
}
/*
TopicSearchOK describes a response with status code 200, with default header values.
TopicListResponse
*/
type TopicSearchOK struct {
Payload []*models.TopicResponse
}
// IsSuccess returns true when this topic search o k response has a 2xx status code
func (o *TopicSearchOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this topic search o k response has a 3xx status code
func (o *TopicSearchOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this topic search o k response has a 4xx status code
func (o *TopicSearchOK) IsClientError() bool {
return false
}
// IsServerError returns true when this topic search o k response has a 5xx status code
func (o *TopicSearchOK) IsServerError() bool {
return false
}
// IsCode returns true when this topic search o k response a status code equal to that given
func (o *TopicSearchOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the topic search o k response
func (o *TopicSearchOK) Code() int {
return 200
}
func (o *TopicSearchOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /topics/search][%d] topicSearchOK %s", 200, payload)
}
func (o *TopicSearchOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /topics/search][%d] topicSearchOK %s", 200, payload)
}
func (o *TopicSearchOK) GetPayload() []*models.TopicResponse {
return o.Payload
}
func (o *TopicSearchOK) 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
}
// NewTopicSearchForbidden creates a TopicSearchForbidden with default headers values
func NewTopicSearchForbidden() *TopicSearchForbidden {
return &TopicSearchForbidden{}
}
/*
TopicSearchForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type TopicSearchForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this topic search forbidden response has a 2xx status code
func (o *TopicSearchForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this topic search forbidden response has a 3xx status code
func (o *TopicSearchForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this topic search forbidden response has a 4xx status code
func (o *TopicSearchForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this topic search forbidden response has a 5xx status code
func (o *TopicSearchForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this topic search forbidden response a status code equal to that given
func (o *TopicSearchForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the topic search forbidden response
func (o *TopicSearchForbidden) Code() int {
return 403
}
func (o *TopicSearchForbidden) Error() string {
return fmt.Sprintf("[GET /topics/search][%d] topicSearchForbidden", 403)
}
func (o *TopicSearchForbidden) String() string {
return fmt.Sprintf("[GET /topics/search][%d] topicSearchForbidden", 403)
}
func (o *TopicSearchForbidden) 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
}
// NewTopicSearchNotFound creates a TopicSearchNotFound with default headers values
func NewTopicSearchNotFound() *TopicSearchNotFound {
return &TopicSearchNotFound{}
}
/*
TopicSearchNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type TopicSearchNotFound struct {
}
// IsSuccess returns true when this topic search not found response has a 2xx status code
func (o *TopicSearchNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this topic search not found response has a 3xx status code
func (o *TopicSearchNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this topic search not found response has a 4xx status code
func (o *TopicSearchNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this topic search not found response has a 5xx status code
func (o *TopicSearchNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this topic search not found response a status code equal to that given
func (o *TopicSearchNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the topic search not found response
func (o *TopicSearchNotFound) Code() int {
return 404
}
func (o *TopicSearchNotFound) Error() string {
return fmt.Sprintf("[GET /topics/search][%d] topicSearchNotFound", 404)
}
func (o *TopicSearchNotFound) String() string {
return fmt.Sprintf("[GET /topics/search][%d] topicSearchNotFound", 404)
}
func (o *TopicSearchNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}