Documentation ΒΆ
Index ΒΆ
- Constants
- Variables
- func Bool(b bool) *bool
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func Int(i int) *int
- func Int64(i int64) *int64
- func String(s string) *string
- type APIError
- type Authentication
- type BadRequest
- type Config
- type CreateOrderOrderUpdateRequestBody
- type CreateOrderOrderUpdateResponse
- type CreateOrderRequest
- type CreateOrderResponse
- type Drink
- type DrinkInput
- type DrinkType
- type Drinks
- type Error
- type GetDrinkRequest
- type GetDrinkResponse
- type HTTPClient
- type Ingredient
- type IngredientInput
- type IngredientType
- type Ingredients
- type ListDrinksRequest
- type ListDrinksResponse
- type ListIngredientsRequest
- type ListIngredientsResponse
- type LoginRequestBody
- type LoginResponse
- type LoginResponseBody
- type LoginSecurity
- type Option
- type Options
- type Order
- type OrderInput
- type OrderType
- type Orders
- type RequestBody
- type SDKError
- type SDKOption
- func WithClient(client HTTPClient) SDKOption
- func WithEnvironment(environment ServerEnvironment) SDKOption
- func WithOrganization(organization string) SDKOption
- func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption
- func WithSecurity(security Security) SDKOption
- func WithSecuritySource(security func(context.Context) (Security, error)) SDKOption
- func WithServer(server string) SDKOption
- func WithServerURL(serverURL string) SDKOption
- func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption
- type Security
- type ServerEnvironment
- type Speakeasy
- type Status
- type StockUpdateRequestBody
- type StockUpdateResponse
- type SubscribeToWebhooksResponse
- type Type
- type Webhook
Constants ΒΆ
const ( SupportedOptionServerURL = "serverURL" SupportedOptionRetries = "retries" SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" )
const ( // The production server. ServerProd string = "prod" // The staging server. ServerStaging string = "staging" // A per-organization and per-environment API. ServerCustomer string = "customer" )
Variables ΒΆ
var ErrUnsupportedOption = errors.New("unsupported option")
var ListDrinksOpServerList = []string{
"https://speakeasy.bar",
"https://test.speakeasy.bar",
}
var ServerList = map[string]string{ ServerProd: "https://speakeasy.bar", ServerStaging: "https://staging.speakeasy.bar", ServerCustomer: "https://{organization}.{environment}.speakeasy.bar", }
ServerList contains the list of servers available to the SDK
Functions ΒΆ
Types ΒΆ
type APIError ΒΆ
type APIError struct { Code *string `json:"code,omitempty"` Message *string `json:"message,omitempty"` Details map[string]interface{} `json:"details,omitempty"` }
APIError - An error occurred interacting with the API.
type Authentication ΒΆ
type Authentication struct {
// contains filtered or unexported fields
}
Authentication - The authentication endpoints.
func (*Authentication) Login ΒΆ
func (s *Authentication) Login(ctx context.Context, request LoginRequestBody, security LoginSecurity) (*LoginResponse, error)
Login - Authenticate with the API by providing a username and password.
type BadRequest ΒΆ added in v0.2.1
type BadRequest struct { // HTTP status code StatusCode *float64 `json:"status_code,omitempty"` // Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) Error_ *string `json:"error,omitempty"` // The type of error returned TypeName *string `json:"type_name,omitempty"` }
func (*BadRequest) Error ΒΆ added in v0.2.1
func (e *BadRequest) Error() string
type Config ΒΆ
type Config struct {
// contains filtered or unexported fields
}
func (*Config) SubscribeToWebhooks ΒΆ
func (s *Config) SubscribeToWebhooks(ctx context.Context, request []RequestBody, opts ...Option) (*SubscribeToWebhooksResponse, error)
SubscribeToWebhooks - Subscribe to webhooks. Subscribe to webhooks.
type CreateOrderOrderUpdateRequestBody ΒΆ
type CreateOrderOrderUpdateRequestBody struct { // An order for a drink or ingredient. Order *OrderInput `json:"order,omitempty"` }
func (*CreateOrderOrderUpdateRequestBody) GetOrder ΒΆ
func (o *CreateOrderOrderUpdateRequestBody) GetOrder() *OrderInput
type CreateOrderOrderUpdateResponse ΒΆ
type CreateOrderOrderUpdateResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // An unknown error occurred interacting with the API. Error *Error }
func (*CreateOrderOrderUpdateResponse) GetContentType ΒΆ
func (o *CreateOrderOrderUpdateResponse) GetContentType() string
func (*CreateOrderOrderUpdateResponse) GetError ΒΆ added in v0.3.0
func (o *CreateOrderOrderUpdateResponse) GetError() *Error
func (*CreateOrderOrderUpdateResponse) GetRawResponse ΒΆ
func (o *CreateOrderOrderUpdateResponse) GetRawResponse() *http.Response
func (*CreateOrderOrderUpdateResponse) GetStatusCode ΒΆ
func (o *CreateOrderOrderUpdateResponse) GetStatusCode() int
type CreateOrderRequest ΒΆ
type CreateOrderRequest struct { RequestBody []OrderInput `request:"mediaType=application/json"` // The url to call when the order is updated. CallbackURL *string `queryParam:"style=form,explode=true,name=callback_url"` }
func (*CreateOrderRequest) GetCallbackURL ΒΆ
func (o *CreateOrderRequest) GetCallbackURL() *string
func (*CreateOrderRequest) GetRequestBody ΒΆ
func (o *CreateOrderRequest) GetRequestBody() []OrderInput
type CreateOrderResponse ΒΆ
type CreateOrderResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // The order was created successfully. Order *Order // An unknown error occurred interacting with the API. Error *Error }
func (*CreateOrderResponse) GetContentType ΒΆ
func (o *CreateOrderResponse) GetContentType() string
func (*CreateOrderResponse) GetError ΒΆ added in v0.3.0
func (o *CreateOrderResponse) GetError() *Error
func (*CreateOrderResponse) GetOrder ΒΆ
func (o *CreateOrderResponse) GetOrder() *Order
func (*CreateOrderResponse) GetRawResponse ΒΆ
func (o *CreateOrderResponse) GetRawResponse() *http.Response
func (*CreateOrderResponse) GetStatusCode ΒΆ
func (o *CreateOrderResponse) GetStatusCode() int
type Drink ΒΆ
type Drink struct { // The name of the drink. Name string `json:"name"` // The type of drink. Type *DrinkType `json:"type,omitempty"` // The price of one unit of the drink in US cents. Price float64 `json:"price"` // The number of units of the drink in stock, only available when authenticated. Stock *int64 `json:"stock,omitempty"` // The product code of the drink, only available when authenticated. ProductCode *string `json:"productCode,omitempty"` }
func (*Drink) GetProductCode ΒΆ
type DrinkInput ΒΆ
type DrinkInput struct { // The name of the drink. Name string `json:"name"` // The type of drink. Type *DrinkType `json:"type,omitempty"` // The price of one unit of the drink in US cents. Price float64 `json:"price"` // The product code of the drink, only available when authenticated. ProductCode *string `json:"productCode,omitempty"` }
func (*DrinkInput) GetName ΒΆ
func (o *DrinkInput) GetName() string
func (*DrinkInput) GetPrice ΒΆ
func (o *DrinkInput) GetPrice() float64
func (*DrinkInput) GetProductCode ΒΆ
func (o *DrinkInput) GetProductCode() *string
func (*DrinkInput) GetType ΒΆ
func (o *DrinkInput) GetType() *DrinkType
type DrinkType ΒΆ
type DrinkType string
DrinkType - The type of drink.
func (*DrinkType) UnmarshalJSON ΒΆ
type Drinks ΒΆ
type Drinks struct {
// contains filtered or unexported fields
}
Drinks - The drinks endpoints.
func (*Drinks) GetDrink ΒΆ
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 (*Drinks) ListDrinks ΒΆ
func (s *Drinks) ListDrinks(ctx context.Context, drinkType *DrinkType, opts ...Option) (*ListDrinksResponse, error)
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.
type Error ΒΆ added in v0.3.0
type Error struct { Code *string `json:"code,omitempty"` Message *string `json:"message,omitempty"` }
func (*Error) GetMessage ΒΆ added in v0.3.0
type GetDrinkRequest ΒΆ
type GetDrinkRequest struct {
Name string `pathParam:"style=simple,explode=false,name=name"`
}
func (*GetDrinkRequest) GetName ΒΆ
func (o *GetDrinkRequest) GetName() string
type GetDrinkResponse ΒΆ
type GetDrinkResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // A drink. Drink *Drink // An unknown error occurred interacting with the API. Error *Error }
func (*GetDrinkResponse) GetContentType ΒΆ
func (o *GetDrinkResponse) GetContentType() string
func (*GetDrinkResponse) GetDrink ΒΆ
func (o *GetDrinkResponse) GetDrink() *Drink
func (*GetDrinkResponse) GetError ΒΆ added in v0.3.0
func (o *GetDrinkResponse) GetError() *Error
func (*GetDrinkResponse) GetRawResponse ΒΆ
func (o *GetDrinkResponse) GetRawResponse() *http.Response
func (*GetDrinkResponse) GetStatusCode ΒΆ
func (o *GetDrinkResponse) GetStatusCode() int
type HTTPClient ΒΆ
HTTPClient provides an interface for suplying the SDK with a custom HTTP client
type Ingredient ΒΆ
type Ingredient struct { // The name of the ingredient. Name string `json:"name"` // The type of ingredient. Type IngredientType `json:"type"` // The number of units of the ingredient in stock, only available when authenticated. Stock *int64 `json:"stock,omitempty"` // The product code of the ingredient, only available when authenticated. ProductCode *string `json:"productCode,omitempty"` }
func (*Ingredient) GetName ΒΆ
func (o *Ingredient) GetName() string
func (*Ingredient) GetProductCode ΒΆ
func (o *Ingredient) GetProductCode() *string
func (*Ingredient) GetStock ΒΆ
func (o *Ingredient) GetStock() *int64
func (*Ingredient) GetType ΒΆ
func (o *Ingredient) GetType() IngredientType
type IngredientInput ΒΆ
type IngredientInput struct { // The name of the ingredient. Name string `json:"name"` // The type of ingredient. Type IngredientType `json:"type"` // The product code of the ingredient, only available when authenticated. ProductCode *string `json:"productCode,omitempty"` }
func (*IngredientInput) GetName ΒΆ
func (o *IngredientInput) GetName() string
func (*IngredientInput) GetProductCode ΒΆ
func (o *IngredientInput) GetProductCode() *string
func (*IngredientInput) GetType ΒΆ
func (o *IngredientInput) GetType() IngredientType
type IngredientType ΒΆ
type IngredientType string
IngredientType - The type of ingredient.
const ( IngredientTypeFresh IngredientType = "fresh" IngredientTypeLongLife IngredientType = "long-life" IngredientTypePackaged IngredientType = "packaged" )
func (IngredientType) ToPointer ΒΆ
func (e IngredientType) ToPointer() *IngredientType
func (*IngredientType) UnmarshalJSON ΒΆ
func (e *IngredientType) UnmarshalJSON(data []byte) error
type Ingredients ΒΆ
type Ingredients struct {
// contains filtered or unexported fields
}
Ingredients - The ingredients endpoints.
func (*Ingredients) ListIngredients ΒΆ
func (s *Ingredients) ListIngredients(ctx context.Context, ingredients []string) (*ListIngredientsResponse, error)
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.
type ListDrinksRequest ΒΆ
type ListDrinksRequest struct { // The type of drink to filter by. If not provided all drinks will be returned. DrinkType *DrinkType `queryParam:"style=form,explode=true,name=drinkType"` }
func (*ListDrinksRequest) GetDrinkType ΒΆ
func (o *ListDrinksRequest) GetDrinkType() *DrinkType
type ListDrinksResponse ΒΆ
type ListDrinksResponse struct { // HTTP response content type for this operation ContentType string // 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 []Drink // An unknown error occurred interacting with the API. Error *Error }
func (*ListDrinksResponse) GetClasses ΒΆ
func (o *ListDrinksResponse) GetClasses() []Drink
func (*ListDrinksResponse) GetContentType ΒΆ
func (o *ListDrinksResponse) GetContentType() string
func (*ListDrinksResponse) GetError ΒΆ added in v0.3.0
func (o *ListDrinksResponse) GetError() *Error
func (*ListDrinksResponse) GetRawResponse ΒΆ
func (o *ListDrinksResponse) GetRawResponse() *http.Response
func (*ListDrinksResponse) GetStatusCode ΒΆ
func (o *ListDrinksResponse) GetStatusCode() int
type ListIngredientsRequest ΒΆ
type ListIngredientsRequest struct { // A list of ingredients to filter by. If not provided all ingredients will be returned. Ingredients []string `queryParam:"style=form,explode=false,name=ingredients"` }
func (*ListIngredientsRequest) GetIngredients ΒΆ
func (o *ListIngredientsRequest) GetIngredients() []string
type ListIngredientsResponse ΒΆ
type ListIngredientsResponse struct { // HTTP response content type for this operation ContentType string // 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 []Ingredient // An unknown error occurred interacting with the API. Error *Error }
func (*ListIngredientsResponse) GetClasses ΒΆ
func (o *ListIngredientsResponse) GetClasses() []Ingredient
func (*ListIngredientsResponse) GetContentType ΒΆ
func (o *ListIngredientsResponse) GetContentType() string
func (*ListIngredientsResponse) GetError ΒΆ added in v0.3.0
func (o *ListIngredientsResponse) GetError() *Error
func (*ListIngredientsResponse) GetRawResponse ΒΆ
func (o *ListIngredientsResponse) GetRawResponse() *http.Response
func (*ListIngredientsResponse) GetStatusCode ΒΆ
func (o *ListIngredientsResponse) GetStatusCode() int
type LoginRequestBody ΒΆ
type LoginRequestBody struct {
Type Type `json:"type"`
}
func (*LoginRequestBody) GetType ΒΆ
func (o *LoginRequestBody) GetType() Type
type LoginResponse ΒΆ
type LoginResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // The api key to use for authenticated endpoints. Object *LoginResponseBody // An unknown error occurred interacting with the API. Error *Error }
func (*LoginResponse) GetContentType ΒΆ
func (o *LoginResponse) GetContentType() string
func (*LoginResponse) GetError ΒΆ added in v0.3.0
func (o *LoginResponse) GetError() *Error
func (*LoginResponse) GetObject ΒΆ
func (o *LoginResponse) GetObject() *LoginResponseBody
func (*LoginResponse) GetRawResponse ΒΆ
func (o *LoginResponse) GetRawResponse() *http.Response
func (*LoginResponse) GetStatusCode ΒΆ
func (o *LoginResponse) GetStatusCode() int
type LoginResponseBody ΒΆ
type LoginResponseBody struct {
Token *string `json:"token,omitempty"`
}
LoginResponseBody - The api key to use for authenticated endpoints.
func (*LoginResponseBody) GetToken ΒΆ
func (o *LoginResponseBody) GetToken() *string
type LoginSecurity ΒΆ
type LoginSecurity struct { Username string `security:"scheme,type=http,subtype=basic,name=username"` Password string `security:"scheme,type=http,subtype=basic,name=password"` }
func (*LoginSecurity) GetPassword ΒΆ
func (o *LoginSecurity) GetPassword() string
func (*LoginSecurity) GetUsername ΒΆ
func (o *LoginSecurity) GetUsername() string
type Option ΒΆ
func WithMethodServerURL ΒΆ
WithMethodServerURL allows providing an alternative server URL.
func WithMethodTemplatedServerURL ΒΆ
WithMethodTemplatedServerURL allows providing an alternative server URL with templated parameters.
func WithRetries ΒΆ
func WithRetries(config utils.RetryConfig) Option
WithRetries allows customizing the default retry configuration.
type Options ΒΆ
type Options struct { ServerURL *string Retries *utils.RetryConfig }
type Order ΒΆ
type Order struct { // The type of order. Type OrderType `json:"type"` // The product code of the drink or ingredient. ProductCode string `json:"productCode"` // The number of units of the drink or ingredient to order. Quantity int64 `json:"quantity"` // The status of the order. Status Status `json:"status"` }
Order - An order for a drink or ingredient.
func (*Order) GetProductCode ΒΆ
func (*Order) GetQuantity ΒΆ
type OrderInput ΒΆ
type OrderInput struct { // The type of order. Type OrderType `json:"type"` // The product code of the drink or ingredient. ProductCode string `json:"productCode"` // The number of units of the drink or ingredient to order. Quantity int64 `json:"quantity"` }
OrderInput - An order for a drink or ingredient.
func (*OrderInput) GetProductCode ΒΆ
func (o *OrderInput) GetProductCode() string
func (*OrderInput) GetQuantity ΒΆ
func (o *OrderInput) GetQuantity() int64
func (*OrderInput) GetType ΒΆ
func (o *OrderInput) GetType() OrderType
type OrderType ΒΆ
type OrderType string
OrderType - The type of order.
func (*OrderType) UnmarshalJSON ΒΆ
type Orders ΒΆ
type Orders struct {
// contains filtered or unexported fields
}
Orders - The orders endpoints.
func (*Orders) CreateOrder ΒΆ
func (s *Orders) CreateOrder(ctx context.Context, requestBody []OrderInput, callbackURL *string) (*CreateOrderResponse, error)
CreateOrder - Create an order. Create an order for a drink.
type RequestBody ΒΆ
type RequestBody struct { URL *string `json:"url,omitempty"` Webhook *Webhook `json:"webhook,omitempty"` }
func (*RequestBody) GetURL ΒΆ
func (o *RequestBody) GetURL() *string
func (*RequestBody) GetWebhook ΒΆ
func (o *RequestBody) GetWebhook() *Webhook
type SDKError ΒΆ
func NewSDKError ΒΆ
type SDKOption ΒΆ
type SDKOption func(*Speakeasy)
func WithClient ΒΆ
func WithClient(client HTTPClient) SDKOption
WithClient allows the overriding of the default HTTP client used by the SDK
func WithEnvironment ΒΆ
func WithEnvironment(environment ServerEnvironment) SDKOption
WithEnvironment allows setting the environment variable for url substitution
func WithOrganization ΒΆ
WithOrganization allows setting the organization variable for url substitution
func WithRetryConfig ΒΆ
func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption
func WithSecurity ΒΆ
WithSecurity configures the SDK to use the provided security details
func WithSecuritySource ΒΆ
WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication
func WithServer ΒΆ
WithServer allows the overriding of the default server by name
func WithServerURL ΒΆ
WithServerURL allows the overriding of the default server URL
type Security ΒΆ
type Security struct { APIKey *string `security:"scheme,type=apiKey,subtype=header,name=Authorization"` BearerAuth *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` }
func (*Security) GetBearerAuth ΒΆ
type ServerEnvironment ΒΆ
type ServerEnvironment string
ServerEnvironment - The environment name. Defaults to the production environment.
const ( ServerEnvironmentProd ServerEnvironment = "prod" ServerEnvironmentStaging ServerEnvironment = "staging" ServerEnvironmentDev ServerEnvironment = "dev" )
func (ServerEnvironment) ToPointer ΒΆ
func (e ServerEnvironment) ToPointer() *ServerEnvironment
func (*ServerEnvironment) UnmarshalJSON ΒΆ
func (e *ServerEnvironment) UnmarshalJSON(data []byte) error
type Speakeasy ΒΆ
type Speakeasy struct { // The authentication endpoints. Authentication *Authentication // The drinks endpoints. Drinks *Drinks // The ingredients endpoints. Ingredients *Ingredients // The orders endpoints. Orders *Orders Config *Config // contains filtered or unexported fields }
The Speakeasy Bar: A bar that serves drinks. A secret underground bar that serves drinks to those in the know.
https://docs.speakeasy.bar - The Speakeasy Bar Documentation.
type StockUpdateRequestBody ΒΆ
type StockUpdateRequestBody struct { Drink *DrinkInput `json:"drink,omitempty"` Ingredient *IngredientInput `json:"ingredient,omitempty"` }
func (*StockUpdateRequestBody) GetDrink ΒΆ
func (o *StockUpdateRequestBody) GetDrink() *DrinkInput
func (*StockUpdateRequestBody) GetIngredient ΒΆ
func (o *StockUpdateRequestBody) GetIngredient() *IngredientInput
type StockUpdateResponse ΒΆ
type StockUpdateResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // An unknown error occurred interacting with the API. Error *Error }
func (*StockUpdateResponse) GetContentType ΒΆ
func (o *StockUpdateResponse) GetContentType() string
func (*StockUpdateResponse) GetError ΒΆ added in v0.3.0
func (o *StockUpdateResponse) GetError() *Error
func (*StockUpdateResponse) GetRawResponse ΒΆ
func (o *StockUpdateResponse) GetRawResponse() *http.Response
func (*StockUpdateResponse) GetStatusCode ΒΆ
func (o *StockUpdateResponse) GetStatusCode() int
type SubscribeToWebhooksResponse ΒΆ
type SubscribeToWebhooksResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // An unknown error occurred interacting with the API. Error *Error }
func (*SubscribeToWebhooksResponse) GetContentType ΒΆ
func (o *SubscribeToWebhooksResponse) GetContentType() string
func (*SubscribeToWebhooksResponse) GetError ΒΆ added in v0.3.0
func (o *SubscribeToWebhooksResponse) GetError() *Error
func (*SubscribeToWebhooksResponse) GetRawResponse ΒΆ
func (o *SubscribeToWebhooksResponse) GetRawResponse() *http.Response
func (*SubscribeToWebhooksResponse) GetStatusCode ΒΆ
func (o *SubscribeToWebhooksResponse) GetStatusCode() int
Source Files ΒΆ
- apierror.go
- authentication.go
- badrequest.go
- config.go
- createorderop.go
- drink.go
- drinkinput.go
- drinks.go
- drinktype.go
- error.go
- getdrinkop.go
- ingredient.go
- ingredientinput.go
- ingredients.go
- ingredienttype.go
- listdrinksop.go
- listingredientsop.go
- loginop.go
- options.go
- order.go
- orderinput.go
- orders.go
- ordertype.go
- sdkerror.go
- security.go
- speakeasy.go
- stockupdate.go
- subscribetowebhooksop.go