github.com/ffalor/go-swagger@v0.0.0-20231011000038-9f25265ac351/examples/contributed-templates/stratoscale/client/store/order_get_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package store
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/go-openapi/runtime"
    13  	"github.com/go-openapi/strfmt"
    14  
    15  	"github.com/go-swagger/go-swagger/examples/contributed-templates/stratoscale/models"
    16  )
    17  
    18  // OrderGetReader is a Reader for the OrderGet structure.
    19  type OrderGetReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *OrderGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewOrderGetOK()
    28  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    29  			return nil, err
    30  		}
    31  		return result, nil
    32  	case 400:
    33  		result := NewOrderGetBadRequest()
    34  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    35  			return nil, err
    36  		}
    37  		return nil, result
    38  	case 404:
    39  		result := NewOrderGetNotFound()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	default:
    45  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    46  	}
    47  }
    48  
    49  // NewOrderGetOK creates a OrderGetOK with default headers values
    50  func NewOrderGetOK() *OrderGetOK {
    51  	return &OrderGetOK{}
    52  }
    53  
    54  /*
    55  OrderGetOK describes a response with status code 200, with default header values.
    56  
    57  successful operation
    58  */
    59  type OrderGetOK struct {
    60  	Payload *models.Order
    61  }
    62  
    63  // IsSuccess returns true when this order get o k response has a 2xx status code
    64  func (o *OrderGetOK) IsSuccess() bool {
    65  	return true
    66  }
    67  
    68  // IsRedirect returns true when this order get o k response has a 3xx status code
    69  func (o *OrderGetOK) IsRedirect() bool {
    70  	return false
    71  }
    72  
    73  // IsClientError returns true when this order get o k response has a 4xx status code
    74  func (o *OrderGetOK) IsClientError() bool {
    75  	return false
    76  }
    77  
    78  // IsServerError returns true when this order get o k response has a 5xx status code
    79  func (o *OrderGetOK) IsServerError() bool {
    80  	return false
    81  }
    82  
    83  // IsCode returns true when this order get o k response a status code equal to that given
    84  func (o *OrderGetOK) IsCode(code int) bool {
    85  	return code == 200
    86  }
    87  
    88  // Code gets the status code for the order get o k response
    89  func (o *OrderGetOK) Code() int {
    90  	return 200
    91  }
    92  
    93  func (o *OrderGetOK) Error() string {
    94  	return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetOK  %+v", 200, o.Payload)
    95  }
    96  
    97  func (o *OrderGetOK) String() string {
    98  	return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetOK  %+v", 200, o.Payload)
    99  }
   100  
   101  func (o *OrderGetOK) GetPayload() *models.Order {
   102  	return o.Payload
   103  }
   104  
   105  func (o *OrderGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   106  
   107  	o.Payload = new(models.Order)
   108  
   109  	// response payload
   110  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   111  		return err
   112  	}
   113  
   114  	return nil
   115  }
   116  
   117  // NewOrderGetBadRequest creates a OrderGetBadRequest with default headers values
   118  func NewOrderGetBadRequest() *OrderGetBadRequest {
   119  	return &OrderGetBadRequest{}
   120  }
   121  
   122  /*
   123  OrderGetBadRequest describes a response with status code 400, with default header values.
   124  
   125  Invalid ID supplied
   126  */
   127  type OrderGetBadRequest struct {
   128  }
   129  
   130  // IsSuccess returns true when this order get bad request response has a 2xx status code
   131  func (o *OrderGetBadRequest) IsSuccess() bool {
   132  	return false
   133  }
   134  
   135  // IsRedirect returns true when this order get bad request response has a 3xx status code
   136  func (o *OrderGetBadRequest) IsRedirect() bool {
   137  	return false
   138  }
   139  
   140  // IsClientError returns true when this order get bad request response has a 4xx status code
   141  func (o *OrderGetBadRequest) IsClientError() bool {
   142  	return true
   143  }
   144  
   145  // IsServerError returns true when this order get bad request response has a 5xx status code
   146  func (o *OrderGetBadRequest) IsServerError() bool {
   147  	return false
   148  }
   149  
   150  // IsCode returns true when this order get bad request response a status code equal to that given
   151  func (o *OrderGetBadRequest) IsCode(code int) bool {
   152  	return code == 400
   153  }
   154  
   155  // Code gets the status code for the order get bad request response
   156  func (o *OrderGetBadRequest) Code() int {
   157  	return 400
   158  }
   159  
   160  func (o *OrderGetBadRequest) Error() string {
   161  	return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetBadRequest ", 400)
   162  }
   163  
   164  func (o *OrderGetBadRequest) String() string {
   165  	return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetBadRequest ", 400)
   166  }
   167  
   168  func (o *OrderGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   169  
   170  	return nil
   171  }
   172  
   173  // NewOrderGetNotFound creates a OrderGetNotFound with default headers values
   174  func NewOrderGetNotFound() *OrderGetNotFound {
   175  	return &OrderGetNotFound{}
   176  }
   177  
   178  /*
   179  OrderGetNotFound describes a response with status code 404, with default header values.
   180  
   181  Order not found
   182  */
   183  type OrderGetNotFound struct {
   184  }
   185  
   186  // IsSuccess returns true when this order get not found response has a 2xx status code
   187  func (o *OrderGetNotFound) IsSuccess() bool {
   188  	return false
   189  }
   190  
   191  // IsRedirect returns true when this order get not found response has a 3xx status code
   192  func (o *OrderGetNotFound) IsRedirect() bool {
   193  	return false
   194  }
   195  
   196  // IsClientError returns true when this order get not found response has a 4xx status code
   197  func (o *OrderGetNotFound) IsClientError() bool {
   198  	return true
   199  }
   200  
   201  // IsServerError returns true when this order get not found response has a 5xx status code
   202  func (o *OrderGetNotFound) IsServerError() bool {
   203  	return false
   204  }
   205  
   206  // IsCode returns true when this order get not found response a status code equal to that given
   207  func (o *OrderGetNotFound) IsCode(code int) bool {
   208  	return code == 404
   209  }
   210  
   211  // Code gets the status code for the order get not found response
   212  func (o *OrderGetNotFound) Code() int {
   213  	return 404
   214  }
   215  
   216  func (o *OrderGetNotFound) Error() string {
   217  	return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetNotFound ", 404)
   218  }
   219  
   220  func (o *OrderGetNotFound) String() string {
   221  	return fmt.Sprintf("[GET /store/order/{orderId}][%d] orderGetNotFound ", 404)
   222  }
   223  
   224  func (o *OrderGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   225  
   226  	return nil
   227  }