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 GeneratedAdminApi<'a> {
15 http: &'a HttpClient,
16}
17
18impl<'a> GeneratedAdminApi<'a> {
19 pub fn new(http: &'a HttpClient) -> Self {
20 Self { http }
21 }
22
23 pub async fn admin_auth_get_user(&self, id: &str) -> Result<Value, Error> {
25 self.http.get(&format!("/api/auth/admin/users/{}", encode_path_param(id))).await
26 }
27
28 pub async fn admin_auth_update_user(&self, id: &str, body: &Value) -> Result<Value, Error> {
30 self.http.patch(&format!("/api/auth/admin/users/{}", encode_path_param(id)), body).await
31 }
32
33 pub async fn admin_auth_delete_user(&self, id: &str) -> Result<Value, Error> {
35 self.http.delete(&format!("/api/auth/admin/users/{}", encode_path_param(id))).await
36 }
37
38 pub async fn admin_auth_list_users(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
40 self.http.get_with_query("/api/auth/admin/users", query).await
41 }
42
43 pub async fn admin_auth_create_user(&self, body: &Value) -> Result<Value, Error> {
45 self.http.post("/api/auth/admin/users", body).await
46 }
47
48 pub async fn admin_auth_delete_user_mfa(&self, id: &str) -> Result<Value, Error> {
50 self.http.delete(&format!("/api/auth/admin/users/{}/mfa", encode_path_param(id))).await
51 }
52
53 pub async fn admin_auth_set_claims(&self, id: &str, body: &Value) -> Result<Value, Error> {
55 self.http.put(&format!("/api/auth/admin/users/{}/claims", encode_path_param(id)), body).await
56 }
57
58 pub async fn admin_auth_revoke_user_sessions(&self, id: &str) -> Result<Value, Error> {
60 self.http.post(&format!("/api/auth/admin/users/{}/revoke", encode_path_param(id)), &Value::Null).await
61 }
62
63 pub async fn admin_auth_import_users(&self, body: &Value) -> Result<Value, Error> {
65 self.http.post("/api/auth/admin/users/import", body).await
66 }
67
68 pub async fn database_live_broadcast(&self, body: &Value) -> Result<Value, Error> {
70 self.http.post("/api/db/broadcast", body).await
71 }
72
73 pub async fn execute_sql(&self, body: &Value) -> Result<Value, Error> {
75 self.http.post("/api/sql", body).await
76 }
77
78 pub async fn kv_operation(&self, namespace: &str, body: &Value) -> Result<Value, Error> {
80 self.http.post(&format!("/api/kv/{}", encode_path_param(namespace)), body).await
81 }
82
83 pub async fn execute_d1_query(&self, database: &str, body: &Value) -> Result<Value, Error> {
85 self.http.post(&format!("/api/d1/{}", encode_path_param(database)), body).await
86 }
87
88 pub async fn vectorize_operation(&self, index: &str, body: &Value) -> Result<Value, Error> {
90 self.http.post(&format!("/api/vectorize/{}", encode_path_param(index)), body).await
91 }
92
93 pub async fn push_send(&self, body: &Value) -> Result<Value, Error> {
95 self.http.post("/api/push/send", body).await
96 }
97
98 pub async fn push_send_many(&self, body: &Value) -> Result<Value, Error> {
100 self.http.post("/api/push/send-many", body).await
101 }
102
103 pub async fn push_send_to_token(&self, body: &Value) -> Result<Value, Error> {
105 self.http.post("/api/push/send-to-token", body).await
106 }
107
108 pub async fn push_send_to_topic(&self, body: &Value) -> Result<Value, Error> {
110 self.http.post("/api/push/send-to-topic", body).await
111 }
112
113 pub async fn push_broadcast(&self, body: &Value) -> Result<Value, Error> {
115 self.http.post("/api/push/broadcast", body).await
116 }
117
118 pub async fn get_push_logs(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
120 self.http.get_with_query("/api/push/logs", query).await
121 }
122
123 pub async fn get_push_tokens(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
125 self.http.get_with_query("/api/push/tokens", query).await
126 }
127
128 pub async fn put_push_tokens(&self, body: &Value) -> Result<Value, Error> {
130 self.http.put("/api/push/tokens", body).await
131 }
132
133 pub async fn patch_push_tokens(&self, body: &Value) -> Result<Value, Error> {
135 self.http.patch("/api/push/tokens", body).await
136 }
137
138 pub async fn query_analytics(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
140 self.http.get_with_query("/api/analytics/query", query).await
141 }
142
143 pub async fn query_custom_events(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
145 self.http.get_with_query("/api/analytics/events", query).await
146 }
147
148 pub async fn admin_setup_status(&self) -> Result<Value, Error> {
150 self.http.get("/admin/api/setup/status").await
151 }
152
153 pub async fn admin_setup(&self, body: &Value) -> Result<Value, Error> {
155 self.http.post("/admin/api/setup", body).await
156 }
157
158 pub async fn admin_login(&self, body: &Value) -> Result<Value, Error> {
160 self.http.post("/admin/api/auth/login", body).await
161 }
162
163 pub async fn admin_refresh(&self, body: &Value) -> Result<Value, Error> {
165 self.http.post("/admin/api/auth/refresh", body).await
166 }
167
168 pub async fn admin_reset_password(&self, body: &Value) -> Result<Value, Error> {
170 self.http.post("/admin/api/internal/reset-password", body).await
171 }
172
173 pub async fn admin_list_tables(&self) -> Result<Value, Error> {
175 self.http.get("/admin/api/data/tables").await
176 }
177
178 pub async fn admin_get_table_records(&self, name: &str) -> Result<Value, Error> {
180 self.http.get(&format!("/admin/api/data/tables/{}/records", encode_path_param(name))).await
181 }
182
183 pub async fn admin_create_table_record(&self, name: &str, body: &Value) -> Result<Value, Error> {
185 self.http.post(&format!("/admin/api/data/tables/{}/records", encode_path_param(name)), body).await
186 }
187
188 pub async fn admin_update_table_record(&self, name: &str, id: &str, body: &Value) -> Result<Value, Error> {
190 self.http.put(&format!("/admin/api/data/tables/{}/records/{}", encode_path_param(name), encode_path_param(id)), body).await
191 }
192
193 pub async fn admin_delete_table_record(&self, name: &str, id: &str) -> Result<Value, Error> {
195 self.http.delete(&format!("/admin/api/data/tables/{}/records/{}", encode_path_param(name), encode_path_param(id))).await
196 }
197
198 pub async fn admin_list_users(&self) -> Result<Value, Error> {
200 self.http.get("/admin/api/data/users").await
201 }
202
203 pub async fn admin_create_user(&self, body: &Value) -> Result<Value, Error> {
205 self.http.post("/admin/api/data/users", body).await
206 }
207
208 pub async fn admin_get_user(&self, id: &str) -> Result<Value, Error> {
210 self.http.get(&format!("/admin/api/data/users/{}", encode_path_param(id))).await
211 }
212
213 pub async fn admin_update_user(&self, id: &str, body: &Value) -> Result<Value, Error> {
215 self.http.put(&format!("/admin/api/data/users/{}", encode_path_param(id)), body).await
216 }
217
218 pub async fn admin_delete_user(&self, id: &str) -> Result<Value, Error> {
220 self.http.delete(&format!("/admin/api/data/users/{}", encode_path_param(id))).await
221 }
222
223 pub async fn admin_get_user_profile(&self, id: &str) -> Result<Value, Error> {
225 self.http.get(&format!("/admin/api/data/users/{}/profile", encode_path_param(id))).await
226 }
227
228 pub async fn admin_delete_user_sessions(&self, id: &str) -> Result<Value, Error> {
230 self.http.delete(&format!("/admin/api/data/users/{}/sessions", encode_path_param(id))).await
231 }
232
233 pub async fn admin_cleanup_anon(&self) -> Result<Value, Error> {
235 self.http.post("/admin/api/data/cleanup-anon", &Value::Null).await
236 }
237
238 pub async fn admin_list_buckets(&self) -> Result<Value, Error> {
240 self.http.get("/admin/api/data/storage/buckets").await
241 }
242
243 pub async fn admin_list_bucket_objects(&self, name: &str) -> Result<Value, Error> {
245 self.http.get(&format!("/admin/api/data/storage/buckets/{}/objects", encode_path_param(name))).await
246 }
247
248 pub async fn admin_get_bucket_object(&self, name: &str, key: &str) -> Result<Value, Error> {
250 self.http.get(&format!("/admin/api/data/storage/buckets/{}/objects/{}", encode_path_param(name), encode_path_param(key))).await
251 }
252
253 pub async fn admin_delete_bucket_object(&self, name: &str, key: &str) -> Result<Value, Error> {
255 self.http.delete(&format!("/admin/api/data/storage/buckets/{}/objects/{}", encode_path_param(name), encode_path_param(key))).await
256 }
257
258 pub async fn admin_get_bucket_stats(&self, name: &str) -> Result<Value, Error> {
260 self.http.get(&format!("/admin/api/data/storage/buckets/{}/stats", encode_path_param(name))).await
261 }
262
263 pub async fn admin_create_signed_url(&self, name: &str, body: &Value) -> Result<Value, Error> {
265 self.http.post(&format!("/admin/api/data/storage/buckets/{}/signed-url", encode_path_param(name)), body).await
266 }
267
268 pub async fn admin_get_schema(&self) -> Result<Value, Error> {
270 self.http.get("/admin/api/data/schema").await
271 }
272
273 pub async fn admin_export_table(&self, name: &str) -> Result<Value, Error> {
275 self.http.get(&format!("/admin/api/data/tables/{}/export", encode_path_param(name))).await
276 }
277
278 pub async fn admin_get_logs(&self) -> Result<Value, Error> {
280 self.http.get("/admin/api/data/logs").await
281 }
282
283 pub async fn admin_get_monitoring(&self) -> Result<Value, Error> {
285 self.http.get("/admin/api/data/monitoring").await
286 }
287
288 pub async fn admin_get_analytics(&self) -> Result<Value, Error> {
290 self.http.get("/admin/api/data/analytics").await
291 }
292
293 pub async fn admin_get_analytics_events(&self) -> Result<Value, Error> {
295 self.http.get("/admin/api/data/analytics/events").await
296 }
297
298 pub async fn admin_get_overview(&self) -> Result<Value, Error> {
300 self.http.get("/admin/api/data/overview").await
301 }
302
303 pub async fn admin_get_dev_info(&self) -> Result<Value, Error> {
305 self.http.get("/admin/api/data/dev-info").await
306 }
307
308 pub async fn admin_execute_sql(&self, body: &Value) -> Result<Value, Error> {
310 self.http.post("/admin/api/data/sql", body).await
311 }
312
313 pub async fn admin_import_table(&self, name: &str, body: &Value) -> Result<Value, Error> {
315 self.http.post(&format!("/admin/api/data/tables/{}/import", encode_path_param(name)), body).await
316 }
317
318 pub async fn admin_rules_test(&self, body: &Value) -> Result<Value, Error> {
320 self.http.post("/admin/api/data/rules-test", body).await
321 }
322
323 pub async fn admin_list_functions(&self) -> Result<Value, Error> {
325 self.http.get("/admin/api/data/functions").await
326 }
327
328 pub async fn admin_get_config_info(&self) -> Result<Value, Error> {
330 self.http.get("/admin/api/data/config-info").await
331 }
332
333 pub async fn admin_get_recent_logs(&self) -> Result<Value, Error> {
335 self.http.get("/admin/api/data/logs/recent").await
336 }
337
338 pub async fn admin_get_auth_settings(&self) -> Result<Value, Error> {
340 self.http.get("/admin/api/data/auth/settings").await
341 }
342
343 pub async fn admin_get_email_templates(&self) -> Result<Value, Error> {
345 self.http.get("/admin/api/data/email/templates").await
346 }
347
348 pub async fn admin_delete_user_mfa(&self, id: &str) -> Result<Value, Error> {
350 self.http.delete(&format!("/admin/api/data/users/{}/mfa", encode_path_param(id))).await
351 }
352
353 pub async fn admin_send_password_reset(&self, id: &str) -> Result<Value, Error> {
355 self.http.post(&format!("/admin/api/data/users/{}/send-password-reset", encode_path_param(id)), &Value::Null).await
356 }
357
358 pub async fn admin_upload_file(&self, name: &str, body: &Value) -> Result<Value, Error> {
360 self.http.post(&format!("/admin/api/data/storage/buckets/{}/upload", encode_path_param(name)), body).await
361 }
362
363 pub async fn admin_get_push_tokens(&self) -> Result<Value, Error> {
365 self.http.get("/admin/api/data/push/tokens").await
366 }
367
368 pub async fn admin_get_push_logs(&self) -> Result<Value, Error> {
370 self.http.get("/admin/api/data/push/logs").await
371 }
372
373 pub async fn admin_test_push_send(&self, body: &Value) -> Result<Value, Error> {
375 self.http.post("/admin/api/data/push/test-send", body).await
376 }
377
378 pub async fn admin_backup_list_dos(&self) -> Result<Value, Error> {
380 self.http.post("/admin/api/data/backup/list-dos", &Value::Null).await
381 }
382
383 pub async fn admin_backup_dump_do(&self, body: &Value) -> Result<Value, Error> {
385 self.http.post("/admin/api/data/backup/dump-do", body).await
386 }
387
388 pub async fn admin_backup_restore_do(&self, body: &Value) -> Result<Value, Error> {
390 self.http.post("/admin/api/data/backup/restore-do", body).await
391 }
392
393 pub async fn admin_backup_dump_d1(&self) -> Result<Value, Error> {
395 self.http.post("/admin/api/data/backup/dump-d1", &Value::Null).await
396 }
397
398 pub async fn admin_backup_restore_d1(&self, body: &Value) -> Result<Value, Error> {
400 self.http.post("/admin/api/data/backup/restore-d1", body).await
401 }
402
403 pub async fn admin_backup_get_config(&self) -> Result<Value, Error> {
405 self.http.get("/admin/api/data/backup/config").await
406 }
407
408 pub async fn admin_list_admins(&self) -> Result<Value, Error> {
410 self.http.get("/admin/api/data/admins").await
411 }
412
413 pub async fn admin_create_admin(&self, body: &Value) -> Result<Value, Error> {
415 self.http.post("/admin/api/data/admins", body).await
416 }
417
418 pub async fn admin_delete_admin(&self, id: &str) -> Result<Value, Error> {
420 self.http.delete(&format!("/admin/api/data/admins/{}", encode_path_param(id))).await
421 }
422
423 pub async fn admin_change_password(&self, id: &str, body: &Value) -> Result<Value, Error> {
425 self.http.put(&format!("/admin/api/data/admins/{}/password", encode_path_param(id)), body).await
426 }
427
428 pub async fn backup_list_dos(&self, body: &Value) -> Result<Value, Error> {
430 self.http.post("/admin/api/backup/list-dos", body).await
431 }
432
433 pub async fn backup_get_config(&self) -> Result<Value, Error> {
435 self.http.get("/admin/api/backup/config").await
436 }
437
438 pub async fn backup_cleanup_plugin(&self, body: &Value) -> Result<Value, Error> {
440 self.http.post("/admin/api/backup/cleanup-plugin", body).await
441 }
442
443 pub async fn backup_wipe_do(&self, body: &Value) -> Result<Value, Error> {
445 self.http.post("/admin/api/backup/wipe-do", body).await
446 }
447
448 pub async fn backup_dump_do(&self, body: &Value) -> Result<Value, Error> {
450 self.http.post("/admin/api/backup/dump-do", body).await
451 }
452
453 pub async fn backup_restore_do(&self, body: &Value) -> Result<Value, Error> {
455 self.http.post("/admin/api/backup/restore-do", body).await
456 }
457
458 pub async fn backup_dump_d1(&self) -> Result<Value, Error> {
460 self.http.post("/admin/api/backup/dump-d1", &Value::Null).await
461 }
462
463 pub async fn backup_restore_d1(&self, body: &Value) -> Result<Value, Error> {
465 self.http.post("/admin/api/backup/restore-d1", body).await
466 }
467
468 pub async fn backup_dump_control_d1(&self) -> Result<Value, Error> {
470 self.http.post("/admin/api/backup/dump-control-d1", &Value::Null).await
471 }
472
473 pub async fn backup_restore_control_d1(&self, body: &Value) -> Result<Value, Error> {
475 self.http.post("/admin/api/backup/restore-control-d1", body).await
476 }
477
478 pub async fn backup_dump_data(&self, body: &Value) -> Result<Value, Error> {
480 self.http.post("/admin/api/backup/dump-data", body).await
481 }
482
483 pub async fn backup_restore_data(&self, body: &Value) -> Result<Value, Error> {
485 self.http.post("/admin/api/backup/restore-data", body).await
486 }
487
488 pub async fn backup_dump_storage(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
490 self.http.get_with_query("/admin/api/backup/dump-storage", query).await
491 }
492
493 pub async fn backup_restore_storage(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
495 self.http.get_with_query("/admin/api/backup/restore-storage", query).await
496 }
497
498 pub async fn backup_resync_users_public(&self) -> Result<Value, Error> {
500 self.http.post("/admin/api/backup/resync-users-public", &Value::Null).await
501 }
502
503 pub async fn backup_export_table(&self, name: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
505 self.http.get_with_query(&format!("/admin/api/backup/export/{}", encode_path_param(name)), query).await
506 }
507}