pub struct One { /* private fields */ }Expand description
The One SDK client.
Holds the credential, base URL, default retry schedule, and global
success/error hooks. Cheap to clone; wraps a shared reqwest client.
Implementations§
Source§impl One
impl One
Sourcepub fn new(secret: impl Into<String>) -> Self
pub fn new(secret: impl Into<String>) -> Self
Creates a client from a One secret key, targeting the default base URL.
Panics if secret is empty; use OneBuilder::build for a fallible
path.
Sourcepub fn from_env() -> Result<Self, Error>
pub fn from_env() -> Result<Self, Error>
Creates a client from the environment: a credential (required) and
ONE_BASE_URL (optional, defaults to the production base URL).
The credential is ONE_SECRET, or ONE_ACCESS_TOKEN for an OAuth
grant. ONE_SECRET wins if both are set, because it is the
longer-standing variable and silently preferring the newer one would
change what an existing environment authenticates as. Set-but-blank does
not count as set - see [configured].
Sourcepub fn builder() -> OneBuilder
pub fn builder() -> OneBuilder
Starts building a client with full configuration.
Sourcepub fn connection(&self, key: impl Into<String>) -> ConnectionScope<'_>
pub fn connection(&self, key: impl Into<String>) -> ConnectionScope<'_>
Scopes subsequent calls to a connection by its key.
Sourcepub fn webhooks(&self, signing_secret: SecretString) -> Webhooks
pub fn webhooks(&self, signing_secret: SecretString) -> Webhooks
Starts building a webhook listener, verified with signing_secret.
The listener owns a clone of this client: it is mounted into an HTTP server and outlives any single request, so it cannot borrow.