385 lines
10 KiB
Go
385 lines
10 KiB
Go
package universe
|
|
|
|
// 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/errors"
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
)
|
|
|
|
// PostUniverseNamesReader is a Reader for the PostUniverseNames structure.
|
|
type PostUniverseNamesReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *PostUniverseNamesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
|
|
case 200:
|
|
result := NewPostUniverseNamesOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
|
|
case 404:
|
|
result := NewPostUniverseNamesNotFound()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
|
|
case 500:
|
|
result := NewPostUniverseNamesInternalServerError()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
|
|
default:
|
|
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewPostUniverseNamesOK creates a PostUniverseNamesOK with default headers values
|
|
func NewPostUniverseNamesOK() *PostUniverseNamesOK {
|
|
return &PostUniverseNamesOK{}
|
|
}
|
|
|
|
/*PostUniverseNamesOK handles this case with default header values.
|
|
|
|
List of id/name associations for a set of ID's. ID's that cannot be resolved are not returned.
|
|
*/
|
|
type PostUniverseNamesOK struct {
|
|
Payload []*PostUniverseNamesOKBodyItems0
|
|
}
|
|
|
|
func (o *PostUniverseNamesOK) Error() string {
|
|
return fmt.Sprintf("[POST /universe/names/][%d] postUniverseNamesOK %+v", 200, o.Payload)
|
|
}
|
|
|
|
func (o *PostUniverseNamesOK) 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
|
|
}
|
|
|
|
// NewPostUniverseNamesNotFound creates a PostUniverseNamesNotFound with default headers values
|
|
func NewPostUniverseNamesNotFound() *PostUniverseNamesNotFound {
|
|
return &PostUniverseNamesNotFound{}
|
|
}
|
|
|
|
/*PostUniverseNamesNotFound handles this case with default header values.
|
|
|
|
no valid IDs found
|
|
*/
|
|
type PostUniverseNamesNotFound struct {
|
|
Payload PostUniverseNamesNotFoundBody
|
|
}
|
|
|
|
func (o *PostUniverseNamesNotFound) Error() string {
|
|
return fmt.Sprintf("[POST /universe/names/][%d] postUniverseNamesNotFound %+v", 404, o.Payload)
|
|
}
|
|
|
|
func (o *PostUniverseNamesNotFound) 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
|
|
}
|
|
|
|
// NewPostUniverseNamesInternalServerError creates a PostUniverseNamesInternalServerError with default headers values
|
|
func NewPostUniverseNamesInternalServerError() *PostUniverseNamesInternalServerError {
|
|
return &PostUniverseNamesInternalServerError{}
|
|
}
|
|
|
|
/*PostUniverseNamesInternalServerError handles this case with default header values.
|
|
|
|
Internal server error
|
|
*/
|
|
type PostUniverseNamesInternalServerError struct {
|
|
Payload PostUniverseNamesInternalServerErrorBody
|
|
}
|
|
|
|
func (o *PostUniverseNamesInternalServerError) Error() string {
|
|
return fmt.Sprintf("[POST /universe/names/][%d] postUniverseNamesInternalServerError %+v", 500, o.Payload)
|
|
}
|
|
|
|
func (o *PostUniverseNamesInternalServerError) 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
|
|
}
|
|
|
|
/*PostUniverseNamesInternalServerErrorBody post_universe_names_internal_server_error
|
|
//
|
|
// Internal server error
|
|
swagger:model PostUniverseNamesInternalServerErrorBody
|
|
*/
|
|
type PostUniverseNamesInternalServerErrorBody struct {
|
|
|
|
// post_universe_names_500_internal_server_error
|
|
//
|
|
// Internal server error message
|
|
// Required: true
|
|
Error *string `json:"error"`
|
|
}
|
|
|
|
// Validate validates this post universe names internal server error body
|
|
func (o *PostUniverseNamesInternalServerErrorBody) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.validateError(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *PostUniverseNamesInternalServerErrorBody) validateError(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("postUniverseNamesInternalServerError"+"."+"error", "body", o.Error); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *PostUniverseNamesInternalServerErrorBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *PostUniverseNamesInternalServerErrorBody) UnmarshalBinary(b []byte) error {
|
|
var res PostUniverseNamesInternalServerErrorBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|
|
|
|
/*PostUniverseNamesNotFoundBody post_universe_names_not_found
|
|
//
|
|
// Not found
|
|
swagger:model PostUniverseNamesNotFoundBody
|
|
*/
|
|
type PostUniverseNamesNotFoundBody struct {
|
|
|
|
// post_universe_names_404_not_found
|
|
//
|
|
// Not found message
|
|
// Required: true
|
|
Error *string `json:"error"`
|
|
}
|
|
|
|
// Validate validates this post universe names not found body
|
|
func (o *PostUniverseNamesNotFoundBody) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.validateError(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *PostUniverseNamesNotFoundBody) validateError(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("postUniverseNamesNotFound"+"."+"error", "body", o.Error); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *PostUniverseNamesNotFoundBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *PostUniverseNamesNotFoundBody) UnmarshalBinary(b []byte) error {
|
|
var res PostUniverseNamesNotFoundBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|
|
|
|
/*PostUniverseNamesOKBodyItems0 post_universe_names_200_ok
|
|
//
|
|
// 200 ok object
|
|
swagger:model PostUniverseNamesOKBodyItems0
|
|
*/
|
|
type PostUniverseNamesOKBodyItems0 struct {
|
|
|
|
// post_universe_names_category
|
|
//
|
|
// category string
|
|
// Required: true
|
|
Category *string `json:"category"`
|
|
|
|
// post_universe_names_id
|
|
//
|
|
// id integer
|
|
// Required: true
|
|
ID *int32 `json:"id"`
|
|
|
|
// post_universe_names_name
|
|
//
|
|
// name string
|
|
// Required: true
|
|
Name *string `json:"name"`
|
|
}
|
|
|
|
// Validate validates this post universe names o k body items0
|
|
func (o *PostUniverseNamesOKBodyItems0) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.validateCategory(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := o.validateID(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := o.validateName(formats); err != nil {
|
|
// prop
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var postUniverseNamesOKBodyItems0TypeCategoryPropEnum []interface{}
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["alliance","character","constellation","corporation","inventory_type","region","solar_system","station"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
postUniverseNamesOKBodyItems0TypeCategoryPropEnum = append(postUniverseNamesOKBodyItems0TypeCategoryPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
// PostUniverseNamesOKBodyItems0CategoryAlliance captures enum value "alliance"
|
|
PostUniverseNamesOKBodyItems0CategoryAlliance string = "alliance"
|
|
// PostUniverseNamesOKBodyItems0CategoryCharacter captures enum value "character"
|
|
PostUniverseNamesOKBodyItems0CategoryCharacter string = "character"
|
|
// PostUniverseNamesOKBodyItems0CategoryConstellation captures enum value "constellation"
|
|
PostUniverseNamesOKBodyItems0CategoryConstellation string = "constellation"
|
|
// PostUniverseNamesOKBodyItems0CategoryCorporation captures enum value "corporation"
|
|
PostUniverseNamesOKBodyItems0CategoryCorporation string = "corporation"
|
|
// PostUniverseNamesOKBodyItems0CategoryInventoryType captures enum value "inventory_type"
|
|
PostUniverseNamesOKBodyItems0CategoryInventoryType string = "inventory_type"
|
|
// PostUniverseNamesOKBodyItems0CategoryRegion captures enum value "region"
|
|
PostUniverseNamesOKBodyItems0CategoryRegion string = "region"
|
|
// PostUniverseNamesOKBodyItems0CategorySolarSystem captures enum value "solar_system"
|
|
PostUniverseNamesOKBodyItems0CategorySolarSystem string = "solar_system"
|
|
// PostUniverseNamesOKBodyItems0CategoryStation captures enum value "station"
|
|
PostUniverseNamesOKBodyItems0CategoryStation string = "station"
|
|
)
|
|
|
|
// prop value enum
|
|
func (o *PostUniverseNamesOKBodyItems0) validateCategoryEnum(path, location string, value string) error {
|
|
if err := validate.Enum(path, location, value, postUniverseNamesOKBodyItems0TypeCategoryPropEnum); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *PostUniverseNamesOKBodyItems0) validateCategory(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("category", "body", o.Category); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := o.validateCategoryEnum("category", "body", *o.Category); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (o *PostUniverseNamesOKBodyItems0) validateID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("id", "body", o.ID); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (o *PostUniverseNamesOKBodyItems0) validateName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("name", "body", o.Name); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *PostUniverseNamesOKBodyItems0) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *PostUniverseNamesOKBodyItems0) UnmarshalBinary(b []byte) error {
|
|
var res PostUniverseNamesOKBodyItems0
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|