diff --git a/README.md b/README.md index 54413b7..38c9905 100755 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ func main() { log.Fatal(err) } - if res.Classes != nil { + if res.Drinks != nil { // handle response } } @@ -96,24 +96,24 @@ func main() { ## Available Resources and Operations -### [.Authentication](docs/sdks/authentication/README.md) +### [Authentication](docs/sdks/authentication/README.md) * [Authenticate](docs/sdks/authentication/README.md#authenticate) - Authenticate with the API by providing a username and password. -### [.Config](docs/sdks/config/README.md) +### [Config](docs/sdks/config/README.md) * [SubscribeToWebhooks](docs/sdks/config/README.md#subscribetowebhooks) - Subscribe to webhooks. -### [.Drinks](docs/sdks/drinks/README.md) +### [Drinks](docs/sdks/drinks/README.md) * [GetDrink](docs/sdks/drinks/README.md#getdrink) - Get a drink. * [ListDrinks](docs/sdks/drinks/README.md#listdrinks) - Get a list of drinks. -### [.Ingredients](docs/sdks/ingredients/README.md) +### [Ingredients](docs/sdks/ingredients/README.md) * [ListIngredients](docs/sdks/ingredients/README.md#listingredients) - Get a list of ingredients. -### [.Orders](docs/sdks/orders/README.md) +### [Orders](docs/sdks/orders/README.md) * [CreateOrder](docs/sdks/orders/README.md#createorder) - Create an order. @@ -215,7 +215,7 @@ func main() { log.Fatal(err) } - if res.Object != nil { + if res.Authenticate200ApplicationJSONObject != nil { // handle response } } @@ -251,7 +251,7 @@ func main() { log.Fatal(err) } - if res.Object != nil { + if res.Authenticate200ApplicationJSONObject != nil { // handle response } } diff --git a/RELEASES.md b/RELEASES.md index e96c705..0bc04d2 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -38,4 +38,14 @@ Based on: ### Generated - [go v0.4.0] . ### Releases -- [Go v0.4.0] https://github.com/speakeasy-sdks/template-speakeasy-bar/releases/tag/v0.4.0 - . \ No newline at end of file +- [Go v0.4.0] https://github.com/speakeasy-sdks/template-speakeasy-bar/releases/tag/v0.4.0 - . + +## 2023-11-01 21:40:37 +### Changes +Based on: +- OpenAPI Doc 1.0.0 +- Speakeasy CLI 1.109.2 (2.173.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.5.0] . +### Releases +- [Go v0.5.0] https://github.com/speakeasy-sdks/template-speakeasy-bar/releases/tag/v0.5.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index c8d1acc..c61042c 100755 --- a/USAGE.md +++ b/USAGE.md @@ -24,7 +24,7 @@ func main() { log.Fatal(err) } - if res.Classes != nil { + if res.Drinks != nil { // handle response } } diff --git a/authentication.go b/authentication.go index f1546e0..884840c 100755 --- a/authentication.go +++ b/authentication.go @@ -15,19 +15,19 @@ import ( "strings" ) -// Authentication - The authentication endpoints. -type Authentication struct { +// The authentication endpoints. +type authentication struct { sdkConfiguration sdkConfiguration } -func newAuthentication(sdkConfig sdkConfiguration) *Authentication { - return &Authentication{ +func newAuthentication(sdkConfig sdkConfiguration) *authentication { + return &authentication{ sdkConfiguration: sdkConfig, } } // Authenticate with the API by providing a username and password. -func (s *Authentication) Authenticate(ctx context.Context, request operations.AuthenticateRequestBody) (*operations.AuthenticateResponse, error) { +func (s *authentication) Authenticate(ctx context.Context, request operations.AuthenticateRequestBody) (*operations.AuthenticateResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/authenticate" @@ -76,12 +76,12 @@ func (s *Authentication) Authenticate(ctx context.Context, request operations.Au case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out operations.AuthenticateResponseBody + var out operations.Authenticate200ApplicationJSON if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Object = &out + res.Authenticate200ApplicationJSONObject = &out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/config.go b/config.go index 19fa72b..9bacff8 100755 --- a/config.go +++ b/config.go @@ -15,19 +15,19 @@ import ( "strings" ) -type Config struct { +type config struct { sdkConfiguration sdkConfiguration } -func newConfig(sdkConfig sdkConfiguration) *Config { - return &Config{ +func newConfig(sdkConfig sdkConfiguration) *config { + return &config{ sdkConfiguration: sdkConfig, } } // SubscribeToWebhooks - Subscribe to webhooks. // Subscribe to webhooks. -func (s *Config) SubscribeToWebhooks(ctx context.Context, request []operations.RequestBody) (*operations.SubscribeToWebhooksResponse, error) { +func (s *config) SubscribeToWebhooks(ctx context.Context, request []operations.SubscribeToWebhooksRequestBody) (*operations.SubscribeToWebhooksResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/webhooks/subscribe" diff --git a/docs/models/callbacks/createorderorderupdaterequestbody.md b/docs/models/callbacks/createorderorderupdaterequestbodyinput.md similarity index 94% rename from docs/models/callbacks/createorderorderupdaterequestbody.md rename to docs/models/callbacks/createorderorderupdaterequestbodyinput.md index 695012b..e568f4e 100755 --- a/docs/models/callbacks/createorderorderupdaterequestbody.md +++ b/docs/models/callbacks/createorderorderupdaterequestbodyinput.md @@ -1,4 +1,4 @@ -# CreateOrderOrderUpdateRequestBody +# CreateOrderOrderUpdateRequestBodyInput ## Fields diff --git a/docs/models/operations/authenticateresponsebody.md b/docs/models/operations/authenticate200applicationjson.md similarity index 90% rename from docs/models/operations/authenticateresponsebody.md rename to docs/models/operations/authenticate200applicationjson.md index 0132c76..0c547d9 100755 --- a/docs/models/operations/authenticateresponsebody.md +++ b/docs/models/operations/authenticate200applicationjson.md @@ -1,4 +1,4 @@ -# AuthenticateResponseBody +# Authenticate200ApplicationJSON The api key to use for authenticated endpoints. diff --git a/docs/models/operations/authenticateresponse.md b/docs/models/operations/authenticateresponse.md index a40b9e7..3e72944 100755 --- a/docs/models/operations/authenticateresponse.md +++ b/docs/models/operations/authenticateresponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `Error` | [*shared.Error](../../models/shared/error.md) | :heavy_minus_sign: | An unknown error occurred interacting with the API. | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*AuthenticateResponseBody](../../models/operations/authenticateresponsebody.md) | :heavy_minus_sign: | The api key to use for authenticated endpoints. | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `Error` | [*shared.Error](../../models/shared/error.md) | :heavy_minus_sign: | An unknown error occurred interacting with the API. | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | +| `Authenticate200ApplicationJSONObject` | [*Authenticate200ApplicationJSON](../../models/operations/authenticate200applicationjson.md) | :heavy_minus_sign: | The api key to use for authenticated endpoints. | \ No newline at end of file diff --git a/docs/models/operations/listdrinksresponse.md b/docs/models/operations/listdrinksresponse.md index 3911944..3008091 100755 --- a/docs/models/operations/listdrinksresponse.md +++ b/docs/models/operations/listdrinksresponse.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `Drinks` | [][shared.Drink](../../models/shared/drink.md) | :heavy_minus_sign: | A list of drinks. | | `Error` | [*shared.Error](../../models/shared/error.md) | :heavy_minus_sign: | An unknown error occurred interacting with the API. | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | -| `Classes` | [][shared.Drink](../../models/shared/drink.md) | :heavy_minus_sign: | A list of drinks. | \ No newline at end of file +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/listingredientsresponse.md b/docs/models/operations/listingredientsresponse.md index 3bd8350..2696c2a 100755 --- a/docs/models/operations/listingredientsresponse.md +++ b/docs/models/operations/listingredientsresponse.md @@ -7,6 +7,6 @@ | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `Error` | [*shared.Error](../../models/shared/error.md) | :heavy_minus_sign: | An unknown error occurred interacting with the API. | +| `Ingredients` | [][shared.Ingredient](../../models/shared/ingredient.md) | :heavy_minus_sign: | A list of ingredients. | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | -| `Classes` | [][shared.Ingredient](../../models/shared/ingredient.md) | :heavy_minus_sign: | A list of ingredients. | \ No newline at end of file +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/requestbody.md b/docs/models/operations/requestbody.md deleted file mode 100755 index d1d655d..0000000 --- a/docs/models/operations/requestbody.md +++ /dev/null @@ -1,9 +0,0 @@ -# RequestBody - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | -| `URL` | **string* | :heavy_minus_sign: | N/A | -| `Webhook` | [*Webhook](../../models/operations/webhook.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscribetowebhooksrequestbody.md b/docs/models/operations/subscribetowebhooksrequestbody.md new file mode 100755 index 0000000..c18add6 --- /dev/null +++ b/docs/models/operations/subscribetowebhooksrequestbody.md @@ -0,0 +1,9 @@ +# SubscribeToWebhooksRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `URL` | **string* | :heavy_minus_sign: | N/A | +| `Webhook` | [*SubscribeToWebhooksRequestBodyWebhook](../../models/operations/subscribetowebhooksrequestbodywebhook.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscribetowebhooksrequestbodywebhook.md b/docs/models/operations/subscribetowebhooksrequestbodywebhook.md new file mode 100755 index 0000000..8a5c382 --- /dev/null +++ b/docs/models/operations/subscribetowebhooksrequestbodywebhook.md @@ -0,0 +1,8 @@ +# SubscribeToWebhooksRequestBodyWebhook + + +## Values + +| Name | Value | +| -------------------------------------------------- | -------------------------------------------------- | +| `SubscribeToWebhooksRequestBodyWebhookStockUpdate` | stockUpdate | \ No newline at end of file diff --git a/docs/models/operations/webhook.md b/docs/models/operations/webhook.md deleted file mode 100755 index 042f4e3..0000000 --- a/docs/models/operations/webhook.md +++ /dev/null @@ -1,8 +0,0 @@ -# Webhook - - -## Values - -| Name | Value | -| -------------------- | -------------------- | -| `WebhookStockUpdate` | stockUpdate | \ No newline at end of file diff --git a/docs/models/shared/order.md b/docs/models/shared/order.md index b6512c7..7bb4b41 100755 --- a/docs/models/shared/order.md +++ b/docs/models/shared/order.md @@ -9,5 +9,5 @@ An order for a drink or ingredient. | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ProductCode` | *string* | :heavy_check_mark: | The product code of the drink or ingredient. | AC-A2DF3 | | `Quantity` | *int64* | :heavy_check_mark: | The number of units of the drink or ingredient to order. | | -| `Status` | [Status](../../models/shared/status.md) | :heavy_check_mark: | The status of the order. | | +| `Status` | [OrderStatus](../../models/shared/orderstatus.md) | :heavy_check_mark: | The status of the order. | | | `Type` | [OrderType](../../models/shared/ordertype.md) | :heavy_check_mark: | The type of order. | | \ No newline at end of file diff --git a/docs/models/shared/orderstatus.md b/docs/models/shared/orderstatus.md new file mode 100755 index 0000000..58275fc --- /dev/null +++ b/docs/models/shared/orderstatus.md @@ -0,0 +1,12 @@ +# OrderStatus + +The status of the order. + + +## Values + +| Name | Value | +| ----------------------- | ----------------------- | +| `OrderStatusPending` | pending | +| `OrderStatusProcessing` | processing | +| `OrderStatusComplete` | complete | \ No newline at end of file diff --git a/docs/models/shared/status.md b/docs/models/shared/status.md deleted file mode 100755 index 99ae9a8..0000000 --- a/docs/models/shared/status.md +++ /dev/null @@ -1,12 +0,0 @@ -# Status - -The status of the order. - - -## Values - -| Name | Value | -| ------------------ | ------------------ | -| `StatusPending` | pending | -| `StatusProcessing` | processing | -| `StatusComplete` | complete | \ No newline at end of file diff --git a/docs/models/webhooks/stockupdaterequestbody.md b/docs/models/webhooks/stockupdaterequestbodyinput.md similarity index 97% rename from docs/models/webhooks/stockupdaterequestbody.md rename to docs/models/webhooks/stockupdaterequestbodyinput.md index 7fb1e6e..ef9aa7c 100755 --- a/docs/models/webhooks/stockupdaterequestbody.md +++ b/docs/models/webhooks/stockupdaterequestbodyinput.md @@ -1,4 +1,4 @@ -# StockUpdateRequestBody +# StockUpdateRequestBodyInput ## Fields diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md index d2d900e..8ab6056 100755 --- a/docs/sdks/authentication/README.md +++ b/docs/sdks/authentication/README.md @@ -1,5 +1,5 @@ # Authentication -(*.Authentication*) +(*Authentication*) ## Overview @@ -37,7 +37,7 @@ func main() { log.Fatal(err) } - if res.Object != nil { + if res.Authenticate200ApplicationJSONObject != nil { // handle response } } diff --git a/docs/sdks/config/README.md b/docs/sdks/config/README.md index a0a7e11..b444de4 100755 --- a/docs/sdks/config/README.md +++ b/docs/sdks/config/README.md @@ -1,5 +1,5 @@ # Config -(*.Config*) +(*Config*) ### Available Operations @@ -28,8 +28,8 @@ func main() { ) ctx := context.Background() - res, err := s.Config.SubscribeToWebhooks(ctx, []operations.RequestBody{ - operations.RequestBody{}, + res, err := s.Config.SubscribeToWebhooks(ctx, []operations.SubscribeToWebhooksRequestBody{ + operations.SubscribeToWebhooksRequestBody{}, }) if err != nil { log.Fatal(err) @@ -43,10 +43,10 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [[]operations.RequestBody](../../models//.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [[]operations.SubscribeToWebhooksRequestBody](../../models//.md) | :heavy_check_mark: | The request object to use for the request. | ### Response diff --git a/docs/sdks/drinks/README.md b/docs/sdks/drinks/README.md index ad782b3..a57b0ec 100755 --- a/docs/sdks/drinks/README.md +++ b/docs/sdks/drinks/README.md @@ -1,5 +1,5 @@ # Drinks -(*.Drinks*) +(*Drinks*) ## Overview @@ -89,7 +89,7 @@ func main() { log.Fatal(err) } - if res.Classes != nil { + if res.Drinks != nil { // handle response } } diff --git a/docs/sdks/ingredients/README.md b/docs/sdks/ingredients/README.md index 2576edd..b044219 100755 --- a/docs/sdks/ingredients/README.md +++ b/docs/sdks/ingredients/README.md @@ -1,5 +1,5 @@ # Ingredients -(*.Ingredients*) +(*Ingredients*) ## Overview @@ -41,7 +41,7 @@ func main() { log.Fatal(err) } - if res.Classes != nil { + if res.Ingredients != nil { // handle response } } diff --git a/docs/sdks/orders/README.md b/docs/sdks/orders/README.md index e6027d4..0968a12 100755 --- a/docs/sdks/orders/README.md +++ b/docs/sdks/orders/README.md @@ -1,5 +1,5 @@ # Orders -(*.Orders*) +(*Orders*) ## Overview diff --git a/drinks.go b/drinks.go index a79d121..69aa468 100755 --- a/drinks.go +++ b/drinks.go @@ -15,20 +15,20 @@ import ( "strings" ) -// Drinks - The drinks endpoints. -type Drinks struct { +// The drinks endpoints. +type drinks struct { sdkConfiguration sdkConfiguration } -func newDrinks(sdkConfig sdkConfiguration) *Drinks { - return &Drinks{ +func newDrinks(sdkConfig sdkConfiguration) *drinks { + return &drinks{ sdkConfiguration: sdkConfig, } } // GetDrink - Get a drink. // Get a drink by name, if authenticated this will include stock levels and product codes otherwise it will only include public information. -func (s *Drinks) GetDrink(ctx context.Context, name string) (*operations.GetDrinkResponse, error) { +func (s *drinks) GetDrink(ctx context.Context, name string) (*operations.GetDrinkResponse, error) { request := operations.GetDrinkRequest{ Name: name, } @@ -115,7 +115,7 @@ func (s *Drinks) GetDrink(ctx context.Context, name string) (*operations.GetDrin // ListDrinks - Get a list of drinks. // Get a list of drinks, if authenticated this will include stock levels and product codes otherwise it will only include public information. -func (s *Drinks) ListDrinks(ctx context.Context, drinkType *shared.DrinkType) (*operations.ListDrinksResponse, error) { +func (s *drinks) ListDrinks(ctx context.Context, drinkType *shared.DrinkType) (*operations.ListDrinksResponse, error) { request := operations.ListDrinksRequest{ DrinkType: drinkType, } @@ -167,7 +167,7 @@ func (s *Drinks) ListDrinks(ctx context.Context, drinkType *shared.DrinkType) (* return nil, err } - res.Classes = out + res.Drinks = out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/files.gen b/files.gen index e03cfcf..302e2cc 100755 --- a/files.gen +++ b/files.gen @@ -42,10 +42,10 @@ pkg/models/callbacks/createorder.go pkg/models/webhooks/stockupdate.go USAGE.md docs/models/operations/authenticaterequestbody.md -docs/models/operations/authenticateresponsebody.md +docs/models/operations/authenticate200applicationjson.md docs/models/operations/authenticateresponse.md -docs/models/operations/webhook.md -docs/models/operations/requestbody.md +docs/models/operations/subscribetowebhooksrequestbodywebhook.md +docs/models/operations/subscribetowebhooksrequestbody.md docs/models/operations/subscribetowebhooksresponse.md docs/models/operations/getdrinkrequest.md docs/models/operations/getdrinkresponse.md @@ -63,15 +63,15 @@ docs/models/shared/ingredientinput.md docs/models/shared/ingredient.md docs/models/shared/ingredienttype.md docs/models/shared/orderinput.md -docs/models/shared/status.md +docs/models/shared/orderstatus.md docs/models/shared/order.md docs/models/shared/ordertype.md docs/models/shared/security.md docs/models/errors/apierror.md docs/models/callbacks/createorderorderupdateresponse.md -docs/models/callbacks/createorderorderupdaterequestbody.md +docs/models/callbacks/createorderorderupdaterequestbodyinput.md docs/models/webhooks/stockupdateresponse.md -docs/models/webhooks/stockupdaterequestbody.md +docs/models/webhooks/stockupdaterequestbodyinput.md docs/sdks/speakeasy/README.md docs/sdks/authentication/README.md docs/sdks/config/README.md diff --git a/gen.yaml b/gen.yaml index 1516e03..6d266e4 100644 --- a/gen.yaml +++ b/gen.yaml @@ -2,8 +2,8 @@ configVersion: 1.0.0 management: docChecksum: abbc3a8faac54f76013e5d509a8d11ec docVersion: 1.0.0 - speakeasyVersion: 1.110.0 - generationVersion: 2.175.0 + speakeasyVersion: 1.109.2 + generationVersion: 2.173.0 generation: comments: disableComments: false @@ -19,7 +19,7 @@ generation: telemetryEnabled: false features: go: - core: 3.0.1 + core: 2.94.0 devContainers: 2.90.0 errors: 2.81.7 examples: 2.81.3 @@ -29,7 +29,7 @@ features: inputOutputModels: 2.81.1 serverIDs: 2.81.1 go: - version: 0.4.0 + version: 0.5.0 clientServerStatusCodesAsErrors: true flattenGlobalSecurity: true installationURL: https://github.com/speakeasy-sdks/template-speakeasy-bar diff --git a/ingredients.go b/ingredients.go index 774dad8..93020ec 100755 --- a/ingredients.go +++ b/ingredients.go @@ -15,20 +15,20 @@ import ( "strings" ) -// Ingredients - The ingredients endpoints. -type Ingredients struct { +// The ingredients endpoints. +type ingredients struct { sdkConfiguration sdkConfiguration } -func newIngredients(sdkConfig sdkConfiguration) *Ingredients { - return &Ingredients{ +func newIngredients(sdkConfig sdkConfiguration) *ingredients { + return &ingredients{ sdkConfiguration: sdkConfig, } } // ListIngredients - Get a list of ingredients. // Get a list of ingredients, if authenticated this will include stock levels and product codes otherwise it will only include public information. -func (s *Ingredients) ListIngredients(ctx context.Context, ingredients []string) (*operations.ListIngredientsResponse, error) { +func (s *ingredients) ListIngredients(ctx context.Context, ingredients []string) (*operations.ListIngredientsResponse, error) { request := operations.ListIngredientsRequest{ Ingredients: ingredients, } @@ -80,7 +80,7 @@ func (s *Ingredients) ListIngredients(ctx context.Context, ingredients []string) return nil, err } - res.Classes = out + res.Ingredients = out default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/orders.go b/orders.go index 0891095..6189974 100755 --- a/orders.go +++ b/orders.go @@ -15,20 +15,20 @@ import ( "strings" ) -// Orders - The orders endpoints. -type Orders struct { +// The orders endpoints. +type orders struct { sdkConfiguration sdkConfiguration } -func newOrders(sdkConfig sdkConfiguration) *Orders { - return &Orders{ +func newOrders(sdkConfig sdkConfiguration) *orders { + return &orders{ sdkConfiguration: sdkConfig, } } // CreateOrder - Create an order. // Create an order for a drink. -func (s *Orders) CreateOrder(ctx context.Context, requestBody []shared.OrderInput, callbackURL *string) (*operations.CreateOrderResponse, error) { +func (s *orders) CreateOrder(ctx context.Context, requestBody []shared.OrderInput, callbackURL *string) (*operations.CreateOrderResponse, error) { request := operations.CreateOrderRequest{ RequestBody: requestBody, CallbackURL: callbackURL, diff --git a/pkg/models/callbacks/createorder.go b/pkg/models/callbacks/createorder.go index aa4e25c..a08290c 100755 --- a/pkg/models/callbacks/createorder.go +++ b/pkg/models/callbacks/createorder.go @@ -46,12 +46,12 @@ func (o *CreateOrderOrderUpdateResponse) GetRawResponse() *http.Response { return o.RawResponse } -type CreateOrderOrderUpdateRequestBody struct { +type CreateOrderOrderUpdateRequestBodyInput struct { // An order for a drink or ingredient. Order *shared.OrderInput `json:"order,omitempty"` } -func (o *CreateOrderOrderUpdateRequestBody) GetOrder() *shared.OrderInput { +func (o *CreateOrderOrderUpdateRequestBodyInput) GetOrder() *shared.OrderInput { if o == nil { return nil } diff --git a/pkg/models/operations/authenticate.go b/pkg/models/operations/authenticate.go index 4c49640..01bc6e8 100755 --- a/pkg/models/operations/authenticate.go +++ b/pkg/models/operations/authenticate.go @@ -26,12 +26,12 @@ func (o *AuthenticateRequestBody) GetUsername() *string { return o.Username } -// AuthenticateResponseBody - The api key to use for authenticated endpoints. -type AuthenticateResponseBody struct { +// Authenticate200ApplicationJSON - The api key to use for authenticated endpoints. +type Authenticate200ApplicationJSON struct { Token *string `json:"token,omitempty"` } -func (o *AuthenticateResponseBody) GetToken() *string { +func (o *Authenticate200ApplicationJSON) GetToken() *string { if o == nil { return nil } @@ -48,7 +48,7 @@ type AuthenticateResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // The api key to use for authenticated endpoints. - Object *AuthenticateResponseBody + Authenticate200ApplicationJSONObject *Authenticate200ApplicationJSON } func (o *AuthenticateResponse) GetContentType() string { @@ -79,9 +79,9 @@ func (o *AuthenticateResponse) GetRawResponse() *http.Response { return o.RawResponse } -func (o *AuthenticateResponse) GetObject() *AuthenticateResponseBody { +func (o *AuthenticateResponse) GetAuthenticate200ApplicationJSONObject() *Authenticate200ApplicationJSON { if o == nil { return nil } - return o.Object + return o.Authenticate200ApplicationJSONObject } diff --git a/pkg/models/operations/listdrinks.go b/pkg/models/operations/listdrinks.go index c002cc2..5e66190 100755 --- a/pkg/models/operations/listdrinks.go +++ b/pkg/models/operations/listdrinks.go @@ -22,14 +22,14 @@ func (o *ListDrinksRequest) GetDrinkType() *shared.DrinkType { type ListDrinksResponse struct { // HTTP response content type for this operation ContentType string + // A list of drinks. + Drinks []shared.Drink // An unknown error occurred interacting with the API. Error *shared.Error // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response - // A list of drinks. - Classes []shared.Drink } func (o *ListDrinksResponse) GetContentType() string { @@ -39,6 +39,13 @@ func (o *ListDrinksResponse) GetContentType() string { return o.ContentType } +func (o *ListDrinksResponse) GetDrinks() []shared.Drink { + if o == nil { + return nil + } + return o.Drinks +} + func (o *ListDrinksResponse) GetError() *shared.Error { if o == nil { return nil @@ -59,10 +66,3 @@ func (o *ListDrinksResponse) GetRawResponse() *http.Response { } return o.RawResponse } - -func (o *ListDrinksResponse) GetClasses() []shared.Drink { - if o == nil { - return nil - } - return o.Classes -} diff --git a/pkg/models/operations/listingredients.go b/pkg/models/operations/listingredients.go index 4208e52..5327e8d 100755 --- a/pkg/models/operations/listingredients.go +++ b/pkg/models/operations/listingredients.go @@ -24,12 +24,12 @@ type ListIngredientsResponse struct { ContentType string // An unknown error occurred interacting with the API. Error *shared.Error + // A list of ingredients. + Ingredients []shared.Ingredient // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response - // A list of ingredients. - Classes []shared.Ingredient } func (o *ListIngredientsResponse) GetContentType() string { @@ -46,6 +46,13 @@ func (o *ListIngredientsResponse) GetError() *shared.Error { return o.Error } +func (o *ListIngredientsResponse) GetIngredients() []shared.Ingredient { + if o == nil { + return nil + } + return o.Ingredients +} + func (o *ListIngredientsResponse) GetStatusCode() int { if o == nil { return 0 @@ -59,10 +66,3 @@ func (o *ListIngredientsResponse) GetRawResponse() *http.Response { } return o.RawResponse } - -func (o *ListIngredientsResponse) GetClasses() []shared.Ingredient { - if o == nil { - return nil - } - return o.Classes -} diff --git a/pkg/models/operations/subscribetowebhooks.go b/pkg/models/operations/subscribetowebhooks.go index 4c3220f..93673f4 100755 --- a/pkg/models/operations/subscribetowebhooks.go +++ b/pkg/models/operations/subscribetowebhooks.go @@ -9,43 +9,43 @@ import ( "net/http" ) -type Webhook string +type SubscribeToWebhooksRequestBodyWebhook string const ( - WebhookStockUpdate Webhook = "stockUpdate" + SubscribeToWebhooksRequestBodyWebhookStockUpdate SubscribeToWebhooksRequestBodyWebhook = "stockUpdate" ) -func (e Webhook) ToPointer() *Webhook { +func (e SubscribeToWebhooksRequestBodyWebhook) ToPointer() *SubscribeToWebhooksRequestBodyWebhook { return &e } -func (e *Webhook) UnmarshalJSON(data []byte) error { +func (e *SubscribeToWebhooksRequestBodyWebhook) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case "stockUpdate": - *e = Webhook(v) + *e = SubscribeToWebhooksRequestBodyWebhook(v) return nil default: - return fmt.Errorf("invalid value for Webhook: %v", v) + return fmt.Errorf("invalid value for SubscribeToWebhooksRequestBodyWebhook: %v", v) } } -type RequestBody struct { - URL *string `json:"url,omitempty"` - Webhook *Webhook `json:"webhook,omitempty"` +type SubscribeToWebhooksRequestBody struct { + URL *string `json:"url,omitempty"` + Webhook *SubscribeToWebhooksRequestBodyWebhook `json:"webhook,omitempty"` } -func (o *RequestBody) GetURL() *string { +func (o *SubscribeToWebhooksRequestBody) GetURL() *string { if o == nil { return nil } return o.URL } -func (o *RequestBody) GetWebhook() *Webhook { +func (o *SubscribeToWebhooksRequestBody) GetWebhook() *SubscribeToWebhooksRequestBodyWebhook { if o == nil { return nil } diff --git a/pkg/models/shared/order.go b/pkg/models/shared/order.go index d08f9f9..2fd43fa 100755 --- a/pkg/models/shared/order.go +++ b/pkg/models/shared/order.go @@ -38,20 +38,20 @@ func (o *OrderInput) GetType() OrderType { return o.Type } -// Status - The status of the order. -type Status string +// OrderStatus - The status of the order. +type OrderStatus string const ( - StatusPending Status = "pending" - StatusProcessing Status = "processing" - StatusComplete Status = "complete" + OrderStatusPending OrderStatus = "pending" + OrderStatusProcessing OrderStatus = "processing" + OrderStatusComplete OrderStatus = "complete" ) -func (e Status) ToPointer() *Status { +func (e OrderStatus) ToPointer() *OrderStatus { return &e } -func (e *Status) UnmarshalJSON(data []byte) error { +func (e *OrderStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -62,10 +62,10 @@ func (e *Status) UnmarshalJSON(data []byte) error { case "processing": fallthrough case "complete": - *e = Status(v) + *e = OrderStatus(v) return nil default: - return fmt.Errorf("invalid value for Status: %v", v) + return fmt.Errorf("invalid value for OrderStatus: %v", v) } } @@ -76,7 +76,7 @@ type Order struct { // The number of units of the drink or ingredient to order. Quantity int64 `json:"quantity"` // The status of the order. - Status Status `json:"status"` + Status OrderStatus `json:"status"` // The type of order. Type OrderType `json:"type"` } @@ -95,9 +95,9 @@ func (o *Order) GetQuantity() int64 { return o.Quantity } -func (o *Order) GetStatus() Status { +func (o *Order) GetStatus() OrderStatus { if o == nil { - return Status("") + return OrderStatus("") } return o.Status } diff --git a/pkg/models/webhooks/stockupdate.go b/pkg/models/webhooks/stockupdate.go index a5418d0..f450b79 100755 --- a/pkg/models/webhooks/stockupdate.go +++ b/pkg/models/webhooks/stockupdate.go @@ -46,19 +46,19 @@ func (o *StockUpdateResponse) GetRawResponse() *http.Response { return o.RawResponse } -type StockUpdateRequestBody struct { +type StockUpdateRequestBodyInput struct { Drink *shared.DrinkInput `json:"drink,omitempty"` Ingredient *shared.IngredientInput `json:"ingredient,omitempty"` } -func (o *StockUpdateRequestBody) GetDrink() *shared.DrinkInput { +func (o *StockUpdateRequestBodyInput) GetDrink() *shared.DrinkInput { if o == nil { return nil } return o.Drink } -func (o *StockUpdateRequestBody) GetIngredient() *shared.IngredientInput { +func (o *StockUpdateRequestBodyInput) GetIngredient() *shared.IngredientInput { if o == nil { return nil } diff --git a/speakeasy.go b/speakeasy.go index 8372ead..d3b931e 100755 --- a/speakeasy.go +++ b/speakeasy.go @@ -84,14 +84,14 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { // https://docs.speakeasy.bar - The Speakeasy Bar Documentation. type Speakeasy struct { // The authentication endpoints. - Authentication *Authentication - Config *Config + Authentication *authentication + Config *config // The drinks endpoints. - Drinks *Drinks + Drinks *drinks // The ingredients endpoints. - Ingredients *Ingredients + Ingredients *ingredients // The orders endpoints. - Orders *Orders + Orders *orders sdkConfiguration sdkConfiguration } @@ -219,9 +219,9 @@ func New(opts ...SDKOption) *Speakeasy { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.4.0", - GenVersion: "2.175.0", - UserAgent: "speakeasy-sdk/go 0.4.0 2.175.0 1.0.0 github.com/speakeasy-sdks/template-speakeasy-bar", + SDKVersion: "0.5.0", + GenVersion: "2.173.0", + UserAgent: "speakeasy-sdk/go 0.5.0 2.173.0 1.0.0 github.com/speakeasy-sdks/template-speakeasy-bar", ServerDefaults: map[string]map[string]string{ "prod": {}, "staging": {},