pub struct EndpointManager { /* private fields */ }Expand description
Manages PostHog API endpoints and host configuration.
This low-level helper normalizes app hosts such as
https://us.posthog.com to ingestion hosts such as
US_INGESTION_ENDPOINT.
Implementations§
Source§impl EndpointManager
impl EndpointManager
Sourcepub fn new(host: String) -> Self
pub fn new(host: String) -> Self
Create a new endpoint manager for host.
host may be an app host (for example https://eu.posthog.com), an
ingestion host, or a custom reverse-proxy host.
Sourcepub fn determine_server_host(host: &str) -> String
pub fn determine_server_host(host: &str) -> String
Determine the ingestion host used for API calls.
Maps PostHog app hosts to their ingestion equivalents and removes a trailing slash. Custom hosts are returned unchanged except for the trailing slash.
Sourcepub fn build_url(&self, endpoint: Endpoint) -> String
pub fn build_url(&self, endpoint: Endpoint) -> String
Build a full URL for a given SDK endpoint.
Sourcepub fn build_custom_url(&self, path: &str) -> String
pub fn build_custom_url(&self, path: &str) -> String
Build a URL with a custom path relative to the base host.
The path may be passed with or without a leading /.
Sourcepub fn build_local_eval_url(&self, token: &str) -> String
pub fn build_local_eval_url(&self, token: &str) -> String
Build the local evaluation definitions URL with a project token.
The token is included as a query parameter, so avoid logging this URL in production diagnostics.
Trait Implementations§
Source§impl Clone for EndpointManager
impl Clone for EndpointManager
Source§fn clone(&self) -> EndpointManager
fn clone(&self) -> EndpointManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more