Documentation
¶
Index ¶
Constants ¶
const ( ScopeNotifications = "sellingpartnerapi::notifications" ScopeMigration = "sellingpartnerapi::migration" ScopeOrders = "sellingpartnerapi::orders" ScopeInventory = "sellingpartnerapi::inventory" ScopeProducts = "sellingpartnerapi::products" ScopePricing = "sellingpartnerapi::pricing" ScopeFeeds = "sellingpartnerapi::feeds" ScopeReports = "sellingpartnerapi::reports" ScopeFinances = "sellingpartnerapi::finances" ScopeShipping = "sellingpartnerapi::shipping" ScopeMessaging = "sellingpartnerapi::messaging" ScopeSolicitations = "sellingpartnerapi::solicitations" )
ScopeConstants defines common scope constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LWAAccessTokenCache ¶
type LWAAccessTokenCache interface {
Get(key string) (string, bool)
Set(key, value string, ttl time.Duration)
Delete(key string)
}
LWAAccessTokenCache represents the interface for caching access tokens
type LWAAccessTokenRequestMeta ¶
type LWAAccessTokenRequestMeta struct {
GrantType string `json:"grant_type"`
RefreshToken string `json:"refresh_token,omitempty"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Scope string `json:"scope,omitempty"`
}
LWAAccessTokenRequestMeta represents the metadata for LWA access token request
type LWAAccessTokenResponse ¶
type LWAAccessTokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
Scope string `json:"scope,omitempty"`
}
LWAAccessTokenResponse represents the response from LWA token endpoint
type LWAAuthorizationCredentials ¶
type LWAAuthorizationCredentials struct {
ClientID string
ClientSecret string
RefreshToken string
Endpoint string
Scopes []string
}
LWAAuthorizationCredentials represents the credentials for LWA authorization
type LWAAuthorizationSigner ¶
type LWAAuthorizationSigner struct {
// contains filtered or unexported fields
}
LWAAuthorizationSigner handles signing requests with LWA access tokens
func NewLWAAuthorizationSigner ¶
func NewLWAAuthorizationSigner(credentials *LWAAuthorizationCredentials) *LWAAuthorizationSigner
NewLWAAuthorizationSigner creates a new LWA authorization signer
func NewLWAAuthorizationSignerWithCache ¶
func NewLWAAuthorizationSignerWithCache(credentials *LWAAuthorizationCredentials, cache LWAAccessTokenCache) *LWAAuthorizationSigner
NewLWAAuthorizationSignerWithCache creates a new LWA authorization signer with cache
func (*LWAAuthorizationSigner) GetLwaClient ¶
func (l *LWAAuthorizationSigner) GetLwaClient() *LWAClient
GetLwaClient returns the LWA client
func (*LWAAuthorizationSigner) SetCache ¶
func (l *LWAAuthorizationSigner) SetCache(cache LWAAccessTokenCache)
SetCache sets the token cache
type LWAClient ¶
type LWAClient struct {
// contains filtered or unexported fields
}
LWAClient handles Login with Amazon (LWA) authentication
func NewLWAClient ¶
NewLWAClient creates a new LWA client
func (*LWAClient) GetAccessToken ¶
func (l *LWAClient) GetAccessToken(meta *LWAAccessTokenRequestMeta) (string, error)
GetAccessToken retrieves an access token, using cache if available
func (*LWAClient) GetEndpoint ¶
GetEndpoint returns the LWA endpoint
func (*LWAClient) SetCache ¶
func (l *LWAClient) SetCache(cache LWAAccessTokenCache)
SetCache sets the token cache
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache implements LWAAccessTokenCache using in-memory storage
func NewMemoryCache ¶
func NewMemoryCache() *MemoryCache
NewMemoryCache creates a new memory cache with default settings
func NewMemoryCacheWithTTL ¶
func NewMemoryCacheWithTTL(defaultTTL, cleanupInterval time.Duration) *MemoryCache
NewMemoryCacheWithTTL creates a new memory cache with custom TTL
func (*MemoryCache) Delete ¶
func (m *MemoryCache) Delete(key string)
Delete removes a value from cache
func (*MemoryCache) Get ¶
func (m *MemoryCache) Get(key string) (string, bool)
Get retrieves a value from cache
func (*MemoryCache) ItemCount ¶
func (m *MemoryCache) ItemCount() int
ItemCount returns the number of items in cache