github.com/emreu/go-swagger@v0.22.1/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  
    14  	strfmt "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  
    32  	default:
    33  		return nil, runtime.NewAPIError("unknown error", response, response.Code())
    34  	}
    35  }
    36  
    37  // NewInventoryGetOK creates a InventoryGetOK with default headers values
    38  func NewInventoryGetOK() *InventoryGetOK {
    39  	return &InventoryGetOK{}
    40  }
    41  
    42  /*InventoryGetOK handles this case with default header values.
    43  
    44  successful operation
    45  */
    46  type InventoryGetOK struct {
    47  	Payload map[string]int32
    48  }
    49  
    50  func (o *InventoryGetOK) Error() string {
    51  	return fmt.Sprintf("[GET /store/inventory][%d] inventoryGetOK  %+v", 200, o.Payload)
    52  }
    53  
    54  func (o *InventoryGetOK) GetPayload() map[string]int32 {
    55  	return o.Payload
    56  }
    57  
    58  func (o *InventoryGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    59  
    60  	// response payload
    61  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
    62  		return err
    63  	}
    64  
    65  	return nil
    66  }