Files
gtslib/client/polls/poll_vote_responses.go
decentral1se e4ade9c758
All checks were successful
continuous-integration/drone/push Build is passing
feat: init
2024-07-31 22:47:18 +02:00

541 lines
16 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"
)
// PollVoteReader is a Reader for the PollVote structure.
type PollVoteReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PollVoteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPollVoteOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewPollVoteBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 401:
result := NewPollVoteUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewPollVoteForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPollVoteNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 406:
result := NewPollVoteNotAcceptable()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewPollVoteUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPollVoteInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /api/v1/polls/{id}/votes] pollVote", response, response.Code())
}
}
// NewPollVoteOK creates a PollVoteOK with default headers values
func NewPollVoteOK() *PollVoteOK {
return &PollVoteOK{}
}
/*
PollVoteOK describes a response with status code 200, with default header values.
The updated poll with user vote choices.
*/
type PollVoteOK struct {
Payload *models.Poll
}
// IsSuccess returns true when this poll vote o k response has a 2xx status code
func (o *PollVoteOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this poll vote o k response has a 3xx status code
func (o *PollVoteOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote o k response has a 4xx status code
func (o *PollVoteOK) IsClientError() bool {
return false
}
// IsServerError returns true when this poll vote o k response has a 5xx status code
func (o *PollVoteOK) IsServerError() bool {
return false
}
// IsCode returns true when this poll vote o k response a status code equal to that given
func (o *PollVoteOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the poll vote o k response
func (o *PollVoteOK) Code() int {
return 200
}
func (o *PollVoteOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteOK %s", 200, payload)
}
func (o *PollVoteOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteOK %s", 200, payload)
}
func (o *PollVoteOK) GetPayload() *models.Poll {
return o.Payload
}
func (o *PollVoteOK) 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
}
// NewPollVoteBadRequest creates a PollVoteBadRequest with default headers values
func NewPollVoteBadRequest() *PollVoteBadRequest {
return &PollVoteBadRequest{}
}
/*
PollVoteBadRequest describes a response with status code 400, with default header values.
bad request
*/
type PollVoteBadRequest struct {
}
// IsSuccess returns true when this poll vote bad request response has a 2xx status code
func (o *PollVoteBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this poll vote bad request response has a 3xx status code
func (o *PollVoteBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote bad request response has a 4xx status code
func (o *PollVoteBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this poll vote bad request response has a 5xx status code
func (o *PollVoteBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this poll vote bad request response a status code equal to that given
func (o *PollVoteBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the poll vote bad request response
func (o *PollVoteBadRequest) Code() int {
return 400
}
func (o *PollVoteBadRequest) Error() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteBadRequest", 400)
}
func (o *PollVoteBadRequest) String() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteBadRequest", 400)
}
func (o *PollVoteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPollVoteUnauthorized creates a PollVoteUnauthorized with default headers values
func NewPollVoteUnauthorized() *PollVoteUnauthorized {
return &PollVoteUnauthorized{}
}
/*
PollVoteUnauthorized describes a response with status code 401, with default header values.
unauthorized
*/
type PollVoteUnauthorized struct {
}
// IsSuccess returns true when this poll vote unauthorized response has a 2xx status code
func (o *PollVoteUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this poll vote unauthorized response has a 3xx status code
func (o *PollVoteUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote unauthorized response has a 4xx status code
func (o *PollVoteUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this poll vote unauthorized response has a 5xx status code
func (o *PollVoteUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this poll vote unauthorized response a status code equal to that given
func (o *PollVoteUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the poll vote unauthorized response
func (o *PollVoteUnauthorized) Code() int {
return 401
}
func (o *PollVoteUnauthorized) Error() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnauthorized", 401)
}
func (o *PollVoteUnauthorized) String() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnauthorized", 401)
}
func (o *PollVoteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPollVoteForbidden creates a PollVoteForbidden with default headers values
func NewPollVoteForbidden() *PollVoteForbidden {
return &PollVoteForbidden{}
}
/*
PollVoteForbidden describes a response with status code 403, with default header values.
forbidden
*/
type PollVoteForbidden struct {
}
// IsSuccess returns true when this poll vote forbidden response has a 2xx status code
func (o *PollVoteForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this poll vote forbidden response has a 3xx status code
func (o *PollVoteForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote forbidden response has a 4xx status code
func (o *PollVoteForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this poll vote forbidden response has a 5xx status code
func (o *PollVoteForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this poll vote forbidden response a status code equal to that given
func (o *PollVoteForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the poll vote forbidden response
func (o *PollVoteForbidden) Code() int {
return 403
}
func (o *PollVoteForbidden) Error() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteForbidden", 403)
}
func (o *PollVoteForbidden) String() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteForbidden", 403)
}
func (o *PollVoteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPollVoteNotFound creates a PollVoteNotFound with default headers values
func NewPollVoteNotFound() *PollVoteNotFound {
return &PollVoteNotFound{}
}
/*
PollVoteNotFound describes a response with status code 404, with default header values.
not found
*/
type PollVoteNotFound struct {
}
// IsSuccess returns true when this poll vote not found response has a 2xx status code
func (o *PollVoteNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this poll vote not found response has a 3xx status code
func (o *PollVoteNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote not found response has a 4xx status code
func (o *PollVoteNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this poll vote not found response has a 5xx status code
func (o *PollVoteNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this poll vote not found response a status code equal to that given
func (o *PollVoteNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the poll vote not found response
func (o *PollVoteNotFound) Code() int {
return 404
}
func (o *PollVoteNotFound) Error() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotFound", 404)
}
func (o *PollVoteNotFound) String() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotFound", 404)
}
func (o *PollVoteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPollVoteNotAcceptable creates a PollVoteNotAcceptable with default headers values
func NewPollVoteNotAcceptable() *PollVoteNotAcceptable {
return &PollVoteNotAcceptable{}
}
/*
PollVoteNotAcceptable describes a response with status code 406, with default header values.
not acceptable
*/
type PollVoteNotAcceptable struct {
}
// IsSuccess returns true when this poll vote not acceptable response has a 2xx status code
func (o *PollVoteNotAcceptable) IsSuccess() bool {
return false
}
// IsRedirect returns true when this poll vote not acceptable response has a 3xx status code
func (o *PollVoteNotAcceptable) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote not acceptable response has a 4xx status code
func (o *PollVoteNotAcceptable) IsClientError() bool {
return true
}
// IsServerError returns true when this poll vote not acceptable response has a 5xx status code
func (o *PollVoteNotAcceptable) IsServerError() bool {
return false
}
// IsCode returns true when this poll vote not acceptable response a status code equal to that given
func (o *PollVoteNotAcceptable) IsCode(code int) bool {
return code == 406
}
// Code gets the status code for the poll vote not acceptable response
func (o *PollVoteNotAcceptable) Code() int {
return 406
}
func (o *PollVoteNotAcceptable) Error() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotAcceptable", 406)
}
func (o *PollVoteNotAcceptable) String() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotAcceptable", 406)
}
func (o *PollVoteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPollVoteUnprocessableEntity creates a PollVoteUnprocessableEntity with default headers values
func NewPollVoteUnprocessableEntity() *PollVoteUnprocessableEntity {
return &PollVoteUnprocessableEntity{}
}
/*
PollVoteUnprocessableEntity describes a response with status code 422, with default header values.
unprocessable entity
*/
type PollVoteUnprocessableEntity struct {
}
// IsSuccess returns true when this poll vote unprocessable entity response has a 2xx status code
func (o *PollVoteUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this poll vote unprocessable entity response has a 3xx status code
func (o *PollVoteUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote unprocessable entity response has a 4xx status code
func (o *PollVoteUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this poll vote unprocessable entity response has a 5xx status code
func (o *PollVoteUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this poll vote unprocessable entity response a status code equal to that given
func (o *PollVoteUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the poll vote unprocessable entity response
func (o *PollVoteUnprocessableEntity) Code() int {
return 422
}
func (o *PollVoteUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnprocessableEntity", 422)
}
func (o *PollVoteUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnprocessableEntity", 422)
}
func (o *PollVoteUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPollVoteInternalServerError creates a PollVoteInternalServerError with default headers values
func NewPollVoteInternalServerError() *PollVoteInternalServerError {
return &PollVoteInternalServerError{}
}
/*
PollVoteInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type PollVoteInternalServerError struct {
}
// IsSuccess returns true when this poll vote internal server error response has a 2xx status code
func (o *PollVoteInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this poll vote internal server error response has a 3xx status code
func (o *PollVoteInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this poll vote internal server error response has a 4xx status code
func (o *PollVoteInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this poll vote internal server error response has a 5xx status code
func (o *PollVoteInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this poll vote internal server error response a status code equal to that given
func (o *PollVoteInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the poll vote internal server error response
func (o *PollVoteInternalServerError) Code() int {
return 500
}
func (o *PollVoteInternalServerError) Error() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteInternalServerError", 500)
}
func (o *PollVoteInternalServerError) String() string {
return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteInternalServerError", 500)
}
func (o *PollVoteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}