(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(
"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
}
}
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. |
*operations.GetDrinkResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.APIError | 5XX | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
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(
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
}
}
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. |
*operations.ListDrinksResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.APIError | 5XX | application/json |
sdkerrors.SDKError | 4xx-5xx | / |