mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
132 lines
3.4 KiB
Go
132 lines
3.4 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package orders
|
|
|
|
// 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"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
|
|
models "go-fulfillment/models"
|
|
)
|
|
|
|
// CancelOrderReader is a Reader for the CancelOrder structure.
|
|
type CancelOrderReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *CancelOrderReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
|
|
case 200:
|
|
result := NewCancelOrderOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
|
|
case 404:
|
|
result := NewCancelOrderNotFound()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
|
|
case 405:
|
|
result := NewCancelOrderMethodNotAllowed()
|
|
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())
|
|
}
|
|
}
|
|
|
|
// NewCancelOrderOK creates a CancelOrderOK with default headers values
|
|
func NewCancelOrderOK() *CancelOrderOK {
|
|
return &CancelOrderOK{}
|
|
}
|
|
|
|
/*CancelOrderOK handles this case with default header values.
|
|
|
|
Your order was successfully canceled
|
|
*/
|
|
type CancelOrderOK struct {
|
|
Payload *models.Order
|
|
}
|
|
|
|
func (o *CancelOrderOK) Error() string {
|
|
return fmt.Sprintf("[DELETE /orders/{id}][%d] cancelOrderOK %+v", 200, o.Payload)
|
|
}
|
|
|
|
func (o *CancelOrderOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(models.Order)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewCancelOrderNotFound creates a CancelOrderNotFound with default headers values
|
|
func NewCancelOrderNotFound() *CancelOrderNotFound {
|
|
return &CancelOrderNotFound{}
|
|
}
|
|
|
|
/*CancelOrderNotFound handles this case with default header values.
|
|
|
|
Order not found
|
|
*/
|
|
type CancelOrderNotFound struct {
|
|
}
|
|
|
|
func (o *CancelOrderNotFound) Error() string {
|
|
return fmt.Sprintf("[DELETE /orders/{id}][%d] cancelOrderNotFound ", 404)
|
|
}
|
|
|
|
func (o *CancelOrderNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewCancelOrderMethodNotAllowed creates a CancelOrderMethodNotAllowed with default headers values
|
|
func NewCancelOrderMethodNotAllowed() *CancelOrderMethodNotAllowed {
|
|
return &CancelOrderMethodNotAllowed{}
|
|
}
|
|
|
|
/*CancelOrderMethodNotAllowed handles this case with default header values.
|
|
|
|
Could not cancel your order, perhaps it already shipped
|
|
*/
|
|
type CancelOrderMethodNotAllowed struct {
|
|
Payload *models.StandardError
|
|
}
|
|
|
|
func (o *CancelOrderMethodNotAllowed) Error() string {
|
|
return fmt.Sprintf("[DELETE /orders/{id}][%d] cancelOrderMethodNotAllowed %+v", 405, o.Payload)
|
|
}
|
|
|
|
func (o *CancelOrderMethodNotAllowed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(models.StandardError)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|