pub struct Config {
pub base_url: String,
pub subscription_key: String,
pub api_key: String,
pub access_key: Option<String>,
pub timeout: Duration,
}Expand description
Connection details and credentials for a single ALAT gateway.
A Config is consumed by Client::new. It is cheap to
clone and holds no live connections.
§Authentication
APIM gates every product with a subscription key
(Ocp-Apim-Subscription-Key). On top of that, ALAT identifies the calling
software channel with an API key (x-api-key). A subset of products
(bills & airtime) additionally require an access key sent in an access
header — supply it via Config::with_access_key when you use those
endpoints.
Fields§
§base_url: StringAbsolute base URL of the APIM gateway (where API calls go, not the
sign-up portal), e.g. https://playground.azure-api.net. Stored without a
trailing slash.
subscription_key: StringAPIM subscription key, sent as the Ocp-Apim-Subscription-Key header.
Obtained from your subscription on the ALAT developer portal.
api_key: StringChannel API key, sent as the x-api-key header. Identifies your
registered application/partner to ALAT’s core systems.
access_key: Option<String>Optional “access” credential required by the bills & airtime products,
sent as the access header. None if you do not use those endpoints.
timeout: DurationMaximum duration to wait for each request before failing with a
Network timeout error.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(
base_url: impl Into<String>,
subscription_key: impl Into<String>,
api_key: impl Into<String>,
) -> Self
pub fn new( base_url: impl Into<String>, subscription_key: impl Into<String>, api_key: impl Into<String>, ) -> Self
Creates a configuration pointing at an explicit gateway host.
This is the honest, production-oriented constructor: you name the gateway Wema issued to you. Trailing slashes are trimmed.
use alat::Config;
let config = Config::new("https://your-gateway.wemabank.com", "sub_key", "api_key");
assert_eq!(config.base_url, "https://your-gateway.wemabank.com");Sourcepub fn playground(
subscription_key: impl Into<String>,
api_key: impl Into<String>,
) -> Self
pub fn playground( subscription_key: impl Into<String>, api_key: impl Into<String>, ) -> Self
Configuration for the Playground sandbox gateway
(https://playground.azure-api.net; sign up at https://playground.alat.ng).
Use this for wallet creation, account maintenance, statements, bills, and airtime — the products published on that portal.
Sourcepub fn apim_dev(
subscription_key: impl Into<String>,
api_key: impl Into<String>,
) -> Self
pub fn apim_dev( subscription_key: impl Into<String>, api_key: impl Into<String>, ) -> Self
Configuration for the APIM Dev sandbox
(https://wema-alatdev-apimgt.azure-api.net).
Use this for the funds-transfer / name-enquiry product
(/funds-transfer-open), which is published on that portal rather than
on Playground.
Sourcepub fn with_access_key(self, access_key: impl Into<String>) -> Self
pub fn with_access_key(self, access_key: impl Into<String>) -> Self
Attaches the access credential required by bills & airtime endpoints
(builder style).
use alat::Config;
let config = Config::playground("sub", "api").with_access_key("bills_access_token");
assert!(config.access_key.is_some());Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Overrides the default per-request timeout (builder style).