smapi

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Endpoint = "https://api.amazonalexa.com"
View Source
const LwaClientData = "secret.json"
View Source
const TokenPath = "token.json"

Variables

This section is empty.

Functions

func GenerateLwaTokens

func GenerateLwaTokens() error

GenerateLwaTokens calls the ask util generate-lwa-tokens and saves the token data to token.json where it can be used by the token source.

Follow the setup instructions at the following url, stopping before "Generate an access token".

https://developer.amazon.com/en-US/docs/alexa/smapi/get-access-token-smapi.html#configure-lwa-security-profile

Save the client_id and client_secret in secrets.json with the following format:
{
 "client_id": "ID",
 "client_secret": "SECRET"
}

Types

type ClientCredentials

type ClientCredentials struct {
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

type DelayRoundTripper added in v0.2.1

type DelayRoundTripper struct {
	Target      http.RoundTripper
	Delay       time.Duration
	LogRequests bool
}

func (*DelayRoundTripper) RoundTrip added in v0.2.1

func (d *DelayRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

type RefreshTokenRequest

type RefreshTokenRequest struct {
	GrantType    string `json:"grant_type"`
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	RefreshToken string `json:"refresh_token"`
}

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	TokenType    string    `json:"token_type"`
	ExpiresIn    int       `json:"expires_in"`
	ExpiresAt    time.Time `json:"expires_at"`
}

type Smapi added in v0.1.4

type Smapi struct {
	V0 *v0.Client
	V1 *v1.Client
}

func New added in v0.1.4

func New() *Smapi

func (*Smapi) GetSingleVendor added in v0.2.1

func (s *Smapi) GetSingleVendor() (string, error)

func (*Smapi) GetSkillIdForName added in v0.1.4

func (s *Smapi) GetSkillIdForName(name string) (id string, err error)

type TokenSource

type TokenSource struct{}

func (*TokenSource) Token

func (t *TokenSource) Token() (token *oauth2.Token, err error)

Token provides the bearer token for api calls to the alexa api Endpoint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL