gleetube
Values
pub fn new(api_key: String) -> client.Client
Create a new GleeTube client with an API key. This is the simplest way to get started for public data access.
Example
let client = gleetube.new("YOUR_API_KEY")
pub fn new_with_config(config: config.Config) -> client.Client
Create a new GleeTube client from a custom Config. Use this when you need custom configuration (timeout, base URL, etc.).
Example
let client =
auth.api_key("YOUR_KEY")
|> config.new()
|> config.with_timeout(10_000)
|> gleetube.new_with_config()
pub fn new_with_oauth(
oauth_config: oauth2.OAuthConfig,
code code: String,
) -> Result(client.Client, error.GleeTubeError)
Create a new GleeTube client by exchanging an OAuth2 authorization code. This handles the full token exchange and returns a ready-to-use client.
Example
let oauth_config = oauth2.new(
client_id: "YOUR_CLIENT_ID",
client_secret: "YOUR_CLIENT_SECRET",
redirect_uri: "http://localhost:8080/callback",
)
use client <- result.try(gleetube.new_with_oauth(oauth_config, code: "AUTH_CODE"))
pub fn new_with_token(token: String) -> client.Client
Create a new GleeTube client with an OAuth2 bearer token. Use this for accessing user-specific data.