use crate::Error;
use crate::HttpClient;
use serde_json::Value;
fn encode_path_param(value: &str) -> String {
urlencoding::encode(value).into_owned()
}
pub struct GeneratedAdminApi<'a> {
http: &'a HttpClient,
}
impl<'a> GeneratedAdminApi<'a> {
pub fn new(http: &'a HttpClient) -> Self {
Self { http }
}
pub async fn admin_auth_get_user(&self, id: &str) -> Result<Value, Error> {
self.http.get(&format!("/api/auth/admin/users/{}", encode_path_param(id))).await
}
pub async fn admin_auth_update_user(&self, id: &str, body: &Value) -> Result<Value, Error> {
self.http.patch(&format!("/api/auth/admin/users/{}", encode_path_param(id)), body).await
}
pub async fn admin_auth_delete_user(&self, id: &str) -> Result<Value, Error> {
self.http.delete(&format!("/api/auth/admin/users/{}", encode_path_param(id))).await
}
pub async fn admin_auth_list_users(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/api/auth/admin/users", query).await
}
pub async fn admin_auth_create_user(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/auth/admin/users", body).await
}
pub async fn admin_auth_delete_user_mfa(&self, id: &str) -> Result<Value, Error> {
self.http.delete(&format!("/api/auth/admin/users/{}/mfa", encode_path_param(id))).await
}
pub async fn admin_auth_set_claims(&self, id: &str, body: &Value) -> Result<Value, Error> {
self.http.put(&format!("/api/auth/admin/users/{}/claims", encode_path_param(id)), body).await
}
pub async fn admin_auth_revoke_user_sessions(&self, id: &str) -> Result<Value, Error> {
self.http.post(&format!("/api/auth/admin/users/{}/revoke", encode_path_param(id)), &Value::Null).await
}
pub async fn admin_auth_import_users(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/auth/admin/users/import", body).await
}
pub async fn database_live_broadcast(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/db/broadcast", body).await
}
pub async fn execute_sql(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/sql", body).await
}
pub async fn kv_operation(&self, namespace: &str, body: &Value) -> Result<Value, Error> {
self.http.post(&format!("/api/kv/{}", encode_path_param(namespace)), body).await
}
pub async fn execute_d1_query(&self, database: &str, body: &Value) -> Result<Value, Error> {
self.http.post(&format!("/api/d1/{}", encode_path_param(database)), body).await
}
pub async fn vectorize_operation(&self, index: &str, body: &Value) -> Result<Value, Error> {
self.http.post(&format!("/api/vectorize/{}", encode_path_param(index)), body).await
}
pub async fn push_send(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/push/send", body).await
}
pub async fn push_send_many(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/push/send-many", body).await
}
pub async fn push_send_to_token(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/push/send-to-token", body).await
}
pub async fn push_send_to_topic(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/push/send-to-topic", body).await
}
pub async fn push_broadcast(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/api/push/broadcast", body).await
}
pub async fn get_push_logs(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/api/push/logs", query).await
}
pub async fn get_push_tokens(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/api/push/tokens", query).await
}
pub async fn put_push_tokens(&self, body: &Value) -> Result<Value, Error> {
self.http.put("/api/push/tokens", body).await
}
pub async fn patch_push_tokens(&self, body: &Value) -> Result<Value, Error> {
self.http.patch("/api/push/tokens", body).await
}
pub async fn query_analytics(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/api/analytics/query", query).await
}
pub async fn query_custom_events(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/api/analytics/events", query).await
}
pub async fn admin_setup_status(&self) -> Result<Value, Error> {
self.http.get("/admin/api/setup/status").await
}
pub async fn admin_setup(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/setup", body).await
}
pub async fn admin_login(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/auth/login", body).await
}
pub async fn admin_refresh(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/auth/refresh", body).await
}
pub async fn admin_reset_password(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/internal/reset-password", body).await
}
pub async fn admin_list_tables(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/tables").await
}
pub async fn admin_get_table_records(&self, name: &str) -> Result<Value, Error> {
self.http.get(&format!("/admin/api/data/tables/{}/records", encode_path_param(name))).await
}
pub async fn admin_create_table_record(&self, name: &str, body: &Value) -> Result<Value, Error> {
self.http.post(&format!("/admin/api/data/tables/{}/records", encode_path_param(name)), body).await
}
pub async fn admin_update_table_record(&self, name: &str, id: &str, body: &Value) -> Result<Value, Error> {
self.http.put(&format!("/admin/api/data/tables/{}/records/{}", encode_path_param(name), encode_path_param(id)), body).await
}
pub async fn admin_delete_table_record(&self, name: &str, id: &str) -> Result<Value, Error> {
self.http.delete(&format!("/admin/api/data/tables/{}/records/{}", encode_path_param(name), encode_path_param(id))).await
}
pub async fn admin_list_users(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/users").await
}
pub async fn admin_create_user(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/users", body).await
}
pub async fn admin_get_user(&self, id: &str) -> Result<Value, Error> {
self.http.get(&format!("/admin/api/data/users/{}", encode_path_param(id))).await
}
pub async fn admin_update_user(&self, id: &str, body: &Value) -> Result<Value, Error> {
self.http.put(&format!("/admin/api/data/users/{}", encode_path_param(id)), body).await
}
pub async fn admin_delete_user(&self, id: &str) -> Result<Value, Error> {
self.http.delete(&format!("/admin/api/data/users/{}", encode_path_param(id))).await
}
pub async fn admin_get_user_profile(&self, id: &str) -> Result<Value, Error> {
self.http.get(&format!("/admin/api/data/users/{}/profile", encode_path_param(id))).await
}
pub async fn admin_delete_user_sessions(&self, id: &str) -> Result<Value, Error> {
self.http.delete(&format!("/admin/api/data/users/{}/sessions", encode_path_param(id))).await
}
pub async fn admin_cleanup_anon(&self) -> Result<Value, Error> {
self.http.post("/admin/api/data/cleanup-anon", &Value::Null).await
}
pub async fn admin_list_buckets(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/storage/buckets").await
}
pub async fn admin_list_bucket_objects(&self, name: &str) -> Result<Value, Error> {
self.http.get(&format!("/admin/api/data/storage/buckets/{}/objects", encode_path_param(name))).await
}
pub async fn admin_get_bucket_object(&self, name: &str, key: &str) -> Result<Value, Error> {
self.http.get(&format!("/admin/api/data/storage/buckets/{}/objects/{}", encode_path_param(name), encode_path_param(key))).await
}
pub async fn admin_delete_bucket_object(&self, name: &str, key: &str) -> Result<Value, Error> {
self.http.delete(&format!("/admin/api/data/storage/buckets/{}/objects/{}", encode_path_param(name), encode_path_param(key))).await
}
pub async fn admin_get_bucket_stats(&self, name: &str) -> Result<Value, Error> {
self.http.get(&format!("/admin/api/data/storage/buckets/{}/stats", encode_path_param(name))).await
}
pub async fn admin_create_signed_url(&self, name: &str, body: &Value) -> Result<Value, Error> {
self.http.post(&format!("/admin/api/data/storage/buckets/{}/signed-url", encode_path_param(name)), body).await
}
pub async fn admin_get_schema(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/schema").await
}
pub async fn admin_list_namespace_instances(&self, namespace: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query(&format!("/admin/api/data/namespaces/{}/instances", encode_path_param(namespace)), query).await
}
pub async fn admin_export_table(&self, name: &str) -> Result<Value, Error> {
self.http.get(&format!("/admin/api/data/tables/{}/export", encode_path_param(name))).await
}
pub async fn admin_get_logs(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/logs").await
}
pub async fn admin_get_monitoring(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/monitoring").await
}
pub async fn admin_get_analytics(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/admin/api/data/analytics", query).await
}
pub async fn admin_get_analytics_events(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/analytics/events").await
}
pub async fn admin_get_overview(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/admin/api/data/overview", query).await
}
pub async fn admin_get_dev_info(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/dev-info").await
}
pub async fn admin_execute_sql(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/sql", body).await
}
pub async fn admin_import_table(&self, name: &str, body: &Value) -> Result<Value, Error> {
self.http.post(&format!("/admin/api/data/tables/{}/import", encode_path_param(name)), body).await
}
pub async fn admin_rules_test(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/rules-test", body).await
}
pub async fn admin_list_functions(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/functions").await
}
pub async fn admin_get_config_info(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/config-info").await
}
pub async fn admin_get_recent_logs(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/logs/recent").await
}
pub async fn admin_get_auth_settings(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/auth/settings").await
}
pub async fn admin_get_email_templates(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/email/templates").await
}
pub async fn admin_delete_user_mfa(&self, id: &str) -> Result<Value, Error> {
self.http.delete(&format!("/admin/api/data/users/{}/mfa", encode_path_param(id))).await
}
pub async fn admin_send_password_reset(&self, id: &str) -> Result<Value, Error> {
self.http.post(&format!("/admin/api/data/users/{}/send-password-reset", encode_path_param(id)), &Value::Null).await
}
pub async fn admin_upload_file(&self, name: &str, body: &Value) -> Result<Value, Error> {
self.http.post(&format!("/admin/api/data/storage/buckets/{}/upload", encode_path_param(name)), body).await
}
pub async fn admin_get_push_tokens(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/push/tokens").await
}
pub async fn admin_get_push_logs(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/push/logs").await
}
pub async fn admin_test_push_send(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/push/test-send", body).await
}
pub async fn admin_backup_list_dos(&self) -> Result<Value, Error> {
self.http.post("/admin/api/data/backup/list-dos", &Value::Null).await
}
pub async fn admin_backup_dump_do(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/backup/dump-do", body).await
}
pub async fn admin_backup_restore_do(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/backup/restore-do", body).await
}
pub async fn admin_backup_dump_d1(&self) -> Result<Value, Error> {
self.http.post("/admin/api/data/backup/dump-d1", &Value::Null).await
}
pub async fn admin_backup_restore_d1(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/backup/restore-d1", body).await
}
pub async fn admin_backup_dump_data(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/backup/dump-data", body).await
}
pub async fn admin_backup_restore_data(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/backup/restore-data", body).await
}
pub async fn admin_backup_get_config(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/backup/config").await
}
pub async fn admin_list_admins(&self) -> Result<Value, Error> {
self.http.get("/admin/api/data/admins").await
}
pub async fn admin_create_admin(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/admins", body).await
}
pub async fn admin_delete_admin(&self, id: &str) -> Result<Value, Error> {
self.http.delete(&format!("/admin/api/data/admins/{}", encode_path_param(id))).await
}
pub async fn admin_change_password(&self, id: &str, body: &Value) -> Result<Value, Error> {
self.http.put(&format!("/admin/api/data/admins/{}/password", encode_path_param(id)), body).await
}
pub async fn admin_destroy_app(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/data/destroy-app", body).await
}
pub async fn backup_list_dos(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/list-dos", body).await
}
pub async fn backup_get_config(&self) -> Result<Value, Error> {
self.http.get("/admin/api/backup/config").await
}
pub async fn backup_cleanup_plugin(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/cleanup-plugin", body).await
}
pub async fn backup_wipe_do(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/wipe-do", body).await
}
pub async fn backup_dump_do(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/dump-do", body).await
}
pub async fn backup_restore_do(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/restore-do", body).await
}
pub async fn backup_dump_d1(&self) -> Result<Value, Error> {
self.http.post("/admin/api/backup/dump-d1", &Value::Null).await
}
pub async fn backup_restore_d1(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/restore-d1", body).await
}
pub async fn backup_dump_control_d1(&self) -> Result<Value, Error> {
self.http.post("/admin/api/backup/dump-control-d1", &Value::Null).await
}
pub async fn backup_restore_control_d1(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/restore-control-d1", body).await
}
pub async fn backup_dump_data(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/dump-data", body).await
}
pub async fn backup_restore_data(&self, body: &Value) -> Result<Value, Error> {
self.http.post("/admin/api/backup/restore-data", body).await
}
pub async fn backup_dump_storage(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/admin/api/backup/dump-storage", query).await
}
pub async fn backup_restore_storage(&self, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query("/admin/api/backup/restore-storage", query).await
}
pub async fn backup_resync_users_public(&self) -> Result<Value, Error> {
self.http.post("/admin/api/backup/resync-users-public", &Value::Null).await
}
pub async fn backup_export_table(&self, name: &str, query: &std::collections::HashMap<String, String>) -> Result<Value, Error> {
self.http.get_with_query(&format!("/admin/api/backup/export/{}", encode_path_param(name)), query).await
}
}