Skip to content

Latest commit

 

History

History
executable file
·
69 lines (48 loc) · 2.28 KB

README.md

File metadata and controls

executable file
·
69 lines (48 loc) · 2.28 KB

Orders

(Orders)

Overview

The orders endpoints.

Available Operations

CreateOrder

Create an order for a drink.

Example Usage

package main

import(
	"context"
	"log"
	templatespeakeasybar "github.com/speakeasy-sdks/template-speakeasy-bar"
	"github.com/speakeasy-sdks/template-speakeasy-bar/pkg/models/shared"
	"github.com/speakeasy-sdks/template-speakeasy-bar/pkg/models/callbacks"
)

func main() {
    s := templatespeakeasybar.New(
        templatespeakeasybar.WithSecurity(""),
    )


    requestBody := []shared.OrderInput{
        shared.OrderInput{
            ProductCode: "APM-1F2D3",
            Quantity: 26535,
            Type: shared.OrderTypeDrink,
        },
    }

    var callbackURL *string = "string"

    ctx := context.Background()
    res, err := s.Orders.CreateOrder(ctx, requestBody, callbackURL)
    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.
requestBody []shared.OrderInput ✔️ N/A
callbackURL *string The url to call when the order is updated.

Response

*operations.CreateOrderResponse, error