github.com/circl-dev/go-swagger@v0.31.0/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/strfmt"
    13  	"github.com/circl-dev/runtime"
    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  /* InventoryGetOK describes a response with status code 200, with default header values.
    41  
    42  successful operation
    43  */
    44  type InventoryGetOK struct {
    45  	Payload map[string]int32
    46  }
    47  
    48  func (o *InventoryGetOK) Error() string {
    49  	return fmt.Sprintf("[GET /store/inventory][%d] inventoryGetOK  %+v", 200, o.Payload)
    50  }
    51  func (o *InventoryGetOK) GetPayload() map[string]int32 {
    52  	return o.Payload
    53  }
    54  
    55  func (o *InventoryGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    56  
    57  	// response payload
    58  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
    59  		return err
    60  	}
    61  
    62  	return nil
    63  }