fix: sync rust api-server runtime and bindings
This commit is contained in:
96
server-rs/crates/shared-contracts/src/admin.rs
Normal file
96
server-rs/crates/shared-contracts/src/admin.rs
Normal file
@@ -0,0 +1,96 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminLoginRequest {
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminLoginResponse {
|
||||
pub token: String,
|
||||
pub admin: AdminSessionPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminSessionPayload {
|
||||
pub subject: String,
|
||||
pub username: String,
|
||||
pub display_name: String,
|
||||
pub roles: Vec<String>,
|
||||
pub issued_at: String,
|
||||
pub expires_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminMeResponse {
|
||||
pub admin: AdminSessionPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminOverviewResponse {
|
||||
pub service: AdminServiceOverviewPayload,
|
||||
pub database: AdminDatabaseOverviewPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminServiceOverviewPayload {
|
||||
pub bind_host: String,
|
||||
pub bind_port: u16,
|
||||
pub jwt_issuer: String,
|
||||
pub admin_enabled: bool,
|
||||
pub spacetime_server_url: String,
|
||||
pub spacetime_database: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminDatabaseOverviewPayload {
|
||||
pub database_identity: Option<String>,
|
||||
pub owner_identity: Option<String>,
|
||||
pub host_type: Option<String>,
|
||||
pub schema_table_names: Vec<String>,
|
||||
pub table_stats: Vec<AdminDatabaseTableStatPayload>,
|
||||
pub fetch_errors: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminDatabaseTableStatPayload {
|
||||
pub table_name: String,
|
||||
pub row_count: Option<u64>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminDebugHttpRequest {
|
||||
pub method: String,
|
||||
pub path: String,
|
||||
pub headers: Option<Vec<AdminDebugHeaderInput>>,
|
||||
pub body: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminDebugHeaderInput {
|
||||
pub name: String,
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AdminDebugHttpResponse {
|
||||
pub status: u16,
|
||||
pub status_text: String,
|
||||
pub headers: Vec<AdminDebugHeaderInput>,
|
||||
pub body_text: String,
|
||||
pub body_json: Option<Value>,
|
||||
}
|
||||
Reference in New Issue
Block a user