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

257 lines
8.2 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 (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// RepoDeleteTopicReader is a Reader for the RepoDeleteTopic structure.
type RepoDeleteTopicReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RepoDeleteTopicReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewRepoDeleteTopicNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewRepoDeleteTopicNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewRepoDeleteTopicUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /repos/{owner}/{repo}/topics/{topic}] repoDeleteTopic", response, response.Code())
}
}
// NewRepoDeleteTopicNoContent creates a RepoDeleteTopicNoContent with default headers values
func NewRepoDeleteTopicNoContent() *RepoDeleteTopicNoContent {
return &RepoDeleteTopicNoContent{}
}
/*
RepoDeleteTopicNoContent describes a response with status code 204, with default header values.
APIEmpty is an empty response
*/
type RepoDeleteTopicNoContent struct {
}
// IsSuccess returns true when this repo delete topic no content response has a 2xx status code
func (o *RepoDeleteTopicNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this repo delete topic no content response has a 3xx status code
func (o *RepoDeleteTopicNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo delete topic no content response has a 4xx status code
func (o *RepoDeleteTopicNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this repo delete topic no content response has a 5xx status code
func (o *RepoDeleteTopicNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this repo delete topic no content response a status code equal to that given
func (o *RepoDeleteTopicNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the repo delete topic no content response
func (o *RepoDeleteTopicNoContent) Code() int {
return 204
}
func (o *RepoDeleteTopicNoContent) Error() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/topics/{topic}][%d] repoDeleteTopicNoContent", 204)
}
func (o *RepoDeleteTopicNoContent) String() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/topics/{topic}][%d] repoDeleteTopicNoContent", 204)
}
func (o *RepoDeleteTopicNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoDeleteTopicNotFound creates a RepoDeleteTopicNotFound with default headers values
func NewRepoDeleteTopicNotFound() *RepoDeleteTopicNotFound {
return &RepoDeleteTopicNotFound{}
}
/*
RepoDeleteTopicNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type RepoDeleteTopicNotFound struct {
}
// IsSuccess returns true when this repo delete topic not found response has a 2xx status code
func (o *RepoDeleteTopicNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo delete topic not found response has a 3xx status code
func (o *RepoDeleteTopicNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo delete topic not found response has a 4xx status code
func (o *RepoDeleteTopicNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this repo delete topic not found response has a 5xx status code
func (o *RepoDeleteTopicNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this repo delete topic not found response a status code equal to that given
func (o *RepoDeleteTopicNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the repo delete topic not found response
func (o *RepoDeleteTopicNotFound) Code() int {
return 404
}
func (o *RepoDeleteTopicNotFound) Error() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/topics/{topic}][%d] repoDeleteTopicNotFound", 404)
}
func (o *RepoDeleteTopicNotFound) String() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/topics/{topic}][%d] repoDeleteTopicNotFound", 404)
}
func (o *RepoDeleteTopicNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRepoDeleteTopicUnprocessableEntity creates a RepoDeleteTopicUnprocessableEntity with default headers values
func NewRepoDeleteTopicUnprocessableEntity() *RepoDeleteTopicUnprocessableEntity {
return &RepoDeleteTopicUnprocessableEntity{}
}
/*
RepoDeleteTopicUnprocessableEntity describes a response with status code 422, with default header values.
APIInvalidTopicsError is error format response to invalid topics
*/
type RepoDeleteTopicUnprocessableEntity struct {
InvalidTopics []string
Message string
}
// IsSuccess returns true when this repo delete topic unprocessable entity response has a 2xx status code
func (o *RepoDeleteTopicUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo delete topic unprocessable entity response has a 3xx status code
func (o *RepoDeleteTopicUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo delete topic unprocessable entity response has a 4xx status code
func (o *RepoDeleteTopicUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this repo delete topic unprocessable entity response has a 5xx status code
func (o *RepoDeleteTopicUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this repo delete topic unprocessable entity response a status code equal to that given
func (o *RepoDeleteTopicUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the repo delete topic unprocessable entity response
func (o *RepoDeleteTopicUnprocessableEntity) Code() int {
return 422
}
func (o *RepoDeleteTopicUnprocessableEntity) Error() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/topics/{topic}][%d] repoDeleteTopicUnprocessableEntity", 422)
}
func (o *RepoDeleteTopicUnprocessableEntity) String() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/topics/{topic}][%d] repoDeleteTopicUnprocessableEntity", 422)
}
func (o *RepoDeleteTopicUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header invalidTopics
hdrInvalidTopics := response.GetHeader("invalidTopics")
if hdrInvalidTopics != "" {
// binding header items for invalidTopics
valInvalidTopics, err := o.bindHeaderInvalidTopics(hdrInvalidTopics, formats)
if err != nil {
return err
}
o.InvalidTopics = valInvalidTopics
}
// hydrates response header message
hdrMessage := response.GetHeader("message")
if hdrMessage != "" {
o.Message = hdrMessage
}
return nil
}
// bindHeaderRepoDeleteTopicUnprocessableEntity binds the response header invalidTopics
func (o *RepoDeleteTopicUnprocessableEntity) bindHeaderInvalidTopics(hdr string, formats strfmt.Registry) ([]string, error) {
invalidTopicsIV := hdr
var (
invalidTopicsIC []string
)
// items.CollectionFormat: ""
invalidTopicsIR := swag.SplitByFormat(invalidTopicsIV, "")
for _, invalidTopicsIIV := range invalidTopicsIR {
// convert split string to string
invalidTopicsIIC := invalidTopicsIIV // string as string
invalidTopicsIC = append(invalidTopicsIC, invalidTopicsIIC) // roll-up string into []string
}
return invalidTopicsIC, nil
}