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

323 lines
9.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"
)
// UserTrackedTimesReader is a Reader for the UserTrackedTimes structure.
type UserTrackedTimesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *UserTrackedTimesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewUserTrackedTimesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewUserTrackedTimesBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewUserTrackedTimesForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewUserTrackedTimesNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /repos/{owner}/{repo}/times/{user}] userTrackedTimes", response, response.Code())
}
}
// NewUserTrackedTimesOK creates a UserTrackedTimesOK with default headers values
func NewUserTrackedTimesOK() *UserTrackedTimesOK {
return &UserTrackedTimesOK{}
}
/*
UserTrackedTimesOK describes a response with status code 200, with default header values.
TrackedTimeList
*/
type UserTrackedTimesOK struct {
Payload []*models.TrackedTime
}
// IsSuccess returns true when this user tracked times o k response has a 2xx status code
func (o *UserTrackedTimesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this user tracked times o k response has a 3xx status code
func (o *UserTrackedTimesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this user tracked times o k response has a 4xx status code
func (o *UserTrackedTimesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this user tracked times o k response has a 5xx status code
func (o *UserTrackedTimesOK) IsServerError() bool {
return false
}
// IsCode returns true when this user tracked times o k response a status code equal to that given
func (o *UserTrackedTimesOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the user tracked times o k response
func (o *UserTrackedTimesOK) Code() int {
return 200
}
func (o *UserTrackedTimesOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesOK %s", 200, payload)
}
func (o *UserTrackedTimesOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesOK %s", 200, payload)
}
func (o *UserTrackedTimesOK) GetPayload() []*models.TrackedTime {
return o.Payload
}
func (o *UserTrackedTimesOK) 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
}
// NewUserTrackedTimesBadRequest creates a UserTrackedTimesBadRequest with default headers values
func NewUserTrackedTimesBadRequest() *UserTrackedTimesBadRequest {
return &UserTrackedTimesBadRequest{}
}
/*
UserTrackedTimesBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type UserTrackedTimesBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this user tracked times bad request response has a 2xx status code
func (o *UserTrackedTimesBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this user tracked times bad request response has a 3xx status code
func (o *UserTrackedTimesBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this user tracked times bad request response has a 4xx status code
func (o *UserTrackedTimesBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this user tracked times bad request response has a 5xx status code
func (o *UserTrackedTimesBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this user tracked times bad request response a status code equal to that given
func (o *UserTrackedTimesBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the user tracked times bad request response
func (o *UserTrackedTimesBadRequest) Code() int {
return 400
}
func (o *UserTrackedTimesBadRequest) Error() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesBadRequest", 400)
}
func (o *UserTrackedTimesBadRequest) String() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesBadRequest", 400)
}
func (o *UserTrackedTimesBadRequest) 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
}
// NewUserTrackedTimesForbidden creates a UserTrackedTimesForbidden with default headers values
func NewUserTrackedTimesForbidden() *UserTrackedTimesForbidden {
return &UserTrackedTimesForbidden{}
}
/*
UserTrackedTimesForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type UserTrackedTimesForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this user tracked times forbidden response has a 2xx status code
func (o *UserTrackedTimesForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this user tracked times forbidden response has a 3xx status code
func (o *UserTrackedTimesForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this user tracked times forbidden response has a 4xx status code
func (o *UserTrackedTimesForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this user tracked times forbidden response has a 5xx status code
func (o *UserTrackedTimesForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this user tracked times forbidden response a status code equal to that given
func (o *UserTrackedTimesForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the user tracked times forbidden response
func (o *UserTrackedTimesForbidden) Code() int {
return 403
}
func (o *UserTrackedTimesForbidden) Error() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesForbidden", 403)
}
func (o *UserTrackedTimesForbidden) String() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesForbidden", 403)
}
func (o *UserTrackedTimesForbidden) 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
}
// NewUserTrackedTimesNotFound creates a UserTrackedTimesNotFound with default headers values
func NewUserTrackedTimesNotFound() *UserTrackedTimesNotFound {
return &UserTrackedTimesNotFound{}
}
/*
UserTrackedTimesNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type UserTrackedTimesNotFound struct {
}
// IsSuccess returns true when this user tracked times not found response has a 2xx status code
func (o *UserTrackedTimesNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this user tracked times not found response has a 3xx status code
func (o *UserTrackedTimesNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this user tracked times not found response has a 4xx status code
func (o *UserTrackedTimesNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this user tracked times not found response has a 5xx status code
func (o *UserTrackedTimesNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this user tracked times not found response a status code equal to that given
func (o *UserTrackedTimesNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the user tracked times not found response
func (o *UserTrackedTimesNotFound) Code() int {
return 404
}
func (o *UserTrackedTimesNotFound) Error() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesNotFound", 404)
}
func (o *UserTrackedTimesNotFound) String() string {
return fmt.Sprintf("[GET /repos/{owner}/{repo}/times/{user}][%d] userTrackedTimesNotFound", 404)
}
func (o *UserTrackedTimesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}