AmazonCreatorsAPI.TokenManager (amazon_creators_api v0.5.0)

GenServer that manages authentication tokens for Amazon Creators API. Automatically caches tokens and refreshes them before expiration.

Summary

Functions

Returns a specification to start this module under a supervisor.

Clear all cached tokens (useful for testing or forced refresh).

Get a valid token for the specified region and credentials. Returns cached token if still valid, otherwise fetches a new one.

Get cache statistics (for debugging/monitoring).

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear_cache()

Clear all cached tokens (useful for testing or forced refresh).

get_token(region, client_id, client_secret, version \\ nil)

Get a valid token for the specified region and credentials. Returns cached token if still valid, otherwise fetches a new one.

version is the credential version from Associates Central. Pass nil to fall back to the region default.

start_link(opts \\ [])

stats()

Get cache statistics (for debugging/monitoring).