1 //! Rust client for the smbCloud GresIQ REST gateway.
2 //!
3 //! GresIQ is a managed-database layer inside smbCloud. It sits in front of
4 //! a PostgreSQL database, adds API-key auth, and exposes a simple REST
5 //! interface for inserting and querying rows.
6 //!
7 //! This crate handles the HTTP transport and auth headers. Schema knowledge
8 //! (which tables exist, what the rows look like) lives in the caller.
9 //!
10 //! # Quick start
11 //!
12 //! ```no_run
13 //! use smbcloud_gresiq_sdk::{Environment, GresiqClient, GresiqCredentials};
14 //! use serde::Serialize;
15 //!
16 //! #[derive(Serialize)]
17 //! struct Hit { path: String, status: u16 }
18 //!
19 //! #[tokio::main]
20 //! async fn main() -> anyhow::Result<()> {
21 //! let client = GresiqClient::from_credentials(
22 //! Environment::Dev,
23 //! GresiqCredentials {
24 //! api_key: "your-key",
25 //! api_secret: "your-secret",
26 //! },
27 //! );
28 //!
29 //! client.insert("hits", &Hit {
30 //! path: "/api/chat".into(),
31 //! status: 200,
32 //! }).await?;
33 //!
34 //! Ok(())
35 //! }
36 //! ```
37
38 mod client;
39 mod client_credentials;
40 mod error;
41 mod onde_apps;
42
43 pub use client::{DocumentQuery, GresiqClient, GresiqDocument};
44 pub use client_credentials::{base_url, GresiqCredentials};
45 pub use error::GresiqError;
46 pub use onde_apps::{
47 assign_model, create_app, create_model, list_apps, list_models, rename_app, CreateModelParams,
48 OndeApp, OndeModel,
49 };
50 pub use smbcloud_network::environment::Environment;