github.com/djarvur/go-swagger@v0.18.0/examples/contributed-templates/stratoscale/client/store/store_client.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 "context" 10 11 "github.com/go-openapi/runtime" 12 13 strfmt "github.com/go-openapi/strfmt" 14 ) 15 16 //go:generate mockery -name API -inpkg 17 18 // API is the interface of the store client 19 type API interface { 20 // InventoryGet returns pet inventories by status 21 InventoryGet(ctx context.Context, params *InventoryGetParams) (*InventoryGetOK, error) 22 // OrderCreate places an order for a pet 23 OrderCreate(ctx context.Context, params *OrderCreateParams) (*OrderCreateOK, error) 24 // OrderDelete deletes purchase order by ID 25 // For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors 26 OrderDelete(ctx context.Context, params *OrderDeleteParams) (*OrderDeleteNoContent, error) 27 // OrderGet finds purchase order by ID 28 // For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions 29 OrderGet(ctx context.Context, params *OrderGetParams) (*OrderGetOK, error) 30 } 31 32 // New creates a new store API client. 33 func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client { 34 return &Client{ 35 transport: transport, 36 formats: formats, 37 authInfo: authInfo, 38 } 39 } 40 41 /* 42 Client for store API 43 */ 44 type Client struct { 45 transport runtime.ClientTransport 46 formats strfmt.Registry 47 authInfo runtime.ClientAuthInfoWriter 48 } 49 50 /* 51 InventoryGet returns pet inventories by status 52 */ 53 func (a *Client) InventoryGet(ctx context.Context, params *InventoryGetParams) (*InventoryGetOK, error) { 54 55 result, err := a.transport.Submit(&runtime.ClientOperation{ 56 ID: "InventoryGet", 57 Method: "GET", 58 PathPattern: "/store/inventory", 59 ProducesMediaTypes: []string{"application/json"}, 60 ConsumesMediaTypes: []string{"application/json"}, 61 Schemes: []string{"http"}, 62 Params: params, 63 Reader: &InventoryGetReader{formats: a.formats}, 64 AuthInfo: a.authInfo, 65 Context: ctx, 66 Client: params.HTTPClient, 67 }) 68 if err != nil { 69 return nil, err 70 } 71 return result.(*InventoryGetOK), nil 72 73 } 74 75 /* 76 OrderCreate places an order for a pet 77 */ 78 func (a *Client) OrderCreate(ctx context.Context, params *OrderCreateParams) (*OrderCreateOK, error) { 79 80 result, err := a.transport.Submit(&runtime.ClientOperation{ 81 ID: "OrderCreate", 82 Method: "POST", 83 PathPattern: "/store/order", 84 ProducesMediaTypes: []string{"application/json"}, 85 ConsumesMediaTypes: []string{"application/json"}, 86 Schemes: []string{"http"}, 87 Params: params, 88 Reader: &OrderCreateReader{formats: a.formats}, 89 AuthInfo: a.authInfo, 90 Context: ctx, 91 Client: params.HTTPClient, 92 }) 93 if err != nil { 94 return nil, err 95 } 96 return result.(*OrderCreateOK), nil 97 98 } 99 100 /* 101 OrderDelete deletes purchase order by ID 102 103 For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors 104 */ 105 func (a *Client) OrderDelete(ctx context.Context, params *OrderDeleteParams) (*OrderDeleteNoContent, error) { 106 107 result, err := a.transport.Submit(&runtime.ClientOperation{ 108 ID: "OrderDelete", 109 Method: "DELETE", 110 PathPattern: "/store/order/{orderId}", 111 ProducesMediaTypes: []string{"application/json"}, 112 ConsumesMediaTypes: []string{"application/json"}, 113 Schemes: []string{"http"}, 114 Params: params, 115 Reader: &OrderDeleteReader{formats: a.formats}, 116 AuthInfo: a.authInfo, 117 Context: ctx, 118 Client: params.HTTPClient, 119 }) 120 if err != nil { 121 return nil, err 122 } 123 return result.(*OrderDeleteNoContent), nil 124 125 } 126 127 /* 128 OrderGet finds purchase order by ID 129 130 For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions 131 */ 132 func (a *Client) OrderGet(ctx context.Context, params *OrderGetParams) (*OrderGetOK, error) { 133 134 result, err := a.transport.Submit(&runtime.ClientOperation{ 135 ID: "OrderGet", 136 Method: "GET", 137 PathPattern: "/store/order/{orderId}", 138 ProducesMediaTypes: []string{"application/json"}, 139 ConsumesMediaTypes: []string{"application/json"}, 140 Schemes: []string{"http"}, 141 Params: params, 142 Reader: &OrderGetReader{formats: a.formats}, 143 AuthInfo: a.authInfo, 144 Context: ctx, 145 Client: params.HTTPClient, 146 }) 147 if err != nil { 148 return nil, err 149 } 150 return result.(*OrderGetOK), nil 151 152 }