(Orders)
The orders endpoints.
- CreateOrder - Create an order.
Create an order for a drink.
package main
import(
"github.com/speakeasy-sdks/test-current-go/pkg/models/shared"
testcurrentgo "github.com/speakeasy-sdks/test-current-go"
"context"
"github.com/speakeasy-sdks/test-current-go/pkg/models/operations"
"log"
)
func main() {
s := testcurrentgo.New(
testcurrentgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
ctx := context.Background()
res, err := s.Orders.CreateOrder(ctx, operations.CreateOrderRequest{
RequestBody: []shared.OrderInput{
shared.OrderInput{
ProductCode: "APM-1F2D3",
Quantity: 26535,
Type: shared.OrderTypeDrink,
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Order != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateOrderRequest | ✔️ | The request object to use for the request. |
*operations.CreateOrderResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.APIError | 5XX | application/json |
sdkerrors.SDKError | 4xx-5xx | / |