(Drinks)
The drinks endpoints.
- GetDrink - Get a drink.
- ListDrinks - Get a list of drinks.
Get a drink by name, if authenticated this will include stock levels and product codes otherwise it will only include public information.
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
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
name |
string | ✔️ | N/A |
*operations.GetDrinkResponse, error
Get a list of drinks, if authenticated this will include stock levels and product codes otherwise it will only include public information.
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
}
}
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. |