523 lines
16 KiB
Go
523 lines
16 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
// (c) 2012-2023 by Vernon Keenan
|
|
// All rights reserved worldwide.
|
|
// Proprietary product; unlicensed use is not allowed
|
|
|
|
package observations
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/strfmt"
|
|
|
|
"code.tnxs.net/work/lib/api/research/research_models"
|
|
)
|
|
|
|
// PostObservationsReader is a Reader for the PostObservations structure.
|
|
type PostObservationsReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *PostObservationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
case 200:
|
|
result := NewPostObservationsOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
case 401:
|
|
result := NewPostObservationsUnauthorized()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 403:
|
|
result := NewPostObservationsForbidden()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 404:
|
|
result := NewPostObservationsNotFound()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 422:
|
|
result := NewPostObservationsUnprocessableEntity()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
case 500:
|
|
result := NewPostObservationsInternalServerError()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
default:
|
|
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewPostObservationsOK creates a PostObservationsOK with default headers values
|
|
func NewPostObservationsOK() *PostObservationsOK {
|
|
return &PostObservationsOK{}
|
|
}
|
|
|
|
/*
|
|
PostObservationsOK describes a response with status code 200, with default header values.
|
|
|
|
Response with Observation objects
|
|
*/
|
|
type PostObservationsOK struct {
|
|
Payload *research_models.ObservationResponse
|
|
}
|
|
|
|
// IsSuccess returns true when this post observations o k response has a 2xx status code
|
|
func (o *PostObservationsOK) IsSuccess() bool {
|
|
return true
|
|
}
|
|
|
|
// IsRedirect returns true when this post observations o k response has a 3xx status code
|
|
func (o *PostObservationsOK) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this post observations o k response has a 4xx status code
|
|
func (o *PostObservationsOK) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this post observations o k response has a 5xx status code
|
|
func (o *PostObservationsOK) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this post observations o k response a status code equal to that given
|
|
func (o *PostObservationsOK) IsCode(code int) bool {
|
|
return code == 200
|
|
}
|
|
|
|
// Code gets the status code for the post observations o k response
|
|
func (o *PostObservationsOK) Code() int {
|
|
return 200
|
|
}
|
|
|
|
func (o *PostObservationsOK) Error() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsOK %+v", 200, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsOK) String() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsOK %+v", 200, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsOK) GetPayload() *research_models.ObservationResponse {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *PostObservationsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(research_models.ObservationResponse)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPostObservationsUnauthorized creates a PostObservationsUnauthorized with default headers values
|
|
func NewPostObservationsUnauthorized() *PostObservationsUnauthorized {
|
|
return &PostObservationsUnauthorized{}
|
|
}
|
|
|
|
/*
|
|
PostObservationsUnauthorized describes a response with status code 401, with default header values.
|
|
|
|
Access unauthorized, invalid API-KEY was used
|
|
*/
|
|
type PostObservationsUnauthorized struct {
|
|
AccessControlAllowOrigin string
|
|
|
|
Payload *research_models.Error
|
|
}
|
|
|
|
// IsSuccess returns true when this post observations unauthorized response has a 2xx status code
|
|
func (o *PostObservationsUnauthorized) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this post observations unauthorized response has a 3xx status code
|
|
func (o *PostObservationsUnauthorized) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this post observations unauthorized response has a 4xx status code
|
|
func (o *PostObservationsUnauthorized) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this post observations unauthorized response has a 5xx status code
|
|
func (o *PostObservationsUnauthorized) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this post observations unauthorized response a status code equal to that given
|
|
func (o *PostObservationsUnauthorized) IsCode(code int) bool {
|
|
return code == 401
|
|
}
|
|
|
|
// Code gets the status code for the post observations unauthorized response
|
|
func (o *PostObservationsUnauthorized) Code() int {
|
|
return 401
|
|
}
|
|
|
|
func (o *PostObservationsUnauthorized) Error() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsUnauthorized %+v", 401, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsUnauthorized) String() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsUnauthorized %+v", 401, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsUnauthorized) GetPayload() *research_models.Error {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *PostObservationsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header Access-Control-Allow-Origin
|
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
|
|
|
if hdrAccessControlAllowOrigin != "" {
|
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
|
}
|
|
|
|
o.Payload = new(research_models.Error)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPostObservationsForbidden creates a PostObservationsForbidden with default headers values
|
|
func NewPostObservationsForbidden() *PostObservationsForbidden {
|
|
return &PostObservationsForbidden{}
|
|
}
|
|
|
|
/*
|
|
PostObservationsForbidden describes a response with status code 403, with default header values.
|
|
|
|
Access forbidden, account lacks access
|
|
*/
|
|
type PostObservationsForbidden struct {
|
|
AccessControlAllowOrigin string
|
|
|
|
Payload *research_models.Error
|
|
}
|
|
|
|
// IsSuccess returns true when this post observations forbidden response has a 2xx status code
|
|
func (o *PostObservationsForbidden) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this post observations forbidden response has a 3xx status code
|
|
func (o *PostObservationsForbidden) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this post observations forbidden response has a 4xx status code
|
|
func (o *PostObservationsForbidden) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this post observations forbidden response has a 5xx status code
|
|
func (o *PostObservationsForbidden) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this post observations forbidden response a status code equal to that given
|
|
func (o *PostObservationsForbidden) IsCode(code int) bool {
|
|
return code == 403
|
|
}
|
|
|
|
// Code gets the status code for the post observations forbidden response
|
|
func (o *PostObservationsForbidden) Code() int {
|
|
return 403
|
|
}
|
|
|
|
func (o *PostObservationsForbidden) Error() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsForbidden %+v", 403, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsForbidden) String() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsForbidden %+v", 403, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsForbidden) GetPayload() *research_models.Error {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *PostObservationsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header Access-Control-Allow-Origin
|
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
|
|
|
if hdrAccessControlAllowOrigin != "" {
|
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
|
}
|
|
|
|
o.Payload = new(research_models.Error)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPostObservationsNotFound creates a PostObservationsNotFound with default headers values
|
|
func NewPostObservationsNotFound() *PostObservationsNotFound {
|
|
return &PostObservationsNotFound{}
|
|
}
|
|
|
|
/*
|
|
PostObservationsNotFound describes a response with status code 404, with default header values.
|
|
|
|
Resource was not found
|
|
*/
|
|
type PostObservationsNotFound struct {
|
|
AccessControlAllowOrigin string
|
|
|
|
Payload *research_models.Error
|
|
}
|
|
|
|
// IsSuccess returns true when this post observations not found response has a 2xx status code
|
|
func (o *PostObservationsNotFound) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this post observations not found response has a 3xx status code
|
|
func (o *PostObservationsNotFound) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this post observations not found response has a 4xx status code
|
|
func (o *PostObservationsNotFound) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this post observations not found response has a 5xx status code
|
|
func (o *PostObservationsNotFound) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this post observations not found response a status code equal to that given
|
|
func (o *PostObservationsNotFound) IsCode(code int) bool {
|
|
return code == 404
|
|
}
|
|
|
|
// Code gets the status code for the post observations not found response
|
|
func (o *PostObservationsNotFound) Code() int {
|
|
return 404
|
|
}
|
|
|
|
func (o *PostObservationsNotFound) Error() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsNotFound %+v", 404, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsNotFound) String() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsNotFound %+v", 404, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsNotFound) GetPayload() *research_models.Error {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *PostObservationsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header Access-Control-Allow-Origin
|
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
|
|
|
if hdrAccessControlAllowOrigin != "" {
|
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
|
}
|
|
|
|
o.Payload = new(research_models.Error)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPostObservationsUnprocessableEntity creates a PostObservationsUnprocessableEntity with default headers values
|
|
func NewPostObservationsUnprocessableEntity() *PostObservationsUnprocessableEntity {
|
|
return &PostObservationsUnprocessableEntity{}
|
|
}
|
|
|
|
/*
|
|
PostObservationsUnprocessableEntity describes a response with status code 422, with default header values.
|
|
|
|
Unprocessable Entity, likely a bad parameter
|
|
*/
|
|
type PostObservationsUnprocessableEntity struct {
|
|
AccessControlAllowOrigin string
|
|
|
|
Payload *research_models.Error
|
|
}
|
|
|
|
// IsSuccess returns true when this post observations unprocessable entity response has a 2xx status code
|
|
func (o *PostObservationsUnprocessableEntity) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this post observations unprocessable entity response has a 3xx status code
|
|
func (o *PostObservationsUnprocessableEntity) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this post observations unprocessable entity response has a 4xx status code
|
|
func (o *PostObservationsUnprocessableEntity) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this post observations unprocessable entity response has a 5xx status code
|
|
func (o *PostObservationsUnprocessableEntity) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this post observations unprocessable entity response a status code equal to that given
|
|
func (o *PostObservationsUnprocessableEntity) IsCode(code int) bool {
|
|
return code == 422
|
|
}
|
|
|
|
// Code gets the status code for the post observations unprocessable entity response
|
|
func (o *PostObservationsUnprocessableEntity) Code() int {
|
|
return 422
|
|
}
|
|
|
|
func (o *PostObservationsUnprocessableEntity) Error() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsUnprocessableEntity %+v", 422, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsUnprocessableEntity) String() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsUnprocessableEntity %+v", 422, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsUnprocessableEntity) GetPayload() *research_models.Error {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *PostObservationsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header Access-Control-Allow-Origin
|
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
|
|
|
if hdrAccessControlAllowOrigin != "" {
|
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
|
}
|
|
|
|
o.Payload = new(research_models.Error)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewPostObservationsInternalServerError creates a PostObservationsInternalServerError with default headers values
|
|
func NewPostObservationsInternalServerError() *PostObservationsInternalServerError {
|
|
return &PostObservationsInternalServerError{}
|
|
}
|
|
|
|
/*
|
|
PostObservationsInternalServerError describes a response with status code 500, with default header values.
|
|
|
|
Server Internal Error
|
|
*/
|
|
type PostObservationsInternalServerError struct {
|
|
AccessControlAllowOrigin string
|
|
|
|
Payload *research_models.Error
|
|
}
|
|
|
|
// IsSuccess returns true when this post observations internal server error response has a 2xx status code
|
|
func (o *PostObservationsInternalServerError) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this post observations internal server error response has a 3xx status code
|
|
func (o *PostObservationsInternalServerError) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this post observations internal server error response has a 4xx status code
|
|
func (o *PostObservationsInternalServerError) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this post observations internal server error response has a 5xx status code
|
|
func (o *PostObservationsInternalServerError) IsServerError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsCode returns true when this post observations internal server error response a status code equal to that given
|
|
func (o *PostObservationsInternalServerError) IsCode(code int) bool {
|
|
return code == 500
|
|
}
|
|
|
|
// Code gets the status code for the post observations internal server error response
|
|
func (o *PostObservationsInternalServerError) Code() int {
|
|
return 500
|
|
}
|
|
|
|
func (o *PostObservationsInternalServerError) Error() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsInternalServerError %+v", 500, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsInternalServerError) String() string {
|
|
return fmt.Sprintf("[POST /observations][%d] postObservationsInternalServerError %+v", 500, o.Payload)
|
|
}
|
|
|
|
func (o *PostObservationsInternalServerError) GetPayload() *research_models.Error {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *PostObservationsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
// hydrates response header Access-Control-Allow-Origin
|
|
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
|
|
|
|
if hdrAccessControlAllowOrigin != "" {
|
|
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
|
|
}
|
|
|
|
o.Payload = new(research_models.Error)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|