6 files changed
+114
-6
Cargo.lock
+1
-1
@@ -2577,7 +2577,7 @@ dependencies = [
2577
2578
[[package]]
2579
name = "smbcloud-gresiq-sdk"
2580
-version = "0.1.0"
2580
+version = "0.3.34"
2581
dependencies = [
2582
"log",
2583
"reqwest",
Cargo.toml
+1
-1
@@ -28,7 +28,7 @@ serde_json = "1.0.82"
28
serde_repr = "0.1"
29
smbcloud-auth = { version = "0.3", path = "crates/smbcloud-auth" }
30
smbcloud-auth-sdk = { version = "0.3", path = "crates/smbcloud-auth-sdk" }
31
-smbcloud-gresiq-sdk = { version = "0.1", path = "crates/smbcloud-gresiq-sdk" }
31
+smbcloud-gresiq-sdk = { version = "0.3", path = "crates/smbcloud-gresiq-sdk" }
32
smbcloud-model = { version = "0.3", path = "crates/smbcloud-model" }
33
smbcloud-network = { version = "0.3", path = "crates/smbcloud-network" }
34
smbcloud-networking = { version = "0.3", path = "crates/smbcloud-networking" }
crates/smbcloud-gresiq-sdk/Cargo.toml
+11
-3
@@ -1,8 +1,16 @@
1
[package]
2
-name = "smbcloud-gresiq-sdk"
3
-version = "0.1.0"
2
+name = "smbcloud-gresiq-sdk"
3
+version = "0.3.34"
4
edition = "2021"
5
-description = "Rust client for the smbCloud GresIQ REST gateway."
5
+description = "Rust client for the smbCloud GresIQ REST gateway — API-key auth, app management, and model assignment for Onde Inference."
6
+license = "Apache-2.0"
7
+authors = ["Seto Elkahfi <hej@setoelkahfi.se>"]
8
+repository = "https://github.com/smbcloudXYZ/smbcloud-cli"
9
+homepage = "https://smbcloud.xyz"
10
+documentation = "https://docs.rs/smbcloud-gresiq-sdk"
11
+readme = "README.md"
12
+keywords = ["smbcloud", "gresiq", "inference", "api", "onde"]
13
+categories = ["api-bindings", "network-programming", "web-programming::http-client"]
14
15
[lib]
16
path = "src/smbcloud_gresiq_sdk.rs"
crates/smbcloud-gresiq-sdk/README.md
new
+73
@@ -0,0 +1,73 @@
1
+# smbcloud-gresiq-sdk
2
+
3
+Rust client for the **smbCloud GresIQ** REST gateway. API-key authenticated app management and model assignment for [Onde Inference](https://ondeinference.com).
4
+
5
+## What is GresIQ?
6
+
7
+GresIQ is a managed-database layer inside smbCloud. It sits in front of a PostgreSQL database, adds API-key auth, and exposes a simple REST interface. This SDK handles HTTP transport and auth headers.
8
+
9
+## Installation
10
+
11
+```toml
12
+[dependencies]
13
+smbcloud-gresiq-sdk = "0.3"
14
+```
15
+
16
+## Quick start
17
+
18
+```rust
19
+use smbcloud_gresiq_sdk::{Environment, GresiqClient, GresiqCredentials};
20
+use serde::Serialize;
21
+
22
+#[derive(Serialize)]
23
+struct Hit { path: String, status: u16 }
24
+
25
+#[tokio::main]
26
+async fn main() -> anyhow::Result<()> {
27
+ let client = GresiqClient::from_credentials(
28
+ Environment::Production,
29
+ GresiqCredentials {
30
+ api_key: "your-api-key",
31
+ api_secret: "your-api-secret",
32
+ },
33
+ );
34
+ client.insert("hits", &Hit { path: "/api/chat".into(), status: 200 }).await?;
35
+ Ok(())
36
+}
37
+```
38
+
39
+## Onde Inference â app and model management
40
+
41
+```rust
42
+use smbcloud_gresiq_sdk::{
43
+ Environment, list_apps, create_app, list_models, assign_model, rename_app,
44
+};
45
+
46
+// List all apps for the authenticated user
47
+let apps = list_apps(&Environment::Production, APP_ID, APP_SECRET, &token).await?;
48
+
49
+// Create a new app
50
+let app = create_app(&Environment::Production, APP_ID, APP_SECRET, &token, "My App").await?;
51
+
52
+// List available models and assign one
53
+let models = list_models(&Environment::Production, APP_ID, APP_SECRET, &token).await?;
54
+assign_model(&Environment::Production, APP_ID, APP_SECRET, &token, &app.id, &models[0].id).await?;
55
+
56
+// Rename an existing app
57
+rename_app(&Environment::Production, APP_ID, APP_SECRET, &token, &app.id, "Renamed App").await?;
58
+```
59
+
60
+## Key types
61
+
62
+| Type | Description |
63
+| ------------------- | ---------------------------------------------------------------- |
64
+| `GresiqClient` | Low-level insert client for generic row writes |
65
+| `GresiqCredentials` | API key and secret pair |
66
+| `GresiqError` | `Http` (network failure) or `Api` (non-2xx with body) |
67
+| `OndeApp` | Registered Onde app (id, name, status, secret, current model id) |
68
+| `OndeModel` | Catalog model (id, name, family, format, approx size bytes) |
69
+| `Environment` | `Dev` or `Production` |
70
+
71
+## License
72
+
73
+Apache-2.0
crates/smbcloud-gresiq-sdk/src/onde_apps.rs
+27
@@ -174,3 +174,30 @@ pub async fn list_models(
174
.await?;
175
Ok(check(response).await?.json::<ModelsEnvelope>().await?.models)
176
}
177
+
178
+
179
+/// Rename an existing app.
180
+///
181
+/// `PATCH /v1/client/gresiq/apps/{onde_app_id}` — body: `{ "gresiq_app": { "name": "..." } }`
182
+pub async fn rename_app(
183
+ environment: &Environment,
184
+ app_id: &str,
185
+ app_secret: &str,
186
+ access_token: &str,
187
+ onde_app_id: &str,
188
+ new_name: &str,
189
+) -> Result<OndeApp, GresiqError> {
190
+ let path = format!("apps/{}", onde_app_id);
191
+ let url = endpoint(environment, &path, app_id, app_secret);
192
+ let body = CreateAppBody {
193
+ gresiq_app: CreateAppParams { name: new_name },
194
+ };
195
+ let response = reqwest::Client::new()
196
+ .patch(&url)
197
+ .header("Authorization", bearer(access_token))
198
+ .header("Content-Type", "application/json")
199
+ .json(&body)
200
+ .send()
201
+ .await?;
202
+ Ok(check(response).await?.json::<OndeApp>().await?)
203
+}
crates/smbcloud-gresiq-sdk/src/smbcloud_gresiq_sdk.rs
+1
-1
@@ -43,5 +43,5 @@ mod onde_apps;
43
pub use client::GresiqClient;
44
pub use client_credentials::{base_url, GresiqCredentials};
45
pub use error::GresiqError;
46
-pub use onde_apps::{assign_model, create_app, list_apps, list_models, OndeApp, OndeModel};
46
+pub use onde_apps::{assign_model, create_app, list_apps, list_models, rename_app, OndeApp, OndeModel};
47
pub use smbcloud_network::environment::Environment;