All checks were successful
continuous-integration/drone/push Build is passing
479 lines
13 KiB
Go
479 lines
13 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package polls
|
|
|
|
// 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"
|
|
|
|
"git.coopcloud.tech/decentral1se/gtslib/models"
|
|
)
|
|
|
|
// PollReader is a Reader for the Poll structure.
|
|
type PollReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *PollReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
case 200:
|
|
result := NewPollOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
case 400:
|
|
result := NewPollBadRequest()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 401:
|
|
result := NewPollUnauthorized()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 403:
|
|
result := NewPollForbidden()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 404:
|
|
result := NewPollNotFound()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 406:
|
|
result := NewPollNotAcceptable()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 500:
|
|
result := NewPollInternalServerError()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
default:
|
|
return nil, runtime.NewAPIError("[GET /api/v1/polls/{id}] poll", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewPollOK creates a PollOK with default headers values
|
|
func NewPollOK() *PollOK {
|
|
return &PollOK{}
|
|
}
|
|
|
|
/*
|
|
PollOK describes a response with status code 200, with default header values.
|
|
|
|
The requested poll.
|
|
*/
|
|
type PollOK struct {
|
|
Payload *models.Poll
|
|
}
|
|
|
|
// IsSuccess returns true when this poll o k response has a 2xx status code
|
|
func (o *PollOK) IsSuccess() bool {
|
|
return true
|
|
}
|
|
|
|
// IsRedirect returns true when this poll o k response has a 3xx status code
|
|
func (o *PollOK) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this poll o k response has a 4xx status code
|
|
func (o *PollOK) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this poll o k response has a 5xx status code
|
|
func (o *PollOK) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this poll o k response a status code equal to that given
|
|
func (o *PollOK) IsCode(code int) bool {
|
|
return code == 200
|
|
}
|
|
|
|
// Code gets the status code for the poll o k response
|
|
func (o *PollOK) Code() int {
|
|
return 200
|
|
}
|
|
|
|
func (o *PollOK) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *PollOK) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *PollOK) GetPayload() *models.Poll {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *PollOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(models.Poll)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPollBadRequest creates a PollBadRequest with default headers values
|
|
func NewPollBadRequest() *PollBadRequest {
|
|
return &PollBadRequest{}
|
|
}
|
|
|
|
/*
|
|
PollBadRequest describes a response with status code 400, with default header values.
|
|
|
|
bad request
|
|
*/
|
|
type PollBadRequest struct {
|
|
}
|
|
|
|
// IsSuccess returns true when this poll bad request response has a 2xx status code
|
|
func (o *PollBadRequest) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this poll bad request response has a 3xx status code
|
|
func (o *PollBadRequest) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this poll bad request response has a 4xx status code
|
|
func (o *PollBadRequest) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this poll bad request response has a 5xx status code
|
|
func (o *PollBadRequest) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this poll bad request response a status code equal to that given
|
|
func (o *PollBadRequest) IsCode(code int) bool {
|
|
return code == 400
|
|
}
|
|
|
|
// Code gets the status code for the poll bad request response
|
|
func (o *PollBadRequest) Code() int {
|
|
return 400
|
|
}
|
|
|
|
func (o *PollBadRequest) Error() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollBadRequest", 400)
|
|
}
|
|
|
|
func (o *PollBadRequest) String() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollBadRequest", 400)
|
|
}
|
|
|
|
func (o *PollBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPollUnauthorized creates a PollUnauthorized with default headers values
|
|
func NewPollUnauthorized() *PollUnauthorized {
|
|
return &PollUnauthorized{}
|
|
}
|
|
|
|
/*
|
|
PollUnauthorized describes a response with status code 401, with default header values.
|
|
|
|
unauthorized
|
|
*/
|
|
type PollUnauthorized struct {
|
|
}
|
|
|
|
// IsSuccess returns true when this poll unauthorized response has a 2xx status code
|
|
func (o *PollUnauthorized) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this poll unauthorized response has a 3xx status code
|
|
func (o *PollUnauthorized) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this poll unauthorized response has a 4xx status code
|
|
func (o *PollUnauthorized) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this poll unauthorized response has a 5xx status code
|
|
func (o *PollUnauthorized) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this poll unauthorized response a status code equal to that given
|
|
func (o *PollUnauthorized) IsCode(code int) bool {
|
|
return code == 401
|
|
}
|
|
|
|
// Code gets the status code for the poll unauthorized response
|
|
func (o *PollUnauthorized) Code() int {
|
|
return 401
|
|
}
|
|
|
|
func (o *PollUnauthorized) Error() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollUnauthorized", 401)
|
|
}
|
|
|
|
func (o *PollUnauthorized) String() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollUnauthorized", 401)
|
|
}
|
|
|
|
func (o *PollUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPollForbidden creates a PollForbidden with default headers values
|
|
func NewPollForbidden() *PollForbidden {
|
|
return &PollForbidden{}
|
|
}
|
|
|
|
/*
|
|
PollForbidden describes a response with status code 403, with default header values.
|
|
|
|
forbidden
|
|
*/
|
|
type PollForbidden struct {
|
|
}
|
|
|
|
// IsSuccess returns true when this poll forbidden response has a 2xx status code
|
|
func (o *PollForbidden) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this poll forbidden response has a 3xx status code
|
|
func (o *PollForbidden) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this poll forbidden response has a 4xx status code
|
|
func (o *PollForbidden) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this poll forbidden response has a 5xx status code
|
|
func (o *PollForbidden) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this poll forbidden response a status code equal to that given
|
|
func (o *PollForbidden) IsCode(code int) bool {
|
|
return code == 403
|
|
}
|
|
|
|
// Code gets the status code for the poll forbidden response
|
|
func (o *PollForbidden) Code() int {
|
|
return 403
|
|
}
|
|
|
|
func (o *PollForbidden) Error() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollForbidden", 403)
|
|
}
|
|
|
|
func (o *PollForbidden) String() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollForbidden", 403)
|
|
}
|
|
|
|
func (o *PollForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPollNotFound creates a PollNotFound with default headers values
|
|
func NewPollNotFound() *PollNotFound {
|
|
return &PollNotFound{}
|
|
}
|
|
|
|
/*
|
|
PollNotFound describes a response with status code 404, with default header values.
|
|
|
|
not found
|
|
*/
|
|
type PollNotFound struct {
|
|
}
|
|
|
|
// IsSuccess returns true when this poll not found response has a 2xx status code
|
|
func (o *PollNotFound) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this poll not found response has a 3xx status code
|
|
func (o *PollNotFound) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this poll not found response has a 4xx status code
|
|
func (o *PollNotFound) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this poll not found response has a 5xx status code
|
|
func (o *PollNotFound) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this poll not found response a status code equal to that given
|
|
func (o *PollNotFound) IsCode(code int) bool {
|
|
return code == 404
|
|
}
|
|
|
|
// Code gets the status code for the poll not found response
|
|
func (o *PollNotFound) Code() int {
|
|
return 404
|
|
}
|
|
|
|
func (o *PollNotFound) Error() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotFound", 404)
|
|
}
|
|
|
|
func (o *PollNotFound) String() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotFound", 404)
|
|
}
|
|
|
|
func (o *PollNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPollNotAcceptable creates a PollNotAcceptable with default headers values
|
|
func NewPollNotAcceptable() *PollNotAcceptable {
|
|
return &PollNotAcceptable{}
|
|
}
|
|
|
|
/*
|
|
PollNotAcceptable describes a response with status code 406, with default header values.
|
|
|
|
not acceptable
|
|
*/
|
|
type PollNotAcceptable struct {
|
|
}
|
|
|
|
// IsSuccess returns true when this poll not acceptable response has a 2xx status code
|
|
func (o *PollNotAcceptable) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this poll not acceptable response has a 3xx status code
|
|
func (o *PollNotAcceptable) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this poll not acceptable response has a 4xx status code
|
|
func (o *PollNotAcceptable) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this poll not acceptable response has a 5xx status code
|
|
func (o *PollNotAcceptable) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this poll not acceptable response a status code equal to that given
|
|
func (o *PollNotAcceptable) IsCode(code int) bool {
|
|
return code == 406
|
|
}
|
|
|
|
// Code gets the status code for the poll not acceptable response
|
|
func (o *PollNotAcceptable) Code() int {
|
|
return 406
|
|
}
|
|
|
|
func (o *PollNotAcceptable) Error() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotAcceptable", 406)
|
|
}
|
|
|
|
func (o *PollNotAcceptable) String() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotAcceptable", 406)
|
|
}
|
|
|
|
func (o *PollNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPollInternalServerError creates a PollInternalServerError with default headers values
|
|
func NewPollInternalServerError() *PollInternalServerError {
|
|
return &PollInternalServerError{}
|
|
}
|
|
|
|
/*
|
|
PollInternalServerError describes a response with status code 500, with default header values.
|
|
|
|
internal server error
|
|
*/
|
|
type PollInternalServerError struct {
|
|
}
|
|
|
|
// IsSuccess returns true when this poll internal server error response has a 2xx status code
|
|
func (o *PollInternalServerError) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this poll internal server error response has a 3xx status code
|
|
func (o *PollInternalServerError) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this poll internal server error response has a 4xx status code
|
|
func (o *PollInternalServerError) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this poll internal server error response has a 5xx status code
|
|
func (o *PollInternalServerError) IsServerError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsCode returns true when this poll internal server error response a status code equal to that given
|
|
func (o *PollInternalServerError) IsCode(code int) bool {
|
|
return code == 500
|
|
}
|
|
|
|
// Code gets the status code for the poll internal server error response
|
|
func (o *PollInternalServerError) Code() int {
|
|
return 500
|
|
}
|
|
|
|
func (o *PollInternalServerError) Error() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollInternalServerError", 500)
|
|
}
|
|
|
|
func (o *PollInternalServerError) String() string {
|
|
return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollInternalServerError", 500)
|
|
}
|
|
|
|
func (o *PollInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|