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>,
|
||||
}
|
||||
@@ -277,6 +277,7 @@ pub struct CharacterAnimationGenerateResponse {
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CharacterAnimationDraftPayload {
|
||||
#[serde(default)]
|
||||
pub frames_data_urls: Vec<String>,
|
||||
pub fps: u32,
|
||||
#[serde(rename = "loop")]
|
||||
@@ -284,6 +285,14 @@ pub struct CharacterAnimationDraftPayload {
|
||||
pub frame_width: u32,
|
||||
pub frame_height: u32,
|
||||
#[serde(default)]
|
||||
pub frame_count: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub apply_chroma_key: Option<bool>,
|
||||
#[serde(default)]
|
||||
pub sample_start_ratio: Option<f32>,
|
||||
#[serde(default)]
|
||||
pub sample_end_ratio: Option<f32>,
|
||||
#[serde(default)]
|
||||
pub preview_video_path: Option<String>,
|
||||
}
|
||||
|
||||
@@ -815,4 +824,26 @@ mod tests {
|
||||
assert_eq!(payload["animationSetId"], json!("animation-set-1"));
|
||||
assert_eq!(payload["animationMap"]["idle"]["frames"], json!(2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn character_animation_draft_payload_accepts_backend_extraction_fields() {
|
||||
let payload = serde_json::from_value::<CharacterAnimationDraftPayload>(json!({
|
||||
"fps": 8,
|
||||
"loop": true,
|
||||
"frameWidth": 192,
|
||||
"frameHeight": 256,
|
||||
"frameCount": 8,
|
||||
"applyChromaKey": true,
|
||||
"sampleStartRatio": 0.12,
|
||||
"sampleEndRatio": 0.94,
|
||||
"previewVideoPath": "/generated-character-drafts/hero/animation/idle/task/preview.mp4"
|
||||
}))
|
||||
.expect("draft payload should deserialize without framesDataUrls");
|
||||
|
||||
assert!(payload.frames_data_urls.is_empty());
|
||||
assert_eq!(payload.frame_count, Some(8));
|
||||
assert_eq!(payload.apply_chroma_key, Some(true));
|
||||
assert_eq!(payload.sample_start_ratio, Some(0.12));
|
||||
assert_eq!(payload.sample_end_ratio, Some(0.94));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ pub struct AuthLoginOptionsResponse {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AuthUserPayload {
|
||||
pub id: String,
|
||||
pub public_user_code: String,
|
||||
pub username: String,
|
||||
pub display_name: String,
|
||||
pub phone_number_masked: Option<String>,
|
||||
@@ -24,6 +25,20 @@ pub struct AuthUserPayload {
|
||||
pub wechat_bound: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PublicUserSummaryPayload {
|
||||
pub id: String,
|
||||
pub public_user_code: String,
|
||||
pub display_name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PublicUserSearchResponse {
|
||||
pub user: PublicUserSummaryPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PasswordEntryRequest {
|
||||
|
||||
26
server-rs/crates/shared-contracts/src/big_fish_works.rs
Normal file
26
server-rs/crates/shared-contracts/src/big_fish_works.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BigFishWorkSummaryResponse {
|
||||
pub work_id: String,
|
||||
pub source_session_id: String,
|
||||
pub title: String,
|
||||
pub subtitle: String,
|
||||
pub summary: String,
|
||||
#[serde(default)]
|
||||
pub cover_image_src: Option<String>,
|
||||
pub status: String,
|
||||
pub updated_at: String,
|
||||
pub publish_ready: bool,
|
||||
pub level_count: u32,
|
||||
pub level_main_image_ready_count: u32,
|
||||
pub level_motion_ready_count: u32,
|
||||
pub background_ready: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BigFishWorksResponse {
|
||||
pub items: Vec<BigFishWorkSummaryResponse>,
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
pub mod admin;
|
||||
pub mod ai;
|
||||
pub mod api;
|
||||
pub mod assets;
|
||||
pub mod auth;
|
||||
pub mod big_fish;
|
||||
pub mod big_fish_works;
|
||||
pub mod llm;
|
||||
pub mod puzzle_agent;
|
||||
pub mod puzzle_gallery;
|
||||
|
||||
@@ -233,6 +233,8 @@ pub struct CustomWorldProfileUpsertRequest {
|
||||
pub struct CustomWorldLibraryEntryResponse {
|
||||
pub owner_user_id: String,
|
||||
pub profile_id: String,
|
||||
pub public_work_code: Option<String>,
|
||||
pub author_public_user_code: Option<String>,
|
||||
pub profile: serde_json::Value,
|
||||
pub visibility: String,
|
||||
pub published_at: Option<String>,
|
||||
@@ -252,6 +254,8 @@ pub struct CustomWorldLibraryEntryResponse {
|
||||
pub struct CustomWorldGalleryCardResponse {
|
||||
pub owner_user_id: String,
|
||||
pub profile_id: String,
|
||||
pub public_work_code: String,
|
||||
pub author_public_user_code: String,
|
||||
pub visibility: String,
|
||||
pub published_at: Option<String>,
|
||||
pub updated_at: String,
|
||||
|
||||
Reference in New Issue
Block a user