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