Files
autogits/common/gitea-generated/client/repository/repo_merge_upstream_responses.go
2025-05-26 16:55:15 +02:00

247 lines
7.5 KiB
Go

// 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"
)
// RepoMergeUpstreamReader is a Reader for the RepoMergeUpstream structure.
type RepoMergeUpstreamReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RepoMergeUpstreamReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRepoMergeUpstreamOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewRepoMergeUpstreamBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewRepoMergeUpstreamNotFound()
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}/merge-upstream] repoMergeUpstream", response, response.Code())
}
}
// NewRepoMergeUpstreamOK creates a RepoMergeUpstreamOK with default headers values
func NewRepoMergeUpstreamOK() *RepoMergeUpstreamOK {
return &RepoMergeUpstreamOK{}
}
/*
RepoMergeUpstreamOK describes a response with status code 200, with default header values.
RepoMergeUpstreamOK repo merge upstream o k
*/
type RepoMergeUpstreamOK struct {
Payload *models.MergeUpstreamResponse
}
// IsSuccess returns true when this repo merge upstream o k response has a 2xx status code
func (o *RepoMergeUpstreamOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this repo merge upstream o k response has a 3xx status code
func (o *RepoMergeUpstreamOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo merge upstream o k response has a 4xx status code
func (o *RepoMergeUpstreamOK) IsClientError() bool {
return false
}
// IsServerError returns true when this repo merge upstream o k response has a 5xx status code
func (o *RepoMergeUpstreamOK) IsServerError() bool {
return false
}
// IsCode returns true when this repo merge upstream o k response a status code equal to that given
func (o *RepoMergeUpstreamOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the repo merge upstream o k response
func (o *RepoMergeUpstreamOK) Code() int {
return 200
}
func (o *RepoMergeUpstreamOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/merge-upstream][%d] repoMergeUpstreamOK %s", 200, payload)
}
func (o *RepoMergeUpstreamOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repos/{owner}/{repo}/merge-upstream][%d] repoMergeUpstreamOK %s", 200, payload)
}
func (o *RepoMergeUpstreamOK) GetPayload() *models.MergeUpstreamResponse {
return o.Payload
}
func (o *RepoMergeUpstreamOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.MergeUpstreamResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewRepoMergeUpstreamBadRequest creates a RepoMergeUpstreamBadRequest with default headers values
func NewRepoMergeUpstreamBadRequest() *RepoMergeUpstreamBadRequest {
return &RepoMergeUpstreamBadRequest{}
}
/*
RepoMergeUpstreamBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type RepoMergeUpstreamBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this repo merge upstream bad request response has a 2xx status code
func (o *RepoMergeUpstreamBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo merge upstream bad request response has a 3xx status code
func (o *RepoMergeUpstreamBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo merge upstream bad request response has a 4xx status code
func (o *RepoMergeUpstreamBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this repo merge upstream bad request response has a 5xx status code
func (o *RepoMergeUpstreamBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this repo merge upstream bad request response a status code equal to that given
func (o *RepoMergeUpstreamBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the repo merge upstream bad request response
func (o *RepoMergeUpstreamBadRequest) Code() int {
return 400
}
func (o *RepoMergeUpstreamBadRequest) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/merge-upstream][%d] repoMergeUpstreamBadRequest", 400)
}
func (o *RepoMergeUpstreamBadRequest) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/merge-upstream][%d] repoMergeUpstreamBadRequest", 400)
}
func (o *RepoMergeUpstreamBadRequest) 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
}
// NewRepoMergeUpstreamNotFound creates a RepoMergeUpstreamNotFound with default headers values
func NewRepoMergeUpstreamNotFound() *RepoMergeUpstreamNotFound {
return &RepoMergeUpstreamNotFound{}
}
/*
RepoMergeUpstreamNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type RepoMergeUpstreamNotFound struct {
}
// IsSuccess returns true when this repo merge upstream not found response has a 2xx status code
func (o *RepoMergeUpstreamNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this repo merge upstream not found response has a 3xx status code
func (o *RepoMergeUpstreamNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this repo merge upstream not found response has a 4xx status code
func (o *RepoMergeUpstreamNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this repo merge upstream not found response has a 5xx status code
func (o *RepoMergeUpstreamNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this repo merge upstream not found response a status code equal to that given
func (o *RepoMergeUpstreamNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the repo merge upstream not found response
func (o *RepoMergeUpstreamNotFound) Code() int {
return 404
}
func (o *RepoMergeUpstreamNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/merge-upstream][%d] repoMergeUpstreamNotFound", 404)
}
func (o *RepoMergeUpstreamNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/merge-upstream][%d] repoMergeUpstreamNotFound", 404)
}
func (o *RepoMergeUpstreamNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}