1use 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
13pub 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 pub async fn get_health(&self) -> Result<Value, Error> {
25 self.http.get("/api/health").await
26 }
27
28 pub async fn auth_signup(&self, body: &Value) -> Result<Value, Error> {
30 self.http.post("/api/auth/signup", body).await
31 }
32
33 pub async fn auth_signin(&self, body: &Value) -> Result<Value, Error> {
35 self.http.post("/api/auth/signin", body).await
36 }
37
38 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 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 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 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 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 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 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 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 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 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 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 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 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 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 pub async fn auth_mfa_factors(&self) -> Result<Value, Error> {
110 self.http.get("/api/auth/mfa/factors").await
111 }
112
113 pub async fn auth_refresh(&self, body: &Value) -> Result<Value, Error> {
115 self.http.post("/api/auth/refresh", body).await
116 }
117
118 pub async fn auth_signout(&self, body: &Value) -> Result<Value, Error> {
120 self.http.post("/api/auth/signout", body).await
121 }
122
123 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 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 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 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 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 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 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 pub async fn auth_passkeys_list(&self) -> Result<Value, Error> {
160 self.http.get("/api/auth/passkeys").await
161 }
162
163 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 pub async fn auth_get_me(&self) -> Result<Value, Error> {
170 self.http.get("/api/auth/me").await
171 }
172
173 pub async fn auth_update_profile(&self, body: &Value) -> Result<Value, Error> {
175 self.http.patch("/api/auth/profile", body).await
176 }
177
178 pub async fn auth_get_sessions(&self) -> Result<Value, Error> {
180 self.http.get("/api/auth/sessions").await
181 }
182
183 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 pub async fn auth_get_identities(&self) -> Result<Value, Error> {
190 self.http.get("/api/auth/identities").await
191 }
192
193 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 pub async fn get_schema(&self) -> Result<Value, Error> {
345 self.http.get("/api/schema").await
346 }
347
348 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 pub async fn get_config(&self) -> Result<Value, Error> {
430 self.http.get("/api/config").await
431 }
432
433 pub async fn push_register(&self, body: &Value) -> Result<Value, Error> {
435 self.http.post("/api/push/register", body).await
436 }
437
438 pub async fn push_unregister(&self, body: &Value) -> Result<Value, Error> {
440 self.http.post("/api/push/unregister", body).await
441 }
442
443 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 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 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 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 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 pub async fn get_room_realtime_session(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
470 self.http.get_with_query("/api/room/media/realtime/session", query).await
471 }
472
473 pub async fn create_room_realtime_session(&self, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
475 self.http.post_with_query("/api/room/media/realtime/session", body, query).await
476 }
477
478 pub async fn create_room_realtime_ice_servers(&self, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
480 self.http.post_with_query("/api/room/media/realtime/turn", body, query).await
481 }
482
483 pub async fn add_room_realtime_tracks(&self, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
485 self.http.post_with_query("/api/room/media/realtime/tracks/new", body, query).await
486 }
487
488 pub async fn renegotiate_room_realtime_session(&self, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
490 self.http.put_with_query("/api/room/media/realtime/renegotiate", body, query).await
491 }
492
493 pub async fn close_room_realtime_tracks(&self, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
495 self.http.put_with_query("/api/room/media/realtime/tracks/close", body, query).await
496 }
497
498 pub async fn create_room_cloudflare_realtime_kit_session(&self, body: &Value, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
500 self.http.post_with_query("/api/room/media/cloudflare_realtimekit/session", body, query).await
501 }
502
503 pub async fn track_events(&self, body: &Value) -> Result<Value, Error> {
505 self.http.post("/api/analytics/track", body).await
506 }
507}
508
509pub struct ApiPaths;
512
513impl ApiPaths {
514 pub const ADMIN_LOGIN: &'static str = "/admin/api/auth/login";
515 pub const ADMIN_REFRESH: &'static str = "/admin/api/auth/refresh";
516 pub const BACKUP_CLEANUP_PLUGIN: &'static str = "/admin/api/backup/cleanup-plugin";
517 pub const BACKUP_GET_CONFIG: &'static str = "/admin/api/backup/config";
518 pub const BACKUP_DUMP_CONTROL_D1: &'static str = "/admin/api/backup/dump-control-d1";
519 pub const BACKUP_DUMP_D1: &'static str = "/admin/api/backup/dump-d1";
520 pub const BACKUP_DUMP_DATA: &'static str = "/admin/api/backup/dump-data";
521 pub const BACKUP_DUMP_DO: &'static str = "/admin/api/backup/dump-do";
522 pub const BACKUP_DUMP_STORAGE: &'static str = "/admin/api/backup/dump-storage";
523 pub fn backup_export_table(name: &str) -> String {
524 format!("/admin/api/backup/export/{}", name)
525 }
526 pub const BACKUP_LIST_DOS: &'static str = "/admin/api/backup/list-dos";
527 pub const BACKUP_RESTORE_CONTROL_D1: &'static str = "/admin/api/backup/restore-control-d1";
528 pub const BACKUP_RESTORE_D1: &'static str = "/admin/api/backup/restore-d1";
529 pub const BACKUP_RESTORE_DATA: &'static str = "/admin/api/backup/restore-data";
530 pub const BACKUP_RESTORE_DO: &'static str = "/admin/api/backup/restore-do";
531 pub const BACKUP_RESTORE_STORAGE: &'static str = "/admin/api/backup/restore-storage";
532 pub const BACKUP_RESYNC_USERS_PUBLIC: &'static str = "/admin/api/backup/resync-users-public";
533 pub const BACKUP_WIPE_DO: &'static str = "/admin/api/backup/wipe-do";
534 pub const ADMIN_LIST_ADMINS: &'static str = "/admin/api/data/admins";
535 pub const ADMIN_CREATE_ADMIN: &'static str = "/admin/api/data/admins";
536 pub fn admin_delete_admin(id: &str) -> String {
537 format!("/admin/api/data/admins/{}", id)
538 }
539 pub fn admin_change_password(id: &str) -> String {
540 format!("/admin/api/data/admins/{}/password", id)
541 }
542 pub const ADMIN_GET_ANALYTICS: &'static str = "/admin/api/data/analytics";
543 pub const ADMIN_GET_ANALYTICS_EVENTS: &'static str = "/admin/api/data/analytics/events";
544 pub const ADMIN_GET_AUTH_SETTINGS: &'static str = "/admin/api/data/auth/settings";
545 pub const ADMIN_BACKUP_GET_CONFIG: &'static str = "/admin/api/data/backup/config";
546 pub const ADMIN_BACKUP_DUMP_D1: &'static str = "/admin/api/data/backup/dump-d1";
547 pub const ADMIN_BACKUP_DUMP_DATA: &'static str = "/admin/api/data/backup/dump-data";
548 pub const ADMIN_BACKUP_DUMP_DO: &'static str = "/admin/api/data/backup/dump-do";
549 pub const ADMIN_BACKUP_LIST_DOS: &'static str = "/admin/api/data/backup/list-dos";
550 pub const ADMIN_BACKUP_RESTORE_D1: &'static str = "/admin/api/data/backup/restore-d1";
551 pub const ADMIN_BACKUP_RESTORE_DATA: &'static str = "/admin/api/data/backup/restore-data";
552 pub const ADMIN_BACKUP_RESTORE_DO: &'static str = "/admin/api/data/backup/restore-do";
553 pub const ADMIN_CLEANUP_ANON: &'static str = "/admin/api/data/cleanup-anon";
554 pub const ADMIN_GET_CONFIG_INFO: &'static str = "/admin/api/data/config-info";
555 pub const ADMIN_DESTROY_APP: &'static str = "/admin/api/data/destroy-app";
556 pub const ADMIN_GET_DEV_INFO: &'static str = "/admin/api/data/dev-info";
557 pub const ADMIN_GET_EMAIL_TEMPLATES: &'static str = "/admin/api/data/email/templates";
558 pub const ADMIN_LIST_FUNCTIONS: &'static str = "/admin/api/data/functions";
559 pub const ADMIN_GET_LOGS: &'static str = "/admin/api/data/logs";
560 pub const ADMIN_GET_RECENT_LOGS: &'static str = "/admin/api/data/logs/recent";
561 pub const ADMIN_GET_MONITORING: &'static str = "/admin/api/data/monitoring";
562 pub fn admin_list_namespace_instances(namespace: &str) -> String {
563 format!("/admin/api/data/namespaces/{}/instances", namespace)
564 }
565 pub const ADMIN_GET_OVERVIEW: &'static str = "/admin/api/data/overview";
566 pub const ADMIN_GET_PUSH_LOGS: &'static str = "/admin/api/data/push/logs";
567 pub const ADMIN_TEST_PUSH_SEND: &'static str = "/admin/api/data/push/test-send";
568 pub const ADMIN_GET_PUSH_TOKENS: &'static str = "/admin/api/data/push/tokens";
569 pub const ADMIN_RULES_TEST: &'static str = "/admin/api/data/rules-test";
570 pub const ADMIN_GET_SCHEMA: &'static str = "/admin/api/data/schema";
571 pub const ADMIN_EXECUTE_SQL: &'static str = "/admin/api/data/sql";
572 pub const ADMIN_LIST_BUCKETS: &'static str = "/admin/api/data/storage/buckets";
573 pub fn admin_list_bucket_objects(name: &str) -> String {
574 format!("/admin/api/data/storage/buckets/{}/objects", name)
575 }
576 pub fn admin_get_bucket_object(name: &str, key: &str) -> String {
577 format!("/admin/api/data/storage/buckets/{}/objects/{}", name, key)
578 }
579 pub fn admin_delete_bucket_object(name: &str, key: &str) -> String {
580 format!("/admin/api/data/storage/buckets/{}/objects/{}", name, key)
581 }
582 pub fn admin_create_signed_url(name: &str) -> String {
583 format!("/admin/api/data/storage/buckets/{}/signed-url", name)
584 }
585 pub fn admin_get_bucket_stats(name: &str) -> String {
586 format!("/admin/api/data/storage/buckets/{}/stats", name)
587 }
588 pub fn admin_upload_file(name: &str) -> String {
589 format!("/admin/api/data/storage/buckets/{}/upload", name)
590 }
591 pub const ADMIN_LIST_TABLES: &'static str = "/admin/api/data/tables";
592 pub fn admin_export_table(name: &str) -> String {
593 format!("/admin/api/data/tables/{}/export", name)
594 }
595 pub fn admin_import_table(name: &str) -> String {
596 format!("/admin/api/data/tables/{}/import", name)
597 }
598 pub fn admin_get_table_records(name: &str) -> String {
599 format!("/admin/api/data/tables/{}/records", name)
600 }
601 pub fn admin_create_table_record(name: &str) -> String {
602 format!("/admin/api/data/tables/{}/records", name)
603 }
604 pub fn admin_update_table_record(name: &str, id: &str) -> String {
605 format!("/admin/api/data/tables/{}/records/{}", name, id)
606 }
607 pub fn admin_delete_table_record(name: &str, id: &str) -> String {
608 format!("/admin/api/data/tables/{}/records/{}", name, id)
609 }
610 pub const ADMIN_LIST_USERS: &'static str = "/admin/api/data/users";
611 pub const ADMIN_CREATE_USER: &'static str = "/admin/api/data/users";
612 pub fn admin_get_user(id: &str) -> String {
613 format!("/admin/api/data/users/{}", id)
614 }
615 pub fn admin_update_user(id: &str) -> String {
616 format!("/admin/api/data/users/{}", id)
617 }
618 pub fn admin_delete_user(id: &str) -> String {
619 format!("/admin/api/data/users/{}", id)
620 }
621 pub fn admin_delete_user_mfa(id: &str) -> String {
622 format!("/admin/api/data/users/{}/mfa", id)
623 }
624 pub fn admin_get_user_profile(id: &str) -> String {
625 format!("/admin/api/data/users/{}/profile", id)
626 }
627 pub fn admin_send_password_reset(id: &str) -> String {
628 format!("/admin/api/data/users/{}/send-password-reset", id)
629 }
630 pub fn admin_delete_user_sessions(id: &str) -> String {
631 format!("/admin/api/data/users/{}/sessions", id)
632 }
633 pub const ADMIN_RESET_PASSWORD: &'static str = "/admin/api/internal/reset-password";
634 pub const ADMIN_SETUP: &'static str = "/admin/api/setup";
635 pub const ADMIN_SETUP_STATUS: &'static str = "/admin/api/setup/status";
636 pub const QUERY_CUSTOM_EVENTS: &'static str = "/api/analytics/events";
637 pub const QUERY_ANALYTICS: &'static str = "/api/analytics/query";
638 pub const TRACK_EVENTS: &'static str = "/api/analytics/track";
639 pub const ADMIN_AUTH_LIST_USERS: &'static str = "/api/auth/admin/users";
640 pub const ADMIN_AUTH_CREATE_USER: &'static str = "/api/auth/admin/users";
641 pub fn admin_auth_get_user(id: &str) -> String {
642 format!("/api/auth/admin/users/{}", id)
643 }
644 pub fn admin_auth_update_user(id: &str) -> String {
645 format!("/api/auth/admin/users/{}", id)
646 }
647 pub fn admin_auth_delete_user(id: &str) -> String {
648 format!("/api/auth/admin/users/{}", id)
649 }
650 pub fn admin_auth_set_claims(id: &str) -> String {
651 format!("/api/auth/admin/users/{}/claims", id)
652 }
653 pub fn admin_auth_delete_user_mfa(id: &str) -> String {
654 format!("/api/auth/admin/users/{}/mfa", id)
655 }
656 pub fn admin_auth_revoke_user_sessions(id: &str) -> String {
657 format!("/api/auth/admin/users/{}/revoke", id)
658 }
659 pub const ADMIN_AUTH_IMPORT_USERS: &'static str = "/api/auth/admin/users/import";
660 pub const AUTH_CHANGE_EMAIL: &'static str = "/api/auth/change-email";
661 pub const AUTH_CHANGE_PASSWORD: &'static str = "/api/auth/change-password";
662 pub const AUTH_GET_IDENTITIES: &'static str = "/api/auth/identities";
663 pub fn auth_delete_identity(identity_id: &str) -> String {
664 format!("/api/auth/identities/{}", identity_id)
665 }
666 pub const AUTH_LINK_EMAIL: &'static str = "/api/auth/link/email";
667 pub const AUTH_LINK_PHONE: &'static str = "/api/auth/link/phone";
668 pub const AUTH_GET_ME: &'static str = "/api/auth/me";
669 pub const AUTH_MFA_FACTORS: &'static str = "/api/auth/mfa/factors";
670 pub const AUTH_MFA_RECOVERY: &'static str = "/api/auth/mfa/recovery";
671 pub const AUTH_MFA_TOTP_DELETE: &'static str = "/api/auth/mfa/totp";
672 pub const AUTH_MFA_TOTP_ENROLL: &'static str = "/api/auth/mfa/totp/enroll";
673 pub const AUTH_MFA_TOTP_VERIFY: &'static str = "/api/auth/mfa/totp/verify";
674 pub const AUTH_MFA_VERIFY: &'static str = "/api/auth/mfa/verify";
675 pub fn oauth_redirect(provider: &str) -> String {
676 format!("/api/auth/oauth/{}", provider)
677 }
678 pub fn oauth_callback(provider: &str) -> String {
679 format!("/api/auth/oauth/{}/callback", provider)
680 }
681 pub fn oauth_link_start(provider: &str) -> String {
682 format!("/api/auth/oauth/link/{}", provider)
683 }
684 pub fn oauth_link_callback(provider: &str) -> String {
685 format!("/api/auth/oauth/link/{}/callback", provider)
686 }
687 pub const AUTH_PASSKEYS_LIST: &'static str = "/api/auth/passkeys";
688 pub fn auth_passkeys_delete(credential_id: &str) -> String {
689 format!("/api/auth/passkeys/{}", credential_id)
690 }
691 pub const AUTH_PASSKEYS_AUTH_OPTIONS: &'static str = "/api/auth/passkeys/auth-options";
692 pub const AUTH_PASSKEYS_AUTHENTICATE: &'static str = "/api/auth/passkeys/authenticate";
693 pub const AUTH_PASSKEYS_REGISTER: &'static str = "/api/auth/passkeys/register";
694 pub const AUTH_PASSKEYS_REGISTER_OPTIONS: &'static str = "/api/auth/passkeys/register-options";
695 pub const AUTH_UPDATE_PROFILE: &'static str = "/api/auth/profile";
696 pub const AUTH_REFRESH: &'static str = "/api/auth/refresh";
697 pub const AUTH_REQUEST_EMAIL_VERIFICATION: &'static str = "/api/auth/request-email-verification";
698 pub const AUTH_REQUEST_PASSWORD_RESET: &'static str = "/api/auth/request-password-reset";
699 pub const AUTH_RESET_PASSWORD: &'static str = "/api/auth/reset-password";
700 pub const AUTH_GET_SESSIONS: &'static str = "/api/auth/sessions";
701 pub fn auth_delete_session(id: &str) -> String {
702 format!("/api/auth/sessions/{}", id)
703 }
704 pub const AUTH_SIGNIN: &'static str = "/api/auth/signin";
705 pub const AUTH_SIGNIN_ANONYMOUS: &'static str = "/api/auth/signin/anonymous";
706 pub const AUTH_SIGNIN_EMAIL_OTP: &'static str = "/api/auth/signin/email-otp";
707 pub const AUTH_SIGNIN_MAGIC_LINK: &'static str = "/api/auth/signin/magic-link";
708 pub const AUTH_SIGNIN_PHONE: &'static str = "/api/auth/signin/phone";
709 pub const AUTH_SIGNOUT: &'static str = "/api/auth/signout";
710 pub const AUTH_SIGNUP: &'static str = "/api/auth/signup";
711 pub const AUTH_VERIFY_EMAIL: &'static str = "/api/auth/verify-email";
712 pub const AUTH_VERIFY_EMAIL_CHANGE: &'static str = "/api/auth/verify-email-change";
713 pub const AUTH_VERIFY_EMAIL_OTP: &'static str = "/api/auth/verify-email-otp";
714 pub const AUTH_VERIFY_LINK_PHONE: &'static str = "/api/auth/verify-link-phone";
715 pub const AUTH_VERIFY_MAGIC_LINK: &'static str = "/api/auth/verify-magic-link";
716 pub const AUTH_VERIFY_PHONE: &'static str = "/api/auth/verify-phone";
717 pub const GET_CONFIG: &'static str = "/api/config";
718 pub fn execute_d1_query(database: &str) -> String {
719 format!("/api/d1/{}", database)
720 }
721 pub fn db_list_records(namespace: &str, instance_id: &str, table: &str) -> String {
722 format!("/api/db/{}/{}/tables/{}", namespace, instance_id, table)
723 }
724 pub fn db_insert_record(namespace: &str, instance_id: &str, table: &str) -> String {
725 format!("/api/db/{}/{}/tables/{}", namespace, instance_id, table)
726 }
727 pub fn db_get_record(namespace: &str, instance_id: &str, table: &str, id: &str) -> String {
728 format!("/api/db/{}/{}/tables/{}/{}", namespace, instance_id, table, id)
729 }
730 pub fn db_update_record(namespace: &str, instance_id: &str, table: &str, id: &str) -> String {
731 format!("/api/db/{}/{}/tables/{}/{}", namespace, instance_id, table, id)
732 }
733 pub fn db_delete_record(namespace: &str, instance_id: &str, table: &str, id: &str) -> String {
734 format!("/api/db/{}/{}/tables/{}/{}", namespace, instance_id, table, id)
735 }
736 pub fn db_batch_records(namespace: &str, instance_id: &str, table: &str) -> String {
737 format!("/api/db/{}/{}/tables/{}/batch", namespace, instance_id, table)
738 }
739 pub fn db_batch_by_filter(namespace: &str, instance_id: &str, table: &str) -> String {
740 format!("/api/db/{}/{}/tables/{}/batch-by-filter", namespace, instance_id, table)
741 }
742 pub fn db_count_records(namespace: &str, instance_id: &str, table: &str) -> String {
743 format!("/api/db/{}/{}/tables/{}/count", namespace, instance_id, table)
744 }
745 pub fn db_search_records(namespace: &str, instance_id: &str, table: &str) -> String {
746 format!("/api/db/{}/{}/tables/{}/search", namespace, instance_id, table)
747 }
748 pub fn db_single_list_records(namespace: &str, table: &str) -> String {
749 format!("/api/db/{}/tables/{}", namespace, table)
750 }
751 pub fn db_single_insert_record(namespace: &str, table: &str) -> String {
752 format!("/api/db/{}/tables/{}", namespace, table)
753 }
754 pub fn db_single_get_record(namespace: &str, table: &str, id: &str) -> String {
755 format!("/api/db/{}/tables/{}/{}", namespace, table, id)
756 }
757 pub fn db_single_update_record(namespace: &str, table: &str, id: &str) -> String {
758 format!("/api/db/{}/tables/{}/{}", namespace, table, id)
759 }
760 pub fn db_single_delete_record(namespace: &str, table: &str, id: &str) -> String {
761 format!("/api/db/{}/tables/{}/{}", namespace, table, id)
762 }
763 pub fn db_single_batch_records(namespace: &str, table: &str) -> String {
764 format!("/api/db/{}/tables/{}/batch", namespace, table)
765 }
766 pub fn db_single_batch_by_filter(namespace: &str, table: &str) -> String {
767 format!("/api/db/{}/tables/{}/batch-by-filter", namespace, table)
768 }
769 pub fn db_single_count_records(namespace: &str, table: &str) -> String {
770 format!("/api/db/{}/tables/{}/count", namespace, table)
771 }
772 pub fn db_single_search_records(namespace: &str, table: &str) -> String {
773 format!("/api/db/{}/tables/{}/search", namespace, table)
774 }
775 pub const DATABASE_LIVE_BROADCAST: &'static str = "/api/db/broadcast";
776 pub const CHECK_DATABASE_SUBSCRIPTION_CONNECTION: &'static str = "/api/db/connect-check";
777 pub const CONNECT_DATABASE_SUBSCRIPTION: &'static str = "/api/db/subscribe";
778 pub const GET_HEALTH: &'static str = "/api/health";
779 pub fn kv_operation(namespace: &str) -> String {
780 format!("/api/kv/{}", namespace)
781 }
782 pub const PUSH_BROADCAST: &'static str = "/api/push/broadcast";
783 pub const GET_PUSH_LOGS: &'static str = "/api/push/logs";
784 pub const PUSH_REGISTER: &'static str = "/api/push/register";
785 pub const PUSH_SEND: &'static str = "/api/push/send";
786 pub const PUSH_SEND_MANY: &'static str = "/api/push/send-many";
787 pub const PUSH_SEND_TO_TOKEN: &'static str = "/api/push/send-to-token";
788 pub const PUSH_SEND_TO_TOPIC: &'static str = "/api/push/send-to-topic";
789 pub const GET_PUSH_TOKENS: &'static str = "/api/push/tokens";
790 pub const PUT_PUSH_TOKENS: &'static str = "/api/push/tokens";
791 pub const PATCH_PUSH_TOKENS: &'static str = "/api/push/tokens";
792 pub const PUSH_TOPIC_SUBSCRIBE: &'static str = "/api/push/topic/subscribe";
793 pub const PUSH_TOPIC_UNSUBSCRIBE: &'static str = "/api/push/topic/unsubscribe";
794 pub const PUSH_UNREGISTER: &'static str = "/api/push/unregister";
795 pub const CONNECT_ROOM: &'static str = "/api/room";
796 pub const CHECK_ROOM_CONNECTION: &'static str = "/api/room/connect-check";
797 pub const CREATE_ROOM_CLOUDFLARE_REALTIME_KIT_SESSION: &'static str = "/api/room/media/cloudflare_realtimekit/session";
798 pub const RENEGOTIATE_ROOM_REALTIME_SESSION: &'static str = "/api/room/media/realtime/renegotiate";
799 pub const GET_ROOM_REALTIME_SESSION: &'static str = "/api/room/media/realtime/session";
800 pub const CREATE_ROOM_REALTIME_SESSION: &'static str = "/api/room/media/realtime/session";
801 pub const CLOSE_ROOM_REALTIME_TRACKS: &'static str = "/api/room/media/realtime/tracks/close";
802 pub const ADD_ROOM_REALTIME_TRACKS: &'static str = "/api/room/media/realtime/tracks/new";
803 pub const CREATE_ROOM_REALTIME_ICE_SERVERS: &'static str = "/api/room/media/realtime/turn";
804 pub const GET_ROOM_METADATA: &'static str = "/api/room/metadata";
805 pub const GET_SCHEMA: &'static str = "/api/schema";
806 pub const EXECUTE_SQL: &'static str = "/api/sql";
807 pub fn list_files(bucket: &str) -> String {
808 format!("/api/storage/{}", bucket)
809 }
810 pub fn check_file_exists(bucket: &str, key: &str) -> String {
811 format!("/api/storage/{}/{}", bucket, key)
812 }
813 pub fn download_file(bucket: &str, key: &str) -> String {
814 format!("/api/storage/{}/{}", bucket, key)
815 }
816 pub fn delete_file(bucket: &str, key: &str) -> String {
817 format!("/api/storage/{}/{}", bucket, key)
818 }
819 pub fn get_file_metadata(bucket: &str, key: &str) -> String {
820 format!("/api/storage/{}/{}/metadata", bucket, key)
821 }
822 pub fn update_file_metadata(bucket: &str, key: &str) -> String {
823 format!("/api/storage/{}/{}/metadata", bucket, key)
824 }
825 pub fn delete_batch(bucket: &str) -> String {
826 format!("/api/storage/{}/delete-batch", bucket)
827 }
828 pub fn abort_multipart_upload(bucket: &str) -> String {
829 format!("/api/storage/{}/multipart/abort", bucket)
830 }
831 pub fn complete_multipart_upload(bucket: &str) -> String {
832 format!("/api/storage/{}/multipart/complete", bucket)
833 }
834 pub fn create_multipart_upload(bucket: &str) -> String {
835 format!("/api/storage/{}/multipart/create", bucket)
836 }
837 pub fn upload_part(bucket: &str) -> String {
838 format!("/api/storage/{}/multipart/upload-part", bucket)
839 }
840 pub fn create_signed_upload_url(bucket: &str) -> String {
841 format!("/api/storage/{}/signed-upload-url", bucket)
842 }
843 pub fn create_signed_download_url(bucket: &str) -> String {
844 format!("/api/storage/{}/signed-url", bucket)
845 }
846 pub fn create_signed_download_urls(bucket: &str) -> String {
847 format!("/api/storage/{}/signed-urls", bucket)
848 }
849 pub fn upload_file(bucket: &str) -> String {
850 format!("/api/storage/{}/upload", bucket)
851 }
852 pub fn get_upload_parts(bucket: &str, upload_id: &str) -> String {
853 format!("/api/storage/{}/uploads/{}/parts", bucket, upload_id)
854 }
855 pub fn vectorize_operation(index: &str) -> String {
856 format!("/api/vectorize/{}", index)
857 }
858}