Skip to content

Latest commit

 

History

History
executable file
·
109 lines (73 loc) · 3.93 KB

README.md

File metadata and controls

executable file
·
109 lines (73 loc) · 3.93 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(
	"context"
	"log"
	templatespeakeasybar "github.com/speakeasy-sdks/template-speakeasy-bar"
	"github.com/speakeasy-sdks/template-speakeasy-bar/pkg/models/shared"
)

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


    var name string = "string"

    ctx := context.Background()
    res, err := s.Drinks.GetDrink(ctx, name)
    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.
name string ✔️ N/A

Response

*operations.GetDrinkResponse, error

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(
	"context"
	"log"
	templatespeakeasybar "github.com/speakeasy-sdks/template-speakeasy-bar"
	"github.com/speakeasy-sdks/template-speakeasy-bar/pkg/models/shared"
)

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


    var drinkType *shared.DrinkType = shared.DrinkTypeSpirit

    ctx := context.Background()
    res, err := s.Drinks.ListDrinks(ctx, drinkType)
    if err != nil {
        log.Fatal(err)
    }

    if res.Drinks != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
drinkType *shared.DrinkType The type of drink to filter by. If not provided all drinks will be returned.

Response

*operations.ListDrinksResponse, error