fix: sync rust api-server runtime and bindings
This commit is contained in:
@@ -140,6 +140,7 @@ pub enum CustomWorldFieldError {
|
||||
MissingProfileId,
|
||||
MissingSessionId,
|
||||
MissingOwnerUserId,
|
||||
MissingPublicWorkCode,
|
||||
MissingAction,
|
||||
MissingWorldName,
|
||||
MissingDraftProfileJson,
|
||||
@@ -170,6 +171,8 @@ pub enum CustomWorldFieldError {
|
||||
pub struct CustomWorldProfileSnapshot {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub public_work_code: Option<String>,
|
||||
pub author_public_user_code: Option<String>,
|
||||
pub source_agent_session_id: Option<String>,
|
||||
pub publication_status: CustomWorldPublicationStatus,
|
||||
pub world_name: String,
|
||||
@@ -192,6 +195,8 @@ pub struct CustomWorldProfileSnapshot {
|
||||
pub struct CustomWorldGalleryEntrySnapshot {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub public_work_code: String,
|
||||
pub author_public_user_code: String,
|
||||
pub author_display_name: String,
|
||||
pub world_name: String,
|
||||
pub subtitle: String,
|
||||
@@ -408,6 +413,8 @@ pub struct CustomWorldAgentSessionProcedureResult {
|
||||
pub struct CustomWorldProfileUpsertInput {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub public_work_code: Option<String>,
|
||||
pub author_public_user_code: Option<String>,
|
||||
pub source_agent_session_id: Option<String>,
|
||||
pub world_name: String,
|
||||
pub subtitle: String,
|
||||
@@ -426,6 +433,8 @@ pub struct CustomWorldProfileUpsertInput {
|
||||
pub struct CustomWorldProfilePublishInput {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub public_work_code: Option<String>,
|
||||
pub author_public_user_code: String,
|
||||
pub author_display_name: String,
|
||||
pub published_at_micros: i64,
|
||||
}
|
||||
@@ -467,6 +476,12 @@ pub struct CustomWorldGalleryDetailInput {
|
||||
pub profile_id: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CustomWorldGalleryDetailByCodeInput {
|
||||
pub public_work_code: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CustomWorldAgentSessionCreateInput {
|
||||
@@ -630,6 +645,8 @@ pub struct CustomWorldPublishWorldInput {
|
||||
pub session_id: String,
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub public_work_code: Option<String>,
|
||||
pub author_public_user_code: String,
|
||||
pub draft_profile_json: String,
|
||||
pub legacy_result_profile_json: Option<String>,
|
||||
pub setting_text: String,
|
||||
@@ -862,6 +879,9 @@ pub fn validate_custom_world_published_profile_compile_input(
|
||||
pub fn validate_custom_world_publish_world_input(
|
||||
input: &CustomWorldPublishWorldInput,
|
||||
) -> Result<(), CustomWorldFieldError> {
|
||||
if input.author_public_user_code.trim().is_empty() {
|
||||
return Err(CustomWorldFieldError::MissingOwnerUserId);
|
||||
}
|
||||
validate_custom_world_published_profile_compile_input(
|
||||
&CustomWorldPublishedProfileCompileInput {
|
||||
session_id: input.session_id.clone(),
|
||||
@@ -905,6 +925,9 @@ pub fn validate_custom_world_profile_publish_input(
|
||||
if input.author_display_name.trim().is_empty() {
|
||||
return Err(CustomWorldFieldError::MissingAuthorDisplayName);
|
||||
}
|
||||
if input.author_public_user_code.trim().is_empty() {
|
||||
return Err(CustomWorldFieldError::MissingOwnerUserId);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -974,6 +997,16 @@ pub fn validate_custom_world_gallery_detail_input(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn validate_custom_world_gallery_detail_by_code_input(
|
||||
input: &CustomWorldGalleryDetailByCodeInput,
|
||||
) -> Result<(), CustomWorldFieldError> {
|
||||
if input.public_work_code.trim().is_empty() {
|
||||
return Err(CustomWorldFieldError::MissingPublicWorkCode);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn validate_custom_world_session_fields(
|
||||
session_id: &str,
|
||||
owner_user_id: &str,
|
||||
@@ -1562,6 +1595,9 @@ impl fmt::Display for CustomWorldFieldError {
|
||||
Self::MissingProfileId => f.write_str("custom_world.profile_id 不能为空"),
|
||||
Self::MissingSessionId => f.write_str("custom_world.session_id 不能为空"),
|
||||
Self::MissingOwnerUserId => f.write_str("custom_world.owner_user_id 不能为空"),
|
||||
Self::MissingPublicWorkCode => {
|
||||
f.write_str("custom_world_gallery_detail.public_work_code 不能为空")
|
||||
}
|
||||
Self::MissingAction => f.write_str("custom_world_agent_action.action 不能为空"),
|
||||
Self::MissingWorldName => f.write_str("custom_world.world_name 不能为空"),
|
||||
Self::MissingDraftProfileJson => {
|
||||
|
||||
Reference in New Issue
Block a user