pub struct GresiqClient { /* private fields */ }Expand description
Talks to the smbCloud GresIQ REST gateway.
Cheap to clone — the inner reqwest::Client is Arc-backed.
Build one at startup and clone it wherever you need it.
§Authentication
Every request carries two headers from the GresIQ credentials:
X-Gresiq-Api-Key and X-Gresiq-Api-Secret. Get these from the
GresIQ console after registering a database.
Additional headers can be layered on top via with_extra_headers —
they ride alongside the GresIQ credentials on every subsequent request.
Implementations§
Source§impl GresiqClient
impl GresiqClient
Sourcepub fn from_credentials(
environment: Environment,
credentials: GresiqCredentials<'_>,
) -> Self
pub fn from_credentials( environment: Environment, credentials: GresiqCredentials<'_>, ) -> Self
Build a client from an environment and credentials.
The base URL is resolved automatically from the environment:
Environment::Dev→http://localhost:8088Environment::Production→https://api.smbcloud.xyz
Sourcepub fn with_extra_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_extra_headers(self, headers: HashMap<String, String>) -> Self
Attach additional headers sent on every request alongside the GresIQ credentials. Replaces any previously set extra headers.
Use this for secondary auth layers so the gateway can identify which SDK client is writing, on top of which GresIQ app owns the database.
Sourcepub async fn insert<T: Serialize>(
&self,
table: &str,
record: &T,
) -> Result<(), GresiqError>
pub async fn insert<T: Serialize>( &self, table: &str, record: &T, ) -> Result<(), GresiqError>
POST a record into a GresIQ-managed table.
table is the short, un-prefixed name from the REST path —
e.g. "pulse/model_loaded" or "pulse_inference_events".
The gateway resolves the tenant prefix from the api_key.
Returns Err on network failure or a non-2xx response. The caller
is responsible for deciding whether to retry, log, or ignore.
Trait Implementations§
Source§impl Clone for GresiqClient
impl Clone for GresiqClient
Source§fn clone(&self) -> GresiqClient
fn clone(&self) -> GresiqClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more