github.com/ffalor/go-swagger@v0.0.0-20231011000038-9f25265ac351/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 has 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 has 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 has 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 has 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 a status code equal to that given 70 func (o *InventoryGetOK) IsCode(code int) bool { 71 return code == 200 72 } 73 74 // Code gets the status code for the inventory get o k response 75 func (o *InventoryGetOK) Code() int { 76 return 200 77 } 78 79 func (o *InventoryGetOK) Error() string { 80 return fmt.Sprintf("[GET /store/inventory][%d] inventoryGetOK %+v", 200, o.Payload) 81 } 82 83 func (o *InventoryGetOK) String() string { 84 return fmt.Sprintf("[GET /store/inventory][%d] inventoryGetOK %+v", 200, o.Payload) 85 } 86 87 func (o *InventoryGetOK) GetPayload() map[string]int32 { 88 return o.Payload 89 } 90 91 func (o *InventoryGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 92 93 // response payload 94 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 95 return err 96 } 97 98 return nil 99 }