github.com/circl-dev/go-swagger@v0.31.0/examples/contributed-templates/stratoscale/restapi/operations/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  	"net/http"
    10  
    11  	"github.com/circl-dev/runtime"
    12  )
    13  
    14  // InventoryGetOKCode is the HTTP code returned for type InventoryGetOK
    15  const InventoryGetOKCode int = 200
    16  
    17  /*InventoryGetOK successful operation
    18  
    19  swagger:response inventoryGetOK
    20  */
    21  type InventoryGetOK struct {
    22  
    23  	/*
    24  	  In: Body
    25  	*/
    26  	Payload map[string]int32 `json:"body,omitempty"`
    27  }
    28  
    29  // NewInventoryGetOK creates InventoryGetOK with default headers values
    30  func NewInventoryGetOK() *InventoryGetOK {
    31  
    32  	return &InventoryGetOK{}
    33  }
    34  
    35  // WithPayload adds the payload to the inventory get o k response
    36  func (o *InventoryGetOK) WithPayload(payload map[string]int32) *InventoryGetOK {
    37  	o.Payload = payload
    38  	return o
    39  }
    40  
    41  // SetPayload sets the payload to the inventory get o k response
    42  func (o *InventoryGetOK) SetPayload(payload map[string]int32) {
    43  	o.Payload = payload
    44  }
    45  
    46  // WriteResponse to the client
    47  func (o *InventoryGetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    48  
    49  	rw.WriteHeader(200)
    50  	payload := o.Payload
    51  	if payload == nil {
    52  		// return empty map
    53  		payload = make(map[string]int32, 50)
    54  	}
    55  
    56  	if err := producer.Produce(rw, payload); err != nil {
    57  		panic(err) // let the recovery middleware deal with this
    58  	}
    59  }