Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 2.68 KB

README.md

File metadata and controls

67 lines (51 loc) · 2.68 KB

Orders

(Orders)

Overview

The orders endpoints.

Available Operations

CreateOrder

Create an order for a drink.

Example Usage

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
    }
}

Parameters

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.

Response

*operations.CreateOrderResponse, error

Error Object Status Code Content Type
sdkerrors.APIError 5XX application/json
sdkerrors.SDKError 4xx-5xx /