Skip to content

Latest commit

 

History

History
108 lines (80 loc) · 4.82 KB

README.md

File metadata and controls

108 lines (80 loc) · 4.82 KB

Drinks

(Drinks)

Overview

The drinks endpoints.

Available Operations

GetDrink

Get a drink by name, if authenticated this will include stock levels and product codes otherwise it will only include public information.

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.Drinks.GetDrink(ctx, operations.GetDrinkRequest{
        Name: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Drink != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetDrinkRequest ✔️ The request object to use for the request.

Response

*operations.GetDrinkResponse, error

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

ListDrinks

Get a list of drinks, if authenticated this will include stock levels and product codes otherwise it will only include public information.

Example Usage

package main

import(
	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()

    ctx := context.Background()
    res, err := s.Drinks.ListDrinks(ctx, operations.ListDrinksRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Classes != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.ListDrinksRequest ✔️ The request object to use for the request.

Response

*operations.ListDrinksResponse, error

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