Skip to main content

edgebase_core/generated/
api_core.rs

1//! Auto-generated core API Core — DO NOT EDIT.
2//! Regenerate: npx tsx tools/sdk-codegen/generate.ts
3//! Source: openapi.json (0.1.0)
4
5use crate::Error;
6use crate::HttpClient;
7use serde_json::Value;
8
9fn encode_path_param(value: &str) -> String {
10    urlencoding::encode(value).into_owned()
11}
12
13/// Auto-generated API methods.
14pub struct GeneratedDbApi<'a> {
15    http: &'a HttpClient,
16}
17
18impl<'a> GeneratedDbApi<'a> {
19    pub fn new(http: &'a HttpClient) -> Self {
20        Self { http }
21    }
22
23    /// Health check — GET /api/health
24    pub async fn get_health(&self) -> Result<Value, Error> {
25        self.http.get("/api/health").await
26    }
27
28    /// Sign up with email and password — POST /api/auth/signup
29    pub async fn auth_signup(&self, body: &Value) -> Result<Value, Error> {
30        self.http.post("/api/auth/signup", body).await
31    }
32
33    /// Sign in with email and password — POST /api/auth/signin
34    pub async fn auth_signin(&self, body: &Value) -> Result<Value, Error> {
35        self.http.post("/api/auth/signin", body).await
36    }
37
38    /// Sign in anonymously — POST /api/auth/signin/anonymous
39    pub async fn auth_signin_anonymous(&self, body: &Value) -> Result<Value, Error> {
40        self.http.post("/api/auth/signin/anonymous", body).await
41    }
42
43    /// Send magic link to email — POST /api/auth/signin/magic-link
44    pub async fn auth_signin_magic_link(&self, body: &Value) -> Result<Value, Error> {
45        self.http.post("/api/auth/signin/magic-link", body).await
46    }
47
48    /// Verify magic link token — POST /api/auth/verify-magic-link
49    pub async fn auth_verify_magic_link(&self, body: &Value) -> Result<Value, Error> {
50        self.http.post("/api/auth/verify-magic-link", body).await
51    }
52
53    /// Send OTP SMS to phone number — POST /api/auth/signin/phone
54    pub async fn auth_signin_phone(&self, body: &Value) -> Result<Value, Error> {
55        self.http.post("/api/auth/signin/phone", body).await
56    }
57
58    /// Verify phone OTP and create session — POST /api/auth/verify-phone
59    pub async fn auth_verify_phone(&self, body: &Value) -> Result<Value, Error> {
60        self.http.post("/api/auth/verify-phone", body).await
61    }
62
63    /// Link phone number to existing account — POST /api/auth/link/phone
64    pub async fn auth_link_phone(&self, body: &Value) -> Result<Value, Error> {
65        self.http.post("/api/auth/link/phone", body).await
66    }
67
68    /// Verify OTP and link phone to account — POST /api/auth/verify-link-phone
69    pub async fn auth_verify_link_phone(&self, body: &Value) -> Result<Value, Error> {
70        self.http.post("/api/auth/verify-link-phone", body).await
71    }
72
73    /// Send OTP code to email — POST /api/auth/signin/email-otp
74    pub async fn auth_signin_email_otp(&self, body: &Value) -> Result<Value, Error> {
75        self.http.post("/api/auth/signin/email-otp", body).await
76    }
77
78    /// Verify email OTP and create session — POST /api/auth/verify-email-otp
79    pub async fn auth_verify_email_otp(&self, body: &Value) -> Result<Value, Error> {
80        self.http.post("/api/auth/verify-email-otp", body).await
81    }
82
83    /// Enroll new TOTP factor — POST /api/auth/mfa/totp/enroll
84    pub async fn auth_mfa_totp_enroll(&self) -> Result<Value, Error> {
85        self.http.post("/api/auth/mfa/totp/enroll", &Value::Null).await
86    }
87
88    /// Confirm TOTP enrollment with code — POST /api/auth/mfa/totp/verify
89    pub async fn auth_mfa_totp_verify(&self, body: &Value) -> Result<Value, Error> {
90        self.http.post("/api/auth/mfa/totp/verify", body).await
91    }
92
93    /// Verify MFA code during signin — POST /api/auth/mfa/verify
94    pub async fn auth_mfa_verify(&self, body: &Value) -> Result<Value, Error> {
95        self.http.post("/api/auth/mfa/verify", body).await
96    }
97
98    /// Use recovery code during MFA signin — POST /api/auth/mfa/recovery
99    pub async fn auth_mfa_recovery(&self, body: &Value) -> Result<Value, Error> {
100        self.http.post("/api/auth/mfa/recovery", body).await
101    }
102
103    /// Disable TOTP factor — DELETE /api/auth/mfa/totp
104    pub async fn auth_mfa_totp_delete(&self, body: &Value) -> Result<Value, Error> {
105        self.http.delete_with_body("/api/auth/mfa/totp", body).await
106    }
107
108    /// List MFA factors for authenticated user — GET /api/auth/mfa/factors
109    pub async fn auth_mfa_factors(&self) -> Result<Value, Error> {
110        self.http.get("/api/auth/mfa/factors").await
111    }
112
113    /// Refresh access token — POST /api/auth/refresh
114    pub async fn auth_refresh(&self, body: &Value) -> Result<Value, Error> {
115        self.http.post("/api/auth/refresh", body).await
116    }
117
118    /// Sign out and revoke refresh token — POST /api/auth/signout
119    pub async fn auth_signout(&self, body: &Value) -> Result<Value, Error> {
120        self.http.post("/api/auth/signout", body).await
121    }
122
123    /// Change password for authenticated user — POST /api/auth/change-password
124    pub async fn auth_change_password(&self, body: &Value) -> Result<Value, Error> {
125        self.http.post("/api/auth/change-password", body).await
126    }
127
128    /// Request email change with password confirmation — POST /api/auth/change-email
129    pub async fn auth_change_email(&self, body: &Value) -> Result<Value, Error> {
130        self.http.post("/api/auth/change-email", body).await
131    }
132
133    /// Verify email change token — POST /api/auth/verify-email-change
134    pub async fn auth_verify_email_change(&self, body: &Value) -> Result<Value, Error> {
135        self.http.post("/api/auth/verify-email-change", body).await
136    }
137
138    /// Generate passkey registration options — POST /api/auth/passkeys/register-options
139    pub async fn auth_passkeys_register_options(&self) -> Result<Value, Error> {
140        self.http.post("/api/auth/passkeys/register-options", &Value::Null).await
141    }
142
143    /// Verify and store passkey registration — POST /api/auth/passkeys/register
144    pub async fn auth_passkeys_register(&self, body: &Value) -> Result<Value, Error> {
145        self.http.post("/api/auth/passkeys/register", body).await
146    }
147
148    /// Generate passkey authentication options — POST /api/auth/passkeys/auth-options
149    pub async fn auth_passkeys_auth_options(&self, body: &Value) -> Result<Value, Error> {
150        self.http.post("/api/auth/passkeys/auth-options", body).await
151    }
152
153    /// Authenticate with passkey — POST /api/auth/passkeys/authenticate
154    pub async fn auth_passkeys_authenticate(&self, body: &Value) -> Result<Value, Error> {
155        self.http.post("/api/auth/passkeys/authenticate", body).await
156    }
157
158    /// List passkeys for authenticated user — GET /api/auth/passkeys
159    pub async fn auth_passkeys_list(&self) -> Result<Value, Error> {
160        self.http.get("/api/auth/passkeys").await
161    }
162
163    /// Delete a passkey — DELETE /api/auth/passkeys/{credentialId}
164    pub async fn auth_passkeys_delete(&self, credential_id: &str) -> Result<Value, Error> {
165        self.http.delete(&format!("/api/auth/passkeys/{}", encode_path_param(credential_id))).await
166    }
167
168    /// Get current authenticated user info — GET /api/auth/me
169    pub async fn auth_get_me(&self) -> Result<Value, Error> {
170        self.http.get("/api/auth/me").await
171    }
172
173    /// Update user profile — PATCH /api/auth/profile
174    pub async fn auth_update_profile(&self, body: &Value) -> Result<Value, Error> {
175        self.http.patch("/api/auth/profile", body).await
176    }
177
178    /// List active sessions — GET /api/auth/sessions
179    pub async fn auth_get_sessions(&self) -> Result<Value, Error> {
180        self.http.get("/api/auth/sessions").await
181    }
182
183    /// Delete a session — DELETE /api/auth/sessions/{id}
184    pub async fn auth_delete_session(&self, id: &str) -> Result<Value, Error> {
185        self.http.delete(&format!("/api/auth/sessions/{}", encode_path_param(id))).await
186    }
187
188    /// List linked sign-in identities for the current user — GET /api/auth/identities
189    pub async fn auth_get_identities(&self) -> Result<Value, Error> {
190        self.http.get("/api/auth/identities").await
191    }
192
193    /// Unlink a linked sign-in identity — DELETE /api/auth/identities/{identityId}
194    pub async fn auth_delete_identity(&self, identity_id: &str) -> Result<Value, Error> {
195        self.http.delete(&format!("/api/auth/identities/{}", encode_path_param(identity_id))).await
196    }
197
198    /// Link email and password to existing account — POST /api/auth/link/email
199    pub async fn auth_link_email(&self, body: &Value) -> Result<Value, Error> {
200        self.http.post("/api/auth/link/email", body).await
201    }
202
203    /// Send a verification email to the current authenticated user — POST /api/auth/request-email-verification
204    pub async fn auth_request_email_verification(&self, body: &Value) -> Result<Value, Error> {
205        self.http.post("/api/auth/request-email-verification", body).await
206    }
207
208    /// Verify email address with token — POST /api/auth/verify-email
209    pub async fn auth_verify_email(&self, body: &Value) -> Result<Value, Error> {
210        self.http.post("/api/auth/verify-email", body).await
211    }
212
213    /// Request password reset email — POST /api/auth/request-password-reset
214    pub async fn auth_request_password_reset(&self, body: &Value) -> Result<Value, Error> {
215        self.http.post("/api/auth/request-password-reset", body).await
216    }
217
218    /// Reset password with token — POST /api/auth/reset-password
219    pub async fn auth_reset_password(&self, body: &Value) -> Result<Value, Error> {
220        self.http.post("/api/auth/reset-password", body).await
221    }
222
223    /// Start OAuth redirect — GET /api/auth/oauth/{provider}
224    pub async fn oauth_redirect(&self, provider: &str) -> Result<Value, Error> {
225        self.http.get(&format!("/api/auth/oauth/{}", encode_path_param(provider))).await
226    }
227
228    /// OAuth callback — GET /api/auth/oauth/{provider}/callback
229    pub async fn oauth_callback(&self, provider: &str) -> Result<Value, Error> {
230        self.http.get(&format!("/api/auth/oauth/{}/callback", encode_path_param(provider))).await
231    }
232
233    /// Start OAuth account linking — POST /api/auth/oauth/link/{provider}
234    pub async fn oauth_link_start(&self, provider: &str) -> Result<Value, Error> {
235        self.http.post(&format!("/api/auth/oauth/link/{}", encode_path_param(provider)), &Value::Null).await
236    }
237
238    /// OAuth link callback — GET /api/auth/oauth/link/{provider}/callback
239    pub async fn oauth_link_callback(&self, provider: &str) -> Result<Value, Error> {
240        self.http.get(&format!("/api/auth/oauth/link/{}/callback", encode_path_param(provider))).await
241    }
242
243    /// Count records in a single-instance table — GET /api/db/{namespace}/tables/{table}/count
244    pub async fn db_single_count_records(&self, namespace: &str, table: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
245        self.http.get_with_query(&format!("/api/db/{}/tables/{}/count", encode_path_param(namespace), encode_path_param(table)), query).await
246    }
247
248    /// Search records in a single-instance table — GET /api/db/{namespace}/tables/{table}/search
249    pub async fn db_single_search_records(&self, namespace: &str, table: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
250        self.http.get_with_query(&format!("/api/db/{}/tables/{}/search", encode_path_param(namespace), encode_path_param(table)), query).await
251    }
252
253    /// Get a single record from a single-instance table — GET /api/db/{namespace}/tables/{table}/{id}
254    pub async fn db_single_get_record(&self, namespace: &str, table: &str, id: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
255        self.http.get_with_query(&format!("/api/db/{}/tables/{}/{}", encode_path_param(namespace), encode_path_param(table), encode_path_param(id)), query).await
256    }
257
258    /// Update a record in a single-instance table — PATCH /api/db/{namespace}/tables/{table}/{id}
259    pub async fn db_single_update_record(&self, namespace: &str, table: &str, id: &str, body: &Value) -> Result<Value, Error> {
260        self.http.patch(&format!("/api/db/{}/tables/{}/{}", encode_path_param(namespace), encode_path_param(table), encode_path_param(id)), body).await
261    }
262
263    /// Delete a record from a single-instance table — DELETE /api/db/{namespace}/tables/{table}/{id}
264    pub async fn db_single_delete_record(&self, namespace: &str, table: &str, id: &str) -> Result<Value, Error> {
265        self.http.delete(&format!("/api/db/{}/tables/{}/{}", encode_path_param(namespace), encode_path_param(table), encode_path_param(id))).await
266    }
267
268    /// List records from a single-instance table — GET /api/db/{namespace}/tables/{table}
269    pub async fn db_single_list_records(&self, namespace: &str, table: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
270        self.http.get_with_query(&format!("/api/db/{}/tables/{}", encode_path_param(namespace), encode_path_param(table)), query).await
271    }
272
273    /// Insert a record into a single-instance table — POST /api/db/{namespace}/tables/{table}
274    pub async fn db_single_insert_record(&self, namespace: &str, table: &str, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
275        self.http.post_with_query(&format!("/api/db/{}/tables/{}", encode_path_param(namespace), encode_path_param(table)), body, query).await
276    }
277
278    /// Batch insert records into a single-instance table — POST /api/db/{namespace}/tables/{table}/batch
279    pub async fn db_single_batch_records(&self, namespace: &str, table: &str, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
280        self.http.post_with_query(&format!("/api/db/{}/tables/{}/batch", encode_path_param(namespace), encode_path_param(table)), body, query).await
281    }
282
283    /// Batch update/delete records by filter in a single-instance table — POST /api/db/{namespace}/tables/{table}/batch-by-filter
284    pub async fn db_single_batch_by_filter(&self, namespace: &str, table: &str, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
285        self.http.post_with_query(&format!("/api/db/{}/tables/{}/batch-by-filter", encode_path_param(namespace), encode_path_param(table)), body, query).await
286    }
287
288    /// Count records in dynamic table — GET /api/db/{namespace}/{instanceId}/tables/{table}/count
289    pub async fn db_count_records(&self, namespace: &str, instance_id: &str, table: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
290        self.http.get_with_query(&format!("/api/db/{}/{}/tables/{}/count", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table)), query).await
291    }
292
293    /// Search records in dynamic table — GET /api/db/{namespace}/{instanceId}/tables/{table}/search
294    pub async fn db_search_records(&self, namespace: &str, instance_id: &str, table: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
295        self.http.get_with_query(&format!("/api/db/{}/{}/tables/{}/search", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table)), query).await
296    }
297
298    /// Get single record from dynamic table — GET /api/db/{namespace}/{instanceId}/tables/{table}/{id}
299    pub async fn db_get_record(&self, namespace: &str, instance_id: &str, table: &str, id: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
300        self.http.get_with_query(&format!("/api/db/{}/{}/tables/{}/{}", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table), encode_path_param(id)), query).await
301    }
302
303    /// Update record in dynamic table — PATCH /api/db/{namespace}/{instanceId}/tables/{table}/{id}
304    pub async fn db_update_record(&self, namespace: &str, instance_id: &str, table: &str, id: &str, body: &Value) -> Result<Value, Error> {
305        self.http.patch(&format!("/api/db/{}/{}/tables/{}/{}", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table), encode_path_param(id)), body).await
306    }
307
308    /// Delete record from dynamic table — DELETE /api/db/{namespace}/{instanceId}/tables/{table}/{id}
309    pub async fn db_delete_record(&self, namespace: &str, instance_id: &str, table: &str, id: &str) -> Result<Value, Error> {
310        self.http.delete(&format!("/api/db/{}/{}/tables/{}/{}", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table), encode_path_param(id))).await
311    }
312
313    /// List records from dynamic table — GET /api/db/{namespace}/{instanceId}/tables/{table}
314    pub async fn db_list_records(&self, namespace: &str, instance_id: &str, table: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
315        self.http.get_with_query(&format!("/api/db/{}/{}/tables/{}", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table)), query).await
316    }
317
318    /// Insert record into dynamic table — POST /api/db/{namespace}/{instanceId}/tables/{table}
319    pub async fn db_insert_record(&self, namespace: &str, instance_id: &str, table: &str, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
320        self.http.post_with_query(&format!("/api/db/{}/{}/tables/{}", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table)), body, query).await
321    }
322
323    /// Batch insert records into dynamic table — POST /api/db/{namespace}/{instanceId}/tables/{table}/batch
324    pub async fn db_batch_records(&self, namespace: &str, instance_id: &str, table: &str, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
325        self.http.post_with_query(&format!("/api/db/{}/{}/tables/{}/batch", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table)), body, query).await
326    }
327
328    /// Batch update/delete records by filter in dynamic table — POST /api/db/{namespace}/{instanceId}/tables/{table}/batch-by-filter
329    pub async fn db_batch_by_filter(&self, namespace: &str, instance_id: &str, table: &str, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
330        self.http.post_with_query(&format!("/api/db/{}/{}/tables/{}/batch-by-filter", encode_path_param(namespace), encode_path_param(instance_id), encode_path_param(table)), body, query).await
331    }
332
333    /// Check database live subscription WebSocket prerequisites — GET /api/db/connect-check
334    pub async fn check_database_subscription_connection(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
335        self.http.get_with_query("/api/db/connect-check", query).await
336    }
337
338    /// Connect to database live subscriptions WebSocket — GET /api/db/subscribe
339    pub async fn connect_database_subscription(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
340        self.http.get_with_query("/api/db/subscribe", query).await
341    }
342
343    /// Get table schema — GET /api/schema
344    pub async fn get_schema(&self) -> Result<Value, Error> {
345        self.http.get("/api/schema").await
346    }
347
348    /// Upload file — POST /api/storage/{bucket}/upload
349    pub async fn upload_file(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
350        self.http.post(&format!("/api/storage/{}/upload", encode_path_param(bucket)), body).await
351    }
352
353    /// Get file metadata — GET /api/storage/{bucket}/{key}/metadata
354    pub async fn get_file_metadata(&self, bucket: &str, key: &str) -> Result<Value, Error> {
355        self.http.get(&format!("/api/storage/{}/{}/metadata", encode_path_param(bucket), encode_path_param(key))).await
356    }
357
358    /// Update file metadata — PATCH /api/storage/{bucket}/{key}/metadata
359    pub async fn update_file_metadata(&self, bucket: &str, key: &str, body: &Value) -> Result<Value, Error> {
360        self.http.patch(&format!("/api/storage/{}/{}/metadata", encode_path_param(bucket), encode_path_param(key)), body).await
361    }
362
363    /// Check if file exists — HEAD /api/storage/{bucket}/{key}
364    pub async fn check_file_exists(&self, bucket: &str, key: &str) -> Result<bool, Error> {
365        self.http.head(&format!("/api/storage/{}/{}", encode_path_param(bucket), encode_path_param(key))).await
366    }
367
368    /// Download file — GET /api/storage/{bucket}/{key}
369    pub async fn download_file(&self, bucket: &str, key: &str) -> Result<Value, Error> {
370        self.http.get(&format!("/api/storage/{}/{}", encode_path_param(bucket), encode_path_param(key))).await
371    }
372
373    /// Delete file — DELETE /api/storage/{bucket}/{key}
374    pub async fn delete_file(&self, bucket: &str, key: &str) -> Result<Value, Error> {
375        self.http.delete(&format!("/api/storage/{}/{}", encode_path_param(bucket), encode_path_param(key))).await
376    }
377
378    /// Get uploaded parts — GET /api/storage/{bucket}/uploads/{uploadId}/parts
379    pub async fn get_upload_parts(&self, bucket: &str, upload_id: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
380        self.http.get_with_query(&format!("/api/storage/{}/uploads/{}/parts", encode_path_param(bucket), encode_path_param(upload_id)), query).await
381    }
382
383    /// List files in bucket — GET /api/storage/{bucket}
384    pub async fn list_files(&self, bucket: &str) -> Result<Value, Error> {
385        self.http.get(&format!("/api/storage/{}", encode_path_param(bucket))).await
386    }
387
388    /// Batch delete files — POST /api/storage/{bucket}/delete-batch
389    pub async fn delete_batch(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
390        self.http.post(&format!("/api/storage/{}/delete-batch", encode_path_param(bucket)), body).await
391    }
392
393    /// Create signed download URL — POST /api/storage/{bucket}/signed-url
394    pub async fn create_signed_download_url(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
395        self.http.post(&format!("/api/storage/{}/signed-url", encode_path_param(bucket)), body).await
396    }
397
398    /// Batch create signed download URLs — POST /api/storage/{bucket}/signed-urls
399    pub async fn create_signed_download_urls(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
400        self.http.post(&format!("/api/storage/{}/signed-urls", encode_path_param(bucket)), body).await
401    }
402
403    /// Create signed upload URL — POST /api/storage/{bucket}/signed-upload-url
404    pub async fn create_signed_upload_url(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
405        self.http.post(&format!("/api/storage/{}/signed-upload-url", encode_path_param(bucket)), body).await
406    }
407
408    /// Start multipart upload — POST /api/storage/{bucket}/multipart/create
409    pub async fn create_multipart_upload(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
410        self.http.post(&format!("/api/storage/{}/multipart/create", encode_path_param(bucket)), body).await
411    }
412
413    /// Upload a part — POST /api/storage/{bucket}/multipart/upload-part
414    pub async fn upload_part(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
415        self.http.post(&format!("/api/storage/{}/multipart/upload-part", encode_path_param(bucket)), body).await
416    }
417
418    /// Complete multipart upload — POST /api/storage/{bucket}/multipart/complete
419    pub async fn complete_multipart_upload(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
420        self.http.post(&format!("/api/storage/{}/multipart/complete", encode_path_param(bucket)), body).await
421    }
422
423    /// Abort multipart upload — POST /api/storage/{bucket}/multipart/abort
424    pub async fn abort_multipart_upload(&self, bucket: &str, body: &Value) -> Result<Value, Error> {
425        self.http.post(&format!("/api/storage/{}/multipart/abort", encode_path_param(bucket)), body).await
426    }
427
428    /// Get public configuration — GET /api/config
429    pub async fn get_config(&self) -> Result<Value, Error> {
430        self.http.get("/api/config").await
431    }
432
433    /// Register push token — POST /api/push/register
434    pub async fn push_register(&self, body: &Value) -> Result<Value, Error> {
435        self.http.post("/api/push/register", body).await
436    }
437
438    /// Unregister push token — POST /api/push/unregister
439    pub async fn push_unregister(&self, body: &Value) -> Result<Value, Error> {
440        self.http.post("/api/push/unregister", body).await
441    }
442
443    /// Subscribe token to topic — POST /api/push/topic/subscribe
444    pub async fn push_topic_subscribe(&self, body: &Value) -> Result<Value, Error> {
445        self.http.post("/api/push/topic/subscribe", body).await
446    }
447
448    /// Unsubscribe token from topic — POST /api/push/topic/unsubscribe
449    pub async fn push_topic_unsubscribe(&self, body: &Value) -> Result<Value, Error> {
450        self.http.post("/api/push/topic/unsubscribe", body).await
451    }
452
453    /// Check room WebSocket connection prerequisites — GET /api/room/connect-check
454    pub async fn check_room_connection(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
455        self.http.get_with_query("/api/room/connect-check", query).await
456    }
457
458    /// Connect to room WebSocket — GET /api/room
459    pub async fn connect_room(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
460        self.http.get_with_query("/api/room", query).await
461    }
462
463    /// Get room metadata — GET /api/room/metadata
464    pub async fn get_room_metadata(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
465        self.http.get_with_query("/api/room/metadata", query).await
466    }
467
468    /// Track custom events — POST /api/analytics/track
469    pub async fn track_events(&self, body: &Value) -> Result<Value, Error> {
470        self.http.post("/api/analytics/track", body).await
471    }
472}
473
474// ─── Path Constants ────────────────────────────────────────────────────────
475
476pub struct ApiPaths;
477
478impl ApiPaths {
479    pub const ADMIN_LOGIN: &'static str = "/admin/api/auth/login";
480    pub const ADMIN_REFRESH: &'static str = "/admin/api/auth/refresh";
481    pub const BACKUP_CLEANUP_PLUGIN: &'static str = "/admin/api/backup/cleanup-plugin";
482    pub const BACKUP_GET_CONFIG: &'static str = "/admin/api/backup/config";
483    pub const BACKUP_DUMP_CONTROL_D1: &'static str = "/admin/api/backup/dump-control-d1";
484    pub const BACKUP_DUMP_D1: &'static str = "/admin/api/backup/dump-d1";
485    pub const BACKUP_DUMP_DATA: &'static str = "/admin/api/backup/dump-data";
486    pub const BACKUP_DUMP_DO: &'static str = "/admin/api/backup/dump-do";
487    pub const BACKUP_DUMP_STORAGE: &'static str = "/admin/api/backup/dump-storage";
488    pub fn backup_export_table(name: &str) -> String {
489        format!("/admin/api/backup/export/{}", name)
490    }
491    pub const BACKUP_LIST_DOS: &'static str = "/admin/api/backup/list-dos";
492    pub const BACKUP_RESTORE_CONTROL_D1: &'static str = "/admin/api/backup/restore-control-d1";
493    pub const BACKUP_RESTORE_D1: &'static str = "/admin/api/backup/restore-d1";
494    pub const BACKUP_RESTORE_DATA: &'static str = "/admin/api/backup/restore-data";
495    pub const BACKUP_RESTORE_DO: &'static str = "/admin/api/backup/restore-do";
496    pub const BACKUP_RESTORE_STORAGE: &'static str = "/admin/api/backup/restore-storage";
497    pub const BACKUP_RESYNC_USERS_PUBLIC: &'static str = "/admin/api/backup/resync-users-public";
498    pub const BACKUP_WIPE_DO: &'static str = "/admin/api/backup/wipe-do";
499    pub const ADMIN_LIST_ADMINS: &'static str = "/admin/api/data/admins";
500    pub const ADMIN_CREATE_ADMIN: &'static str = "/admin/api/data/admins";
501    pub fn admin_delete_admin(id: &str) -> String {
502        format!("/admin/api/data/admins/{}", id)
503    }
504    pub fn admin_change_password(id: &str) -> String {
505        format!("/admin/api/data/admins/{}/password", id)
506    }
507    pub const ADMIN_GET_ANALYTICS: &'static str = "/admin/api/data/analytics";
508    pub const ADMIN_GET_ANALYTICS_EVENTS: &'static str = "/admin/api/data/analytics/events";
509    pub const ADMIN_GET_AUTH_SETTINGS: &'static str = "/admin/api/data/auth/settings";
510    pub const ADMIN_BACKUP_GET_CONFIG: &'static str = "/admin/api/data/backup/config";
511    pub const ADMIN_BACKUP_DUMP_D1: &'static str = "/admin/api/data/backup/dump-d1";
512    pub const ADMIN_BACKUP_DUMP_DATA: &'static str = "/admin/api/data/backup/dump-data";
513    pub const ADMIN_BACKUP_DUMP_DO: &'static str = "/admin/api/data/backup/dump-do";
514    pub const ADMIN_BACKUP_LIST_DOS: &'static str = "/admin/api/data/backup/list-dos";
515    pub const ADMIN_BACKUP_RESTORE_D1: &'static str = "/admin/api/data/backup/restore-d1";
516    pub const ADMIN_BACKUP_RESTORE_DATA: &'static str = "/admin/api/data/backup/restore-data";
517    pub const ADMIN_BACKUP_RESTORE_DO: &'static str = "/admin/api/data/backup/restore-do";
518    pub const ADMIN_CLEANUP_ANON: &'static str = "/admin/api/data/cleanup-anon";
519    pub const ADMIN_GET_CONFIG_INFO: &'static str = "/admin/api/data/config-info";
520    pub const ADMIN_DESTROY_APP: &'static str = "/admin/api/data/destroy-app";
521    pub const ADMIN_GET_DEV_INFO: &'static str = "/admin/api/data/dev-info";
522    pub const ADMIN_GET_EMAIL_TEMPLATES: &'static str = "/admin/api/data/email/templates";
523    pub const ADMIN_LIST_FUNCTIONS: &'static str = "/admin/api/data/functions";
524    pub const ADMIN_GET_LOGS: &'static str = "/admin/api/data/logs";
525    pub const ADMIN_GET_RECENT_LOGS: &'static str = "/admin/api/data/logs/recent";
526    pub const ADMIN_GET_MONITORING: &'static str = "/admin/api/data/monitoring";
527    pub fn admin_list_namespace_instances(namespace: &str) -> String {
528        format!("/admin/api/data/namespaces/{}/instances", namespace)
529    }
530    pub const ADMIN_GET_OVERVIEW: &'static str = "/admin/api/data/overview";
531    pub const ADMIN_GET_PUSH_LOGS: &'static str = "/admin/api/data/push/logs";
532    pub const ADMIN_TEST_PUSH_SEND: &'static str = "/admin/api/data/push/test-send";
533    pub const ADMIN_GET_PUSH_TOKENS: &'static str = "/admin/api/data/push/tokens";
534    pub const ADMIN_RULES_TEST: &'static str = "/admin/api/data/rules-test";
535    pub const ADMIN_GET_SCHEMA: &'static str = "/admin/api/data/schema";
536    pub const ADMIN_EXECUTE_SQL: &'static str = "/admin/api/data/sql";
537    pub const ADMIN_LIST_BUCKETS: &'static str = "/admin/api/data/storage/buckets";
538    pub fn admin_list_bucket_objects(name: &str) -> String {
539        format!("/admin/api/data/storage/buckets/{}/objects", name)
540    }
541    pub fn admin_get_bucket_object(name: &str, key: &str) -> String {
542        format!("/admin/api/data/storage/buckets/{}/objects/{}", name, key)
543    }
544    pub fn admin_delete_bucket_object(name: &str, key: &str) -> String {
545        format!("/admin/api/data/storage/buckets/{}/objects/{}", name, key)
546    }
547    pub fn admin_create_signed_url(name: &str) -> String {
548        format!("/admin/api/data/storage/buckets/{}/signed-url", name)
549    }
550    pub fn admin_get_bucket_stats(name: &str) -> String {
551        format!("/admin/api/data/storage/buckets/{}/stats", name)
552    }
553    pub fn admin_upload_file(name: &str) -> String {
554        format!("/admin/api/data/storage/buckets/{}/upload", name)
555    }
556    pub const ADMIN_LIST_TABLES: &'static str = "/admin/api/data/tables";
557    pub fn admin_export_table(name: &str) -> String {
558        format!("/admin/api/data/tables/{}/export", name)
559    }
560    pub fn admin_import_table(name: &str) -> String {
561        format!("/admin/api/data/tables/{}/import", name)
562    }
563    pub fn admin_get_table_records(name: &str) -> String {
564        format!("/admin/api/data/tables/{}/records", name)
565    }
566    pub fn admin_create_table_record(name: &str) -> String {
567        format!("/admin/api/data/tables/{}/records", name)
568    }
569    pub fn admin_update_table_record(name: &str, id: &str) -> String {
570        format!("/admin/api/data/tables/{}/records/{}", name, id)
571    }
572    pub fn admin_delete_table_record(name: &str, id: &str) -> String {
573        format!("/admin/api/data/tables/{}/records/{}", name, id)
574    }
575    pub const ADMIN_LIST_USERS: &'static str = "/admin/api/data/users";
576    pub const ADMIN_CREATE_USER: &'static str = "/admin/api/data/users";
577    pub fn admin_get_user(id: &str) -> String {
578        format!("/admin/api/data/users/{}", id)
579    }
580    pub fn admin_update_user(id: &str) -> String {
581        format!("/admin/api/data/users/{}", id)
582    }
583    pub fn admin_delete_user(id: &str) -> String {
584        format!("/admin/api/data/users/{}", id)
585    }
586    pub fn admin_delete_user_mfa(id: &str) -> String {
587        format!("/admin/api/data/users/{}/mfa", id)
588    }
589    pub fn admin_get_user_profile(id: &str) -> String {
590        format!("/admin/api/data/users/{}/profile", id)
591    }
592    pub fn admin_send_password_reset(id: &str) -> String {
593        format!("/admin/api/data/users/{}/send-password-reset", id)
594    }
595    pub fn admin_delete_user_sessions(id: &str) -> String {
596        format!("/admin/api/data/users/{}/sessions", id)
597    }
598    pub const ADMIN_RESET_PASSWORD: &'static str = "/admin/api/internal/reset-password";
599    pub const ADMIN_SETUP: &'static str = "/admin/api/setup";
600    pub const ADMIN_SETUP_STATUS: &'static str = "/admin/api/setup/status";
601    pub const QUERY_CUSTOM_EVENTS: &'static str = "/api/analytics/events";
602    pub const QUERY_ANALYTICS: &'static str = "/api/analytics/query";
603    pub const TRACK_EVENTS: &'static str = "/api/analytics/track";
604    pub const ADMIN_AUTH_LIST_USERS: &'static str = "/api/auth/admin/users";
605    pub const ADMIN_AUTH_CREATE_USER: &'static str = "/api/auth/admin/users";
606    pub fn admin_auth_get_user(id: &str) -> String {
607        format!("/api/auth/admin/users/{}", id)
608    }
609    pub fn admin_auth_update_user(id: &str) -> String {
610        format!("/api/auth/admin/users/{}", id)
611    }
612    pub fn admin_auth_delete_user(id: &str) -> String {
613        format!("/api/auth/admin/users/{}", id)
614    }
615    pub fn admin_auth_set_claims(id: &str) -> String {
616        format!("/api/auth/admin/users/{}/claims", id)
617    }
618    pub fn admin_auth_delete_user_mfa(id: &str) -> String {
619        format!("/api/auth/admin/users/{}/mfa", id)
620    }
621    pub fn admin_auth_revoke_user_sessions(id: &str) -> String {
622        format!("/api/auth/admin/users/{}/revoke", id)
623    }
624    pub const ADMIN_AUTH_IMPORT_USERS: &'static str = "/api/auth/admin/users/import";
625    pub const AUTH_CHANGE_EMAIL: &'static str = "/api/auth/change-email";
626    pub const AUTH_CHANGE_PASSWORD: &'static str = "/api/auth/change-password";
627    pub const AUTH_GET_IDENTITIES: &'static str = "/api/auth/identities";
628    pub fn auth_delete_identity(identity_id: &str) -> String {
629        format!("/api/auth/identities/{}", identity_id)
630    }
631    pub const AUTH_LINK_EMAIL: &'static str = "/api/auth/link/email";
632    pub const AUTH_LINK_PHONE: &'static str = "/api/auth/link/phone";
633    pub const AUTH_GET_ME: &'static str = "/api/auth/me";
634    pub const AUTH_MFA_FACTORS: &'static str = "/api/auth/mfa/factors";
635    pub const AUTH_MFA_RECOVERY: &'static str = "/api/auth/mfa/recovery";
636    pub const AUTH_MFA_TOTP_DELETE: &'static str = "/api/auth/mfa/totp";
637    pub const AUTH_MFA_TOTP_ENROLL: &'static str = "/api/auth/mfa/totp/enroll";
638    pub const AUTH_MFA_TOTP_VERIFY: &'static str = "/api/auth/mfa/totp/verify";
639    pub const AUTH_MFA_VERIFY: &'static str = "/api/auth/mfa/verify";
640    pub fn oauth_redirect(provider: &str) -> String {
641        format!("/api/auth/oauth/{}", provider)
642    }
643    pub fn oauth_callback(provider: &str) -> String {
644        format!("/api/auth/oauth/{}/callback", provider)
645    }
646    pub fn oauth_link_start(provider: &str) -> String {
647        format!("/api/auth/oauth/link/{}", provider)
648    }
649    pub fn oauth_link_callback(provider: &str) -> String {
650        format!("/api/auth/oauth/link/{}/callback", provider)
651    }
652    pub const AUTH_PASSKEYS_LIST: &'static str = "/api/auth/passkeys";
653    pub fn auth_passkeys_delete(credential_id: &str) -> String {
654        format!("/api/auth/passkeys/{}", credential_id)
655    }
656    pub const AUTH_PASSKEYS_AUTH_OPTIONS: &'static str = "/api/auth/passkeys/auth-options";
657    pub const AUTH_PASSKEYS_AUTHENTICATE: &'static str = "/api/auth/passkeys/authenticate";
658    pub const AUTH_PASSKEYS_REGISTER: &'static str = "/api/auth/passkeys/register";
659    pub const AUTH_PASSKEYS_REGISTER_OPTIONS: &'static str = "/api/auth/passkeys/register-options";
660    pub const AUTH_UPDATE_PROFILE: &'static str = "/api/auth/profile";
661    pub const AUTH_REFRESH: &'static str = "/api/auth/refresh";
662    pub const AUTH_REQUEST_EMAIL_VERIFICATION: &'static str = "/api/auth/request-email-verification";
663    pub const AUTH_REQUEST_PASSWORD_RESET: &'static str = "/api/auth/request-password-reset";
664    pub const AUTH_RESET_PASSWORD: &'static str = "/api/auth/reset-password";
665    pub const AUTH_GET_SESSIONS: &'static str = "/api/auth/sessions";
666    pub fn auth_delete_session(id: &str) -> String {
667        format!("/api/auth/sessions/{}", id)
668    }
669    pub const AUTH_SIGNIN: &'static str = "/api/auth/signin";
670    pub const AUTH_SIGNIN_ANONYMOUS: &'static str = "/api/auth/signin/anonymous";
671    pub const AUTH_SIGNIN_EMAIL_OTP: &'static str = "/api/auth/signin/email-otp";
672    pub const AUTH_SIGNIN_MAGIC_LINK: &'static str = "/api/auth/signin/magic-link";
673    pub const AUTH_SIGNIN_PHONE: &'static str = "/api/auth/signin/phone";
674    pub const AUTH_SIGNOUT: &'static str = "/api/auth/signout";
675    pub const AUTH_SIGNUP: &'static str = "/api/auth/signup";
676    pub const AUTH_VERIFY_EMAIL: &'static str = "/api/auth/verify-email";
677    pub const AUTH_VERIFY_EMAIL_CHANGE: &'static str = "/api/auth/verify-email-change";
678    pub const AUTH_VERIFY_EMAIL_OTP: &'static str = "/api/auth/verify-email-otp";
679    pub const AUTH_VERIFY_LINK_PHONE: &'static str = "/api/auth/verify-link-phone";
680    pub const AUTH_VERIFY_MAGIC_LINK: &'static str = "/api/auth/verify-magic-link";
681    pub const AUTH_VERIFY_PHONE: &'static str = "/api/auth/verify-phone";
682    pub const GET_CONFIG: &'static str = "/api/config";
683    pub fn execute_d1_query(database: &str) -> String {
684        format!("/api/d1/{}", database)
685    }
686    pub fn db_list_records(namespace: &str, instance_id: &str, table: &str) -> String {
687        format!("/api/db/{}/{}/tables/{}", namespace, instance_id, table)
688    }
689    pub fn db_insert_record(namespace: &str, instance_id: &str, table: &str) -> String {
690        format!("/api/db/{}/{}/tables/{}", namespace, instance_id, table)
691    }
692    pub fn db_get_record(namespace: &str, instance_id: &str, table: &str, id: &str) -> String {
693        format!("/api/db/{}/{}/tables/{}/{}", namespace, instance_id, table, id)
694    }
695    pub fn db_update_record(namespace: &str, instance_id: &str, table: &str, id: &str) -> String {
696        format!("/api/db/{}/{}/tables/{}/{}", namespace, instance_id, table, id)
697    }
698    pub fn db_delete_record(namespace: &str, instance_id: &str, table: &str, id: &str) -> String {
699        format!("/api/db/{}/{}/tables/{}/{}", namespace, instance_id, table, id)
700    }
701    pub fn db_batch_records(namespace: &str, instance_id: &str, table: &str) -> String {
702        format!("/api/db/{}/{}/tables/{}/batch", namespace, instance_id, table)
703    }
704    pub fn db_batch_by_filter(namespace: &str, instance_id: &str, table: &str) -> String {
705        format!("/api/db/{}/{}/tables/{}/batch-by-filter", namespace, instance_id, table)
706    }
707    pub fn db_count_records(namespace: &str, instance_id: &str, table: &str) -> String {
708        format!("/api/db/{}/{}/tables/{}/count", namespace, instance_id, table)
709    }
710    pub fn db_search_records(namespace: &str, instance_id: &str, table: &str) -> String {
711        format!("/api/db/{}/{}/tables/{}/search", namespace, instance_id, table)
712    }
713    pub fn db_single_list_records(namespace: &str, table: &str) -> String {
714        format!("/api/db/{}/tables/{}", namespace, table)
715    }
716    pub fn db_single_insert_record(namespace: &str, table: &str) -> String {
717        format!("/api/db/{}/tables/{}", namespace, table)
718    }
719    pub fn db_single_get_record(namespace: &str, table: &str, id: &str) -> String {
720        format!("/api/db/{}/tables/{}/{}", namespace, table, id)
721    }
722    pub fn db_single_update_record(namespace: &str, table: &str, id: &str) -> String {
723        format!("/api/db/{}/tables/{}/{}", namespace, table, id)
724    }
725    pub fn db_single_delete_record(namespace: &str, table: &str, id: &str) -> String {
726        format!("/api/db/{}/tables/{}/{}", namespace, table, id)
727    }
728    pub fn db_single_batch_records(namespace: &str, table: &str) -> String {
729        format!("/api/db/{}/tables/{}/batch", namespace, table)
730    }
731    pub fn db_single_batch_by_filter(namespace: &str, table: &str) -> String {
732        format!("/api/db/{}/tables/{}/batch-by-filter", namespace, table)
733    }
734    pub fn db_single_count_records(namespace: &str, table: &str) -> String {
735        format!("/api/db/{}/tables/{}/count", namespace, table)
736    }
737    pub fn db_single_search_records(namespace: &str, table: &str) -> String {
738        format!("/api/db/{}/tables/{}/search", namespace, table)
739    }
740    pub const DATABASE_LIVE_BROADCAST: &'static str = "/api/db/broadcast";
741    pub const CHECK_DATABASE_SUBSCRIPTION_CONNECTION: &'static str = "/api/db/connect-check";
742    pub const CONNECT_DATABASE_SUBSCRIPTION: &'static str = "/api/db/subscribe";
743    pub const GET_HEALTH: &'static str = "/api/health";
744    pub fn kv_operation(namespace: &str) -> String {
745        format!("/api/kv/{}", namespace)
746    }
747    pub const PUSH_BROADCAST: &'static str = "/api/push/broadcast";
748    pub const GET_PUSH_LOGS: &'static str = "/api/push/logs";
749    pub const PUSH_REGISTER: &'static str = "/api/push/register";
750    pub const PUSH_SEND: &'static str = "/api/push/send";
751    pub const PUSH_SEND_MANY: &'static str = "/api/push/send-many";
752    pub const PUSH_SEND_TO_TOKEN: &'static str = "/api/push/send-to-token";
753    pub const PUSH_SEND_TO_TOPIC: &'static str = "/api/push/send-to-topic";
754    pub const GET_PUSH_TOKENS: &'static str = "/api/push/tokens";
755    pub const PUT_PUSH_TOKENS: &'static str = "/api/push/tokens";
756    pub const PATCH_PUSH_TOKENS: &'static str = "/api/push/tokens";
757    pub const PUSH_TOPIC_SUBSCRIBE: &'static str = "/api/push/topic/subscribe";
758    pub const PUSH_TOPIC_UNSUBSCRIBE: &'static str = "/api/push/topic/unsubscribe";
759    pub const PUSH_UNREGISTER: &'static str = "/api/push/unregister";
760    pub const CONNECT_ROOM: &'static str = "/api/room";
761    pub const CHECK_ROOM_CONNECTION: &'static str = "/api/room/connect-check";
762    pub const GET_ROOM_METADATA: &'static str = "/api/room/metadata";
763    pub const GET_SCHEMA: &'static str = "/api/schema";
764    pub const EXECUTE_SQL: &'static str = "/api/sql";
765    pub fn list_files(bucket: &str) -> String {
766        format!("/api/storage/{}", bucket)
767    }
768    pub fn check_file_exists(bucket: &str, key: &str) -> String {
769        format!("/api/storage/{}/{}", bucket, key)
770    }
771    pub fn download_file(bucket: &str, key: &str) -> String {
772        format!("/api/storage/{}/{}", bucket, key)
773    }
774    pub fn delete_file(bucket: &str, key: &str) -> String {
775        format!("/api/storage/{}/{}", bucket, key)
776    }
777    pub fn get_file_metadata(bucket: &str, key: &str) -> String {
778        format!("/api/storage/{}/{}/metadata", bucket, key)
779    }
780    pub fn update_file_metadata(bucket: &str, key: &str) -> String {
781        format!("/api/storage/{}/{}/metadata", bucket, key)
782    }
783    pub fn delete_batch(bucket: &str) -> String {
784        format!("/api/storage/{}/delete-batch", bucket)
785    }
786    pub fn abort_multipart_upload(bucket: &str) -> String {
787        format!("/api/storage/{}/multipart/abort", bucket)
788    }
789    pub fn complete_multipart_upload(bucket: &str) -> String {
790        format!("/api/storage/{}/multipart/complete", bucket)
791    }
792    pub fn create_multipart_upload(bucket: &str) -> String {
793        format!("/api/storage/{}/multipart/create", bucket)
794    }
795    pub fn upload_part(bucket: &str) -> String {
796        format!("/api/storage/{}/multipart/upload-part", bucket)
797    }
798    pub fn create_signed_upload_url(bucket: &str) -> String {
799        format!("/api/storage/{}/signed-upload-url", bucket)
800    }
801    pub fn create_signed_download_url(bucket: &str) -> String {
802        format!("/api/storage/{}/signed-url", bucket)
803    }
804    pub fn create_signed_download_urls(bucket: &str) -> String {
805        format!("/api/storage/{}/signed-urls", bucket)
806    }
807    pub fn upload_file(bucket: &str) -> String {
808        format!("/api/storage/{}/upload", bucket)
809    }
810    pub fn get_upload_parts(bucket: &str, upload_id: &str) -> String {
811        format!("/api/storage/{}/uploads/{}/parts", bucket, upload_id)
812    }
813    pub fn vectorize_operation(index: &str) -> String {
814        format!("/api/vectorize/{}", index)
815    }
816}