github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/contributed-templates/stratoscale/client/store/inventory_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  	"encoding/json"
    10  	"fmt"
    11  	"io"
    12  
    13  	"github.com/go-openapi/runtime"
    14  	"github.com/go-openapi/strfmt"
    15  )
    16  
    17  // InventoryGetReader is a Reader for the InventoryGet structure.
    18  type InventoryGetReader struct {
    19  	formats strfmt.Registry
    20  }
    21  
    22  // ReadResponse reads a server response into the received o.
    23  func (o *InventoryGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    24  	switch response.Code() {
    25  	case 200:
    26  		result := NewInventoryGetOK()
    27  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    28  			return nil, err
    29  		}
    30  		return result, nil
    31  	default:
    32  		return nil, runtime.NewAPIError("[GET /store/inventory] InventoryGet", response, response.Code())
    33  	}
    34  }
    35  
    36  // NewInventoryGetOK creates a InventoryGetOK with default headers values
    37  func NewInventoryGetOK() *InventoryGetOK {
    38  	return &InventoryGetOK{}
    39  }
    40  
    41  /*
    42  InventoryGetOK describes a response with status code 200, with default header values.
    43  
    44  successful operation
    45  */
    46  type InventoryGetOK struct {
    47  	Payload map[string]int32
    48  }
    49  
    50  // IsSuccess returns true when this inventory get o k response has a 2xx status code
    51  func (o *InventoryGetOK) IsSuccess() bool {
    52  	return true
    53  }
    54  
    55  // IsRedirect returns true when this inventory get o k response has a 3xx status code
    56  func (o *InventoryGetOK) IsRedirect() bool {
    57  	return false
    58  }
    59  
    60  // IsClientError returns true when this inventory get o k response has a 4xx status code
    61  func (o *InventoryGetOK) IsClientError() bool {
    62  	return false
    63  }
    64  
    65  // IsServerError returns true when this inventory get o k response has a 5xx status code
    66  func (o *InventoryGetOK) IsServerError() bool {
    67  	return false
    68  }
    69  
    70  // IsCode returns true when this inventory get o k response a status code equal to that given
    71  func (o *InventoryGetOK) IsCode(code int) bool {
    72  	return code == 200
    73  }
    74  
    75  // Code gets the status code for the inventory get o k response
    76  func (o *InventoryGetOK) Code() int {
    77  	return 200
    78  }
    79  
    80  func (o *InventoryGetOK) Error() string {
    81  	payload, _ := json.Marshal(o.Payload)
    82  	return fmt.Sprintf("[GET /store/inventory][%d] inventoryGetOK %s", 200, payload)
    83  }
    84  
    85  func (o *InventoryGetOK) String() string {
    86  	payload, _ := json.Marshal(o.Payload)
    87  	return fmt.Sprintf("[GET /store/inventory][%d] inventoryGetOK %s", 200, payload)
    88  }
    89  
    90  func (o *InventoryGetOK) GetPayload() map[string]int32 {
    91  	return o.Payload
    92  }
    93  
    94  func (o *InventoryGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    95  
    96  	// response payload
    97  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
    98  		return err
    99  	}
   100  
   101  	return nil
   102  }