Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
502
pkg/ota_api/client/operations/get_suppliers_responses.go
Normal file
502
pkg/ota_api/client/operations/get_suppliers_responses.go
Normal file
@@ -0,0 +1,502 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"fiskerinc.com/modules/ota_api/models"
|
||||
)
|
||||
|
||||
// GetSuppliersReader is a Reader for the GetSuppliers structure.
|
||||
type GetSuppliersReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetSuppliersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetSuppliersOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewGetSuppliersBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 401:
|
||||
result := NewGetSuppliersUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 503:
|
||||
result := NewGetSuppliersServiceUnavailable()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /suppliers] GetSuppliers", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetSuppliersOK creates a GetSuppliersOK with default headers values
|
||||
func NewGetSuppliersOK() *GetSuppliersOK {
|
||||
return &GetSuppliersOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetSuppliersOK describes a response with status code 200, with default header values.
|
||||
|
||||
OK
|
||||
*/
|
||||
type GetSuppliersOK struct {
|
||||
Payload *GetSuppliersOKBody
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get suppliers o k response has a 2xx status code
|
||||
func (o *GetSuppliersOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get suppliers o k response has a 3xx status code
|
||||
func (o *GetSuppliersOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get suppliers o k response has a 4xx status code
|
||||
func (o *GetSuppliersOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get suppliers o k response has a 5xx status code
|
||||
func (o *GetSuppliersOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get suppliers o k response a status code equal to that given
|
||||
func (o *GetSuppliersOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get suppliers o k response
|
||||
func (o *GetSuppliersOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetSuppliersOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersOK) GetPayload() *GetSuppliersOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetSuppliersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(GetSuppliersOKBody)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetSuppliersBadRequest creates a GetSuppliersBadRequest with default headers values
|
||||
func NewGetSuppliersBadRequest() *GetSuppliersBadRequest {
|
||||
return &GetSuppliersBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetSuppliersBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
Bad request
|
||||
*/
|
||||
type GetSuppliersBadRequest struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get suppliers bad request response has a 2xx status code
|
||||
func (o *GetSuppliersBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get suppliers bad request response has a 3xx status code
|
||||
func (o *GetSuppliersBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get suppliers bad request response has a 4xx status code
|
||||
func (o *GetSuppliersBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get suppliers bad request response has a 5xx status code
|
||||
func (o *GetSuppliersBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get suppliers bad request response a status code equal to that given
|
||||
func (o *GetSuppliersBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the get suppliers bad request response
|
||||
func (o *GetSuppliersBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *GetSuppliersBadRequest) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersBadRequest) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersBadRequest) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetSuppliersBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetSuppliersUnauthorized creates a GetSuppliersUnauthorized with default headers values
|
||||
func NewGetSuppliersUnauthorized() *GetSuppliersUnauthorized {
|
||||
return &GetSuppliersUnauthorized{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetSuppliersUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
Unauthorized
|
||||
*/
|
||||
type GetSuppliersUnauthorized struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get suppliers unauthorized response has a 2xx status code
|
||||
func (o *GetSuppliersUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get suppliers unauthorized response has a 3xx status code
|
||||
func (o *GetSuppliersUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get suppliers unauthorized response has a 4xx status code
|
||||
func (o *GetSuppliersUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get suppliers unauthorized response has a 5xx status code
|
||||
func (o *GetSuppliersUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get suppliers unauthorized response a status code equal to that given
|
||||
func (o *GetSuppliersUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
// Code gets the status code for the get suppliers unauthorized response
|
||||
func (o *GetSuppliersUnauthorized) Code() int {
|
||||
return 401
|
||||
}
|
||||
|
||||
func (o *GetSuppliersUnauthorized) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersUnauthorized) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersUnauthorized) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetSuppliersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetSuppliersServiceUnavailable creates a GetSuppliersServiceUnavailable with default headers values
|
||||
func NewGetSuppliersServiceUnavailable() *GetSuppliersServiceUnavailable {
|
||||
return &GetSuppliersServiceUnavailable{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetSuppliersServiceUnavailable describes a response with status code 503, with default header values.
|
||||
|
||||
Service unavailable
|
||||
*/
|
||||
type GetSuppliersServiceUnavailable struct {
|
||||
Payload *models.CommonJSONError
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get suppliers service unavailable response has a 2xx status code
|
||||
func (o *GetSuppliersServiceUnavailable) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get suppliers service unavailable response has a 3xx status code
|
||||
func (o *GetSuppliersServiceUnavailable) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get suppliers service unavailable response has a 4xx status code
|
||||
func (o *GetSuppliersServiceUnavailable) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get suppliers service unavailable response has a 5xx status code
|
||||
func (o *GetSuppliersServiceUnavailable) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this get suppliers service unavailable response a status code equal to that given
|
||||
func (o *GetSuppliersServiceUnavailable) IsCode(code int) bool {
|
||||
return code == 503
|
||||
}
|
||||
|
||||
// Code gets the status code for the get suppliers service unavailable response
|
||||
func (o *GetSuppliersServiceUnavailable) Code() int {
|
||||
return 503
|
||||
}
|
||||
|
||||
func (o *GetSuppliersServiceUnavailable) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersServiceUnavailable %s", 503, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersServiceUnavailable) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /suppliers][%d] getSuppliersServiceUnavailable %s", 503, payload)
|
||||
}
|
||||
|
||||
func (o *GetSuppliersServiceUnavailable) GetPayload() *models.CommonJSONError {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetSuppliersServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.CommonJSONError)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetSuppliersOKBody get suppliers o k body
|
||||
swagger:model GetSuppliersOKBody
|
||||
*/
|
||||
type GetSuppliersOKBody struct {
|
||||
models.CommonJSONDBQueryResult
|
||||
|
||||
// data
|
||||
Data []*models.CommonSupplierAccount `json:"data"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals this object from a JSON structure
|
||||
func (o *GetSuppliersOKBody) UnmarshalJSON(raw []byte) error {
|
||||
// GetSuppliersOKBodyAO0
|
||||
var getSuppliersOKBodyAO0 models.CommonJSONDBQueryResult
|
||||
if err := swag.ReadJSON(raw, &getSuppliersOKBodyAO0); err != nil {
|
||||
return err
|
||||
}
|
||||
o.CommonJSONDBQueryResult = getSuppliersOKBodyAO0
|
||||
|
||||
// GetSuppliersOKBodyAO1
|
||||
var dataGetSuppliersOKBodyAO1 struct {
|
||||
Data []*models.CommonSupplierAccount `json:"data"`
|
||||
}
|
||||
if err := swag.ReadJSON(raw, &dataGetSuppliersOKBodyAO1); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.Data = dataGetSuppliersOKBodyAO1.Data
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON marshals this object to a JSON structure
|
||||
func (o GetSuppliersOKBody) MarshalJSON() ([]byte, error) {
|
||||
_parts := make([][]byte, 0, 2)
|
||||
|
||||
getSuppliersOKBodyAO0, err := swag.WriteJSON(o.CommonJSONDBQueryResult)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_parts = append(_parts, getSuppliersOKBodyAO0)
|
||||
var dataGetSuppliersOKBodyAO1 struct {
|
||||
Data []*models.CommonSupplierAccount `json:"data"`
|
||||
}
|
||||
|
||||
dataGetSuppliersOKBodyAO1.Data = o.Data
|
||||
|
||||
jsonDataGetSuppliersOKBodyAO1, errGetSuppliersOKBodyAO1 := swag.WriteJSON(dataGetSuppliersOKBodyAO1)
|
||||
if errGetSuppliersOKBodyAO1 != nil {
|
||||
return nil, errGetSuppliersOKBodyAO1
|
||||
}
|
||||
_parts = append(_parts, jsonDataGetSuppliersOKBodyAO1)
|
||||
return swag.ConcatJSON(_parts...), nil
|
||||
}
|
||||
|
||||
// Validate validates this get suppliers o k body
|
||||
func (o *GetSuppliersOKBody) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
// validation for a type composition with models.CommonJSONDBQueryResult
|
||||
if err := o.CommonJSONDBQueryResult.Validate(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := o.validateData(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetSuppliersOKBody) validateData(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(o.Data) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(o.Data); i++ {
|
||||
if swag.IsZero(o.Data[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if o.Data[i] != nil {
|
||||
if err := o.Data[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("getSuppliersOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("getSuppliersOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this get suppliers o k body based on the context it is used
|
||||
func (o *GetSuppliersOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
// validation for a type composition with models.CommonJSONDBQueryResult
|
||||
if err := o.CommonJSONDBQueryResult.ContextValidate(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := o.contextValidateData(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetSuppliersOKBody) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(o.Data); i++ {
|
||||
|
||||
if o.Data[i] != nil {
|
||||
|
||||
if swag.IsZero(o.Data[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := o.Data[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("getSuppliersOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("getSuppliersOK" + "." + "data" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *GetSuppliersOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *GetSuppliersOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res GetSuppliersOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user